/* =====================================================================
   GS-COM content pages (sections gs-page-*, templates page.gs-*.json)
   Layout rules only. Fonts, colors, radius and buttons come from the
   gs- kit tokens in gs-description.css, so pages match product pages.
   Loaded only on gs- page templates (layout/theme.liquid).
   Same theme guard as the kit: .gs-page:not(#gs-kit) beats Ella's rules.
   ===================================================================== */

.gs-page.gs-pg:not(#gs-kit) {
  --gs-pg-pad: 40px;
  padding: var(--gs-pg-pad) 0;
  background: var(--gs-pg-bg, transparent);

  & .container > :last-child { margin-bottom: 0; }

  /* ---------- Shared pieces ------------------------------------------ */
  & .gs-pg-head { max-width: 820px; margin: 0 auto 28px; }
  & .gs-pg-head--center { text-align: center; }
  & .gs-pg-head--left { margin-left: 0; }
  & .gs-pg-head__text > :last-child { margin-bottom: 0; }

  & .gs-pg-btn {
    display: inline-block;
    padding: 12px 30px;
    border: 2px solid var(--gs-accent);
    border-radius: var(--gs-pill);
    background: var(--gs-accent);
    color: var(--gs-on-accent);
    font-weight: 600;
    line-height: 1.3;
    text-decoration: none;
    box-shadow: var(--gs-shadow);
    transition: filter 0.15s, transform 0.15s;
  }
  & .gs-pg-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
  & .gs-pg-btn--ghost { background: #fff; color: var(--gs-accent); box-shadow: none; }

  & .gs-pg-card {
    padding: 24px;
    background: #fff;
    border: 1px solid var(--gs-line);
    border-radius: var(--gs-radius);
    box-shadow: var(--gs-shadow);
  }

  /* ---------- Banner (gs-page-hero) ---------------------------------- */
  &.gs-pg-hero {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 240px;
    padding: 48px 0;
    overflow: hidden;
    background: var(--gs-dark);
    color: #fff;
  }
  &.gs-pg-hero--medium { min-height: 300px; }
  &.gs-pg-hero--large { min-height: 420px; }
  &.gs-pg-hero--plain { background: var(--gs-soft); color: var(--gs-text); }
  &.gs-pg-hero > .container { position: relative; z-index: 2; width: 100%; }
  & .gs-pg-hero__media,
  & .gs-pg-hero__img { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; border-radius: 0; object-fit: cover; }
  &.gs-pg-hero:not(.gs-pg-hero--plain)::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: rgba(0, 0, 0, var(--gs-pg-overlay, 0.45));
  }
  & .gs-pg-hero__inner { max-width: 760px; }
  &.gs-pg-hero--center .gs-pg-hero__inner { margin: 0 auto; text-align: center; }
  & .gs-pg-hero__title {
    margin: 0;
    color: inherit;
    font-size: 2.1em;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: 0;
    text-transform: none;
  }
  &.gs-pg-hero:not(.gs-pg-hero--plain) .gs-pg-hero__title { color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.25); }
  & .gs-pg-hero__text { margin-top: 14px; font-size: 1.05em; }
  & .gs-pg-hero__text > :last-child { margin-bottom: 0; }
  &.gs-pg-hero:not(.gs-pg-hero--plain) .gs-pg-hero__text :is(p, strong, a) { color: #fff; }
  & .gs-pg-hero__actions { margin: 22px 0 0; }

  & .gs-pg-crumbs { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 0 0 12px; font-size: 0.85em; opacity: 0.9; }
  & .gs-pg-crumbs a { color: inherit; text-decoration: none; }
  & .gs-pg-crumbs a:hover { text-decoration: underline; }
  &.gs-pg-hero--center .gs-pg-crumbs { justify-content: center; }

  /* ---------- Tiles (gs-page-tiles) ---------------------------------- */
  & .gs-pg-groups { display: flex; flex-wrap: wrap; gap: 24px; }
  & .gs-pg-group { width: 100%; }
  &.gs-pg-tiles--panel .gs-pg-group {
    padding: 24px 18px;
    background: #fff;
    border: 1px solid var(--gs-line);
    border-radius: var(--gs-radius);
    box-shadow: var(--gs-shadow);
  }
  & .gs-pg-group__title { margin: 0 0 20px; font-size: 1.35em; }

  & .gs-pg-grid {
    --gap: 16px;
    --cols: var(--cols-m, 2);
    display: flex;
    flex-wrap: wrap;
    gap: 24px var(--gap);
  }
  &.gs-pg-tiles--center .gs-pg-grid { justify-content: center; }
  & .gs-pg-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols));
    color: var(--gs-title);
    text-align: center;
    text-decoration: none;
    transition: transform 0.2s ease;
  }
  &.gs-pg-tiles--hover a.gs-pg-tile:hover,
  &.gs-pg-tiles--hover .gs-pg-tile:has(> .gs-pg-tile__body > a.gs-pg-tile__label:hover) { transform: translateY(-4px); }
  & .gs-pg-tile__media { display: block; width: 100%; }
  & .gs-pg-tile__img { margin: 0 auto; }
  & .gs-pg-tile__body { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 12px; }
  & .gs-pg-tile__label { color: var(--gs-title); font-weight: 600; line-height: 1.3; text-decoration: none; }
  & a.gs-pg-tile__label:hover, & a.gs-pg-tile:hover .gs-pg-tile__label { color: var(--gs-accent); }
  & .gs-pg-tile__text { font-size: 0.9em; line-height: 1.75; color: var(--gs-muted); }
  & .gs-pg-tile__text p { margin: 0; }
  & .gs-pg-tile__text a { color: var(--gs-text); text-decoration: none; }
  & .gs-pg-tile__text a:hover { color: var(--gs-accent); text-decoration: underline; }
  & .gs-pg-tile__more { font-size: 0.85em; font-weight: 600; color: var(--gs-accent); text-decoration: none; }

  /* Icon style: small centered image */
  &.gs-pg-tiles--icon .gs-pg-tile__img { width: var(--gs-pg-icon, 100px); max-width: 100%; height: auto; border-radius: 0; }

  /* Photo style: square product photo on white */
  &.gs-pg-tiles--photo .gs-pg-tile__img { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; border-radius: var(--gs-radius); background: #fff; }

  /* Banner style: label and link over a photo */
  &.gs-pg-tiles--banner .gs-pg-tile {
    align-items: stretch;
    min-height: 190px;
    overflow: hidden;
    border-radius: var(--gs-radius);
    background: #fff;
    box-shadow: var(--gs-shadow);
    text-align: left;
  }
  &.gs-pg-tiles--banner .gs-pg-tile__media { position: absolute; inset: 0; }
  &.gs-pg-tiles--banner .gs-pg-tile__img { width: 100%; height: 100%; object-fit: cover; object-position: center bottom; border-radius: 0; }
  &.gs-pg-tiles--banner .gs-pg-tile__body { position: relative; align-items: flex-start; margin: 0; padding: 20px 22px; }
  &.gs-pg-tiles--banner .gs-pg-tile__label { font-size: 1.3em; font-weight: 700; }

  /* Card style: small photo beside the title, sub-links as pills, "Shop all" link */
  &.gs-pg-tiles--card .gs-pg-grid { gap: var(--gap); }
  &.gs-pg-tiles--card .gs-pg-tile {
    flex-direction: row;
    align-items: flex-start;
    gap: 18px;
    padding: 18px;
    background: #fff;
    border: 1px solid var(--gs-line);
    border-radius: var(--gs-radius);
    box-shadow: var(--gs-shadow);
    text-align: left;
  }
  &.gs-pg-tiles--card .gs-pg-tile__media {
    flex: 0 0 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    padding: 8px;
    background: var(--gs-soft);
    border-radius: var(--gs-radius);
  }
  &.gs-pg-tiles--card .gs-pg-tile__img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
  &.gs-pg-tiles--card .gs-pg-tile__body { flex: 1; min-width: 0; align-items: flex-start; gap: 10px; margin: 0; }
  &.gs-pg-tiles--card .gs-pg-tile__label { font-size: 1.2em; font-weight: 700; }
  &.gs-pg-tiles--card .gs-pg-tile__text { line-height: 1.4; }
  &.gs-pg-tiles--card .gs-pg-tile__text :is(p, ul) { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
  &.gs-pg-tiles--card .gs-pg-tile__text br { display: none; }
  &.gs-pg-tiles--card .gs-pg-tile__text a {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid var(--gs-line);
    border-radius: var(--gs-pill);
    background: #fff;
    color: var(--gs-text);
    font-size: 0.95em;
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s;
  }
  &.gs-pg-tiles--card .gs-pg-tile__text a:hover { border-color: var(--gs-accent); color: var(--gs-accent); text-decoration: none; }
  &.gs-pg-tiles--card .gs-pg-tile__more::after { content: " \2192"; }
  &.gs-pg-tiles--card .gs-pg-tile__more:hover { text-decoration: underline; }
  @media (min-width: 768px) {
    &.gs-pg-tiles--card .gs-pg-tile { gap: 24px; padding: 24px; }
    &.gs-pg-tiles--card .gs-pg-tile__media { flex-basis: 150px; padding: 12px; }
  }

  /* ---------- Image + text rows (gs-page-split) ---------------------- */
  & .gs-pg-split__row:last-child { margin-bottom: 0; }
  & .gs-pg-split__row ul { padding-left: 1.2em; }

  /* ---------- Store locations (gs-page-locations) -------------------- */
  & .gs-pg-store {
    display: grid;
    margin: 0 0 24px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--gs-line);
    border-radius: var(--gs-radius);
    box-shadow: var(--gs-shadow);
  }
  & .gs-pg-store:last-child { margin-bottom: 0; }
  & .gs-pg-store__info { padding: 24px; }
  & .gs-pg-store__name { margin: 0 0 12px; font-size: 1.5em; }
  & .gs-pg-store__intro { margin: 0 0 18px; }
  & .gs-pg-store__intro > :last-child { margin-bottom: 0; }
  & .gs-pg-store__facts { display: grid; gap: 18px 28px; }
  & .gs-pg-fact { position: relative; padding-left: 40px; }
  & .gs-pg-fact h3 { margin: 0 0 4px; font-size: 1em; }
  & .gs-pg-fact p { margin: 0; }
  & .gs-pg-fact a { color: var(--gs-text); text-decoration: none; }
  & .gs-pg-fact a:hover { color: var(--gs-accent); text-decoration: underline; }
  & .gs-pg-fact::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 28px;
    height: 28px;
    background: var(--gs-accent);
    -webkit-mask: var(--gs-pg-fact-icon) center / contain no-repeat;
    mask: var(--gs-pg-fact-icon) center / contain no-repeat;
  }
  & .gs-pg-fact--address { --gs-pg-fact-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22s7-6.2 7-12a7 7 0 0 0-14 0c0 5.8 7 12 7 12z'/%3E%3Ccircle cx='12' cy='10' r='2.6'/%3E%3C/svg%3E"); }
  & .gs-pg-fact--hours { --gs-pg-fact-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E"); }
  & .gs-pg-fact--phone { --gs-pg-fact-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 3h3.5l1.8 4.5-2.3 1.4a11 11 0 0 0 7.1 7.1l1.4-2.3L21 15.5V19a2 2 0 0 1-2 2A17 17 0 0 1 3 5a2 2 0 0 1 2-2z'/%3E%3C/svg%3E"); }
  & .gs-pg-fact--email { --gs-pg-fact-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='M3 7l9 6 9-6'/%3E%3C/svg%3E"); }
  & .gs-pg-store__directions { margin: 22px 0 0; }
  & .gs-pg-store__map { min-height: 280px; background: var(--gs-soft); }
  & .gs-pg-store__map iframe { display: block; width: 100%; height: 100%; min-height: 280px; border: 0; }

  /* ---------- Message form (gs-page-form) ---------------------------- */
  & .gs-pg-form__card { max-width: 820px; margin: 0 auto; }
  & .gs-pg-form__text { margin: 0 0 20px; }
  & .gs-pg-form__row { display: grid; gap: 0 20px; }
  & .gs-pg-field { display: block; margin: 0 0 16px; }
  & .gs-pg-field__label { display: block; margin: 0 0 6px; font-weight: 600; font-size: 0.9em; color: var(--gs-title); }
  & .gs-pg-field :is(input, textarea) {
    display: block;
    width: 100%;
    margin: 0;
    padding: 12px 14px;
    border: 1px solid #d0d4da;
    border-radius: 8px;
    background: #fff;
    color: var(--gs-title);
    font: inherit;
    box-shadow: none;
  }
  & .gs-pg-field :is(input, textarea):focus { outline: 2px solid var(--gs-accent); outline-offset: 1px; border-color: var(--gs-accent); }
  & .gs-pg-form__actions { margin: 4px 0 0; }
  & .gs-pg-form__status { margin: 0 0 16px; padding: 14px 16px; border-radius: 8px; }
  & .gs-pg-form__status > :last-child { margin-bottom: 0; }
  & .gs-pg-form__status--ok { background: #e8f6ee; color: #14532d; }
  & .gs-pg-form__status--error { background: #fdecec; color: #8a1c1c; }

  /* ---------- Images (gs-page-image) --------------------------------- */
  & .gs-pg-image__item { max-width: var(--gs-pg-max, 960px); margin: 0 auto 32px; }
  & .gs-pg-image__item:last-child { margin-bottom: 0; }
  & .gs-pg-image__item img { box-shadow: var(--gs-shadow); }
  & .gs-pg-image__caption { margin-top: 16px; text-align: center; }
  & .gs-pg-image__caption > :last-child { margin-bottom: 0; }

  /* ---------- Tablet and up (Ella's 768px breakpoint) ---------------- */
  @media (min-width: 768px) {
    --gs-pg-pad: 56px;
    & .gs-pg-card { padding: 36px 40px; }
    &.gs-pg-hero { padding: 64px 0; min-height: 280px; }
    &.gs-pg-hero--medium { min-height: 360px; }
    &.gs-pg-hero--large { min-height: 520px; }
    & .gs-pg-hero__title { font-size: 2.8em; }
    &.gs-pg-tiles--panel .gs-pg-group { padding: 32px 28px; }
    & .gs-pg-grid { --gap: 24px; --cols: var(--cols-t, 3); }
    & .gs-pg-store__info { padding: 36px 40px; }
    & .gs-pg-store__facts { grid-template-columns: 1fr 1fr; }
    & .gs-pg-store__map, & .gs-pg-store__map iframe { min-height: 320px; }
    & .gs-pg-form__row--2 { grid-template-columns: 1fr 1fr; }
  }
  @media (min-width: 1025px) {
    & .gs-pg-grid { --cols: var(--cols-d, 4); }
    & .gs-pg-group--half { width: calc(50% - 12px); }
    /* Store cards: info and map side by side only when each half is wide enough for the 2-column facts. */
    & .gs-pg-store { grid-template-columns: 1fr 1fr; }
    & .gs-pg-store--reverse .gs-pg-store__info { order: 2; }
    & .gs-pg-store__map, & .gs-pg-store__map iframe { min-height: 100%; }
    &.gs-pg-hero--fixed { background: var(--gs-pg-fixed-bg) center / cover no-repeat fixed; }
    &.gs-pg-hero--fixed .gs-pg-hero__media { display: none; }
  }
}

/* Pull a card section up over the banner above it (tiles, form). */
.gs-page-section:has(.gs-pg-hero) + .gs-page-section .gs-page.gs-pg:is(.gs-pg-tiles--pull, .gs-pg-form--pull):not(#gs-kit) {
  padding-top: 0;
  display: flow-root; /* keep the card's negative margin inside, so only the card (not the section background) rises over the banner */
  & .container > :first-child { position: relative; z-index: 3; margin-top: -60px; }
  @media (min-width: 768px) {
    & .container > :first-child { margin-top: -90px; }
  }
}

/* Leave room at the bottom of a banner that a card overlaps. */
.gs-page-section:has(.gs-pg-hero):has(+ .gs-page-section :is(.gs-pg-tiles--pull, .gs-pg-form--pull)) .gs-page.gs-pg-hero:not(#gs-kit) {
  padding-bottom: 100px;
  @media (min-width: 768px) { padding-bottom: 130px; }
}
