/* ============================================
   Gallerí — The Curated Wall
   Brand: Kauply — íslensk smávöruverslun sem hangir verkin upp
          eins og á sýningu. A small Icelandic shop that presents its
          goods like a hung exhibition: matted, captioned, accessioned.
   Identity: transparent header floating over an edge-to-edge plate,
             one dominant Sorts Mill Goudy display voice, generous
             museum negative space, and a SIGNATURE accession-number
             caption — every product is "Nr. 01 — Heiti verks" with a
             hairline plaque rule, like a wall label beside the work.
   Motif:    accession plate (CSS counter, decimal-leading-zero) +
             passe-partout mat frame on the PDP. No other theme has this.
   Fonts:    Sorts Mill Goudy (display) + Chivo (body) — consumed from
             injected --font-display / --font-body.
   Palette:  consumed from injected --text / --surface / --accent etc.
             via color-mix; NEVER hardcoded so each store recolours.
   ============================================ */

.theme-gallery {
  /* --- Modular type scale, 1.28 ratio, ONE dominant display step --- */
  --step-caption: 0.75rem;   /* wall-label caption / eyebrow         */
  --step-meta: 0.8125rem;    /* accession number, prices in captions */
  --step-0: 1rem;            /* body / description                   */
  --step-1: 1.28rem;         /* section subtitle (named exhibition)  */
  --step-2: 1.64rem;         /* lesser headings                      */
  --step-3: clamp(2rem, 3.5vw, 2.6rem);   /* PDP-adjacent            */
  --step-display: clamp(2.75rem, 7vw, 5.25rem); /* the one big voice */

  /* --- Intentional vertical rhythm --- */
  --rhythm: clamp(5rem, 12vw, 9rem);   /* between exhibition sections */
  --plate-gap: 0.85rem;                /* artwork → wall label        */

  /* --- Ink ramp derived from injected palette (WCAG-safe, no opacity-fade) --- */
  --gallery-ink: var(--text);
  --gallery-mute: color-mix(in oklab, var(--text) 64%, var(--surface));
  --gallery-faint: color-mix(in oklab, var(--text) 44%, var(--surface));
  --gallery-line: color-mix(in oklab, var(--text) 20%, transparent);
  --gallery-line-soft: color-mix(in oklab, var(--text) 12%, transparent);
  --gallery-plate: color-mix(in oklab, var(--surface) 92%, var(--text));
  --gallery-invert-bg: var(--text);
  --gallery-invert-fg: var(--surface);

  /* Letterforms: serif sets the voice, body relaxes the measure */
  letter-spacing: 0;

  /* ============================================
     TRANSPARENT EDGE HERO — the core identity.
     The header floats, light, over the first dark plate — but ONLY on
     pages that actually have a full-bleed dark hero behind it. Inner
     pages (catalog, PDP, cart) keep a normal opaque sticky bar so the
     nav never goes light-on-light or overlaps content.
     ============================================ */
  &:has(.hero.hero-edge) header {
    position: absolute;
    inset-inline: 0;
    top: 0;
    z-index: 100;
    background: transparent;
    border-block-end: none;
    backdrop-filter: none;

    & .logo-text,
    & nav a,
    & .icon-btn,
    & .lang-btn {
      /* The header floats over a full-bleed DARK plate, so its text must be
         light. The old color-mix leaned on --surface, which is dark under a dark
         color scheme — making the nav vanish. Pin it light. */
      color: oklch(0.96 0.006 250);
    }

    & .logo-mark { color: var(--accent); }

    & nav a:hover {
      background: color-mix(in oklab, var(--surface) 18%, transparent);
    }

    & .icon-btn:hover {
      background: color-mix(in oklab, var(--surface) 18%, transparent);
    }
  }

  /* Inner pages with no dark hero: a quiet opaque rail, dark ink. */
  &:not(:has(.hero.hero-edge)) header {
    background: color-mix(in oklab, var(--surface) 96%, var(--text));
    border-block-end: 1px solid var(--gallery-line-soft);

    & .logo-mark { color: var(--accent); }
  }

  & .hero.hero-edge {
    min-height: 100vh;
    margin-block-start: 0;
    /* True full-bleed: the section is max-width and not always centered under the
       transparent header, so bleed to the full viewport, not just the gutter. */
    width: 100vw;
    margin-inline: calc(50% - 50vw);
    background: color-mix(in oklab, var(--text) 88%, var(--surface));

    & .hero-bg {
      opacity: 0.5;
      transition: opacity 1.1s var(--ease-out), transform 1.4s var(--ease-out);
    }

    &:hover .hero-bg { opacity: 0.58; }

    & .hero-center {
      max-width: 64ch;

      & h1 {
        font-family: var(--font-display);
        font-weight: 400;
        font-style: normal;
        font-size: var(--step-display);
        line-height: 1.02;
        letter-spacing: -0.012em;
        text-shadow: 0 1px 30px color-mix(in oklab, var(--text) 60%, transparent);
      }

      & .hero-eyebrow {
        font-family: var(--font-body);
        font-size: var(--step-caption);
        font-weight: 500;
        letter-spacing: 0.32em;
        text-transform: uppercase;
        color: color-mix(in oklab, var(--surface) 80%, var(--text));
      }

      & .hero-sub {
        font-size: var(--step-0);
        line-height: 1.8;
        max-width: 52ch;
        margin-inline: auto;
        color: color-mix(in oklab, var(--surface) 78%, var(--text));
      }
    }
  }

  /* Other hero variants: still let the floating header read by darkening
     the top band, and give the display its single dominant voice. */
  & .hero-content {
    & .hero-eyebrow {
      font-family: var(--font-body);
      font-size: var(--step-caption);
      font-weight: 500;
      letter-spacing: 0.32em;
      text-transform: uppercase;
      color: var(--accent);
    }

    & h1 {
      font-family: var(--font-display);
      font-weight: 400;
      font-size: var(--step-display);
      line-height: 1.02;
      letter-spacing: -0.012em;
    }

    & .hero-sub {
      font-size: var(--step-0);
      line-height: 1.8;
      max-width: 48ch;
      color: var(--gallery-mute);
    }
  }

  & .hero-minimal h1,
  & .hero-banner .hero-banner-text h1,
  & .hero-split .hero-text-col h1 {
    font-family: var(--font-display);
    font-weight: 400;
    font-style: normal;
    font-size: var(--step-display);
    line-height: 1.04;
    letter-spacing: -0.012em;
  }

  /* Hero CTAs: a quiet light plate on the dark wall, square corners */
  & .hero-actions a {
    border-radius: 0;
    font-family: var(--font-body);
    font-size: var(--step-caption);
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    padding-block: 0.85em;
    transition: transform 0.4s var(--ease-out), opacity 0.4s var(--ease-out);

    &:hover { transform: translateY(-2px); opacity: 0.92; box-shadow: none; }
  }

  /* ============================================
     NEGATIVE-SPACE RHYTHM — generous exhibition spacing
     ============================================ */
  & main > section {
    padding-block: var(--rhythm);
  }

  /* ============================================
     SECTION HEAD — exhibition title, not a faded micro-label.
     Tiny uppercase eyebrow (h2) over a large italic Goudy named line (p).
     ============================================ */
  & .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    margin-block-end: clamp(2rem, 4vw, 3.25rem);
    position: relative;
    padding-block-end: 1.25rem;
    border-block-end: 1px solid var(--gallery-line);

    & h2 {
      font-family: var(--font-body);
      font-size: var(--step-caption);
      font-weight: 600;
      letter-spacing: 0.3em;
      text-transform: uppercase;
      color: var(--gallery-mute);
    }

    & p {
      font-family: var(--font-display);
      font-style: italic;
      font-weight: 400;
      font-size: var(--step-1);
      line-height: 1.2;
      color: var(--gallery-ink);
      max-width: 46ch;
    }

    & .section-link {
      position: absolute;
      inset-block-end: 1.25rem;
      inset-inline-end: 0;
      font-family: var(--font-body);
      font-size: var(--step-caption);
      letter-spacing: 0.14em;
      text-transform: uppercase;
      color: var(--gallery-mute);

      &:hover { color: var(--gallery-ink); }
    }
  }

  /* ============================================
     CATEGORIES — a single hung rail of text plates.
     Hairline divider strip; the active/hover plate lifts in ink.
     ============================================ */
  & .category-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border-block: 1px solid var(--gallery-line);
  }

  & .category-card {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 1.75rem 2.5rem;
    border-inline-end: 1px solid var(--gallery-line-soft);
    box-shadow: none;
    transition: background 0.45s var(--ease-out);

    & .category-image { display: none; }

    & h3 {
      font-family: var(--font-display);
      font-style: italic;
      font-size: var(--step-2);
      font-weight: 400;
      letter-spacing: 0;
      text-transform: none;
      color: var(--gallery-mute);
      transition: color 0.4s var(--ease-out);
    }

    & p { display: none; }

    &:hover {
      background: color-mix(in oklab, var(--text) 5%, transparent);
      box-shadow: none;

      & h3 { color: var(--gallery-ink); }
    }

    &:last-child { border-inline-end: none; }

    &.sale {
      background: transparent;
      color: var(--accent);
      & h3 { color: var(--accent); }
    }
  }

  /* ============================================
     PRODUCT GRID — the gallery WALL.
     Generous, breathing spacing (museum hang), not a 4px mosaic.
     ============================================ */
  & .product-grid {
    gap: clamp(2.5rem, 5vw, 4rem) clamp(1.5rem, 3vw, 2.25rem);
    counter-reset: accession;
  }

  @media (min-width: 769px) {
    & .product-grid {
      grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
  }

  & .product-card {
    counter-increment: accession;
    border-radius: 0;
    overflow: visible;
    transition: none;
    box-shadow: none;

    & .product-image {
      border-radius: 0;
      background: color-mix(in oklab, var(--text) 6%, var(--surface));
      /* Artwork stays STILL — the base scale-on-hover is overridden. */
      transition: none;
    }

    & img { border-radius: 0; }

    &:hover {
      box-shadow: none;

      & .product-image { transform: none; }
      & .product-image-hover { opacity: 1; }
    }

    /* --- SIGNATURE: the wall label / accession plate --- */
    & .product-info {
      border-block-start: 1px solid var(--gallery-line);
      margin-block-start: var(--plate-gap);
      padding: var(--plate-gap) 0.125rem 0;
      display: grid;
      grid-template-columns: 1fr auto;
      column-gap: 1rem;
      row-gap: 0.15rem;
      /* caption fades in like a placard — quiet, transform+opacity only */
      opacity: 0;
      transform: translateY(7px);
      transition:
        opacity 0.55s var(--ease-out),
        transform 0.55s var(--ease-out);
    }

    &:hover .product-info,
    &:focus-within .product-info {
      opacity: 1;
      transform: none;
    }

    /* Accession number: "Nr. 01 — " before the brand line */
    & .product-brand {
      grid-column: 1 / -1;
      font-family: var(--font-body);
      font-size: var(--step-caption);
      font-weight: 600;
      letter-spacing: 0.16em;
      text-transform: uppercase;
      color: var(--gallery-faint);

      &::before {
        content: "Nr. " counter(accession, decimal-leading-zero) "  \2014  ";
        color: var(--accent);
        font-variant-numeric: tabular-nums;
      }
    }

    & h3 {
      grid-column: 1;
      font-family: var(--font-display);
      font-style: italic;
      font-weight: 400;
      font-size: var(--step-1);
      line-height: 1.18;
      color: var(--gallery-ink);
      margin: 0;

      & a { color: inherit; }
    }

    & .product-price {
      grid-column: 2;
      align-self: start;
      font-family: var(--font-body);
      font-size: var(--step-meta);
      font-weight: 400;
      font-variant-numeric: tabular-nums;
      color: var(--gallery-mute);
      text-align: end;

      & ins { color: var(--accent); }
      & del { color: var(--gallery-faint); }
    }

    /* Add action: square light plate inverted on the wall */
    & .card-action {
      grid-column: 1 / -1;
      margin-block-start: 0.6rem;
      border-radius: 0;
      background: var(--gallery-invert-bg);
      color: var(--gallery-invert-fg);
      font-family: var(--font-body);
      font-size: var(--step-caption);
      font-weight: 500;
      letter-spacing: 0.16em;
      text-transform: uppercase;
      transition: opacity 0.35s var(--ease-out);

      &:hover { opacity: 0.85; }
      &.added { background: var(--accent); }
    }

    & .card-variants > button {
      border-radius: 0;
      background: var(--gallery-invert-bg);
      color: var(--gallery-invert-fg);
    }

    & .sale-badge {
      border-radius: 0;
      background: var(--accent);
      letter-spacing: 0.08em;
    }
  }

  /* ============================================
     NEWSLETTER — a quiet closing wall, hairline framed.
     ============================================ */
  & .newsletter {
    background: color-mix(in oklab, var(--text) 4%, var(--surface));
    border-radius: 0;
    border-block: 1px solid var(--gallery-line);

    & h2 {
      font-family: var(--font-display);
      font-style: italic;
      font-weight: 400;
      font-size: var(--step-3);
      line-height: 1.15;
      color: var(--gallery-ink);
    }

    & p {
      font-size: var(--step-0);
      line-height: 1.75;
      max-width: 50ch;
      margin-inline: auto;
      color: var(--gallery-mute);
    }

    & form {
      background: var(--surface);
      border: 1px solid var(--gallery-line);
      border-radius: 0;
    }

    & input {
      border-radius: 0;
      background: transparent;
      color: var(--gallery-ink);

      &::placeholder { color: var(--gallery-faint); }
    }

    & button {
      border-radius: 0;
      background: var(--gallery-invert-bg);
      color: var(--gallery-invert-fg);
      letter-spacing: 0.14em;
      text-transform: uppercase;
      font-size: var(--step-caption);

      &:hover { background: var(--accent); }
    }
  }

  /* ============================================
     CTA-styled empty/PDP buttons — same inverted plate language.
     ============================================ */
  & .empty-state a,
  & .empty-state-btn {
    border-radius: 0;
    background: var(--gallery-invert-bg);
    color: var(--gallery-invert-fg);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-size: var(--step-caption);
  }

  /* ============================================
     CATALOG — the open gallery, sparse and wide.
     ============================================ */
  & .catalog { gap: clamp(2rem, 5vw, 4rem); }

  & .catalog-toolbar {
    border-block-end: 1px solid var(--gallery-line);
    padding-block-end: 1rem;

    & .result-count {
      font-family: var(--font-body);
      font-size: var(--step-caption);
      letter-spacing: 0.18em;
      text-transform: uppercase;
      font-weight: 600;
      color: var(--gallery-mute);
    }

    & .filter-toggle {
      border-radius: 0;
      font-size: var(--step-caption);
      letter-spacing: 0.14em;
      text-transform: uppercase;
      color: var(--gallery-mute);
    }

    & .sort-select select {
      border-radius: 0;
      background: transparent;
      border-color: var(--gallery-line);
      color: var(--gallery-ink);
    }
  }

  & .filter-group h3 {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    font-size: var(--step-meta);
    color: var(--gallery-mute);
  }

  & .active-filters .active-filter-pill {
    border-radius: 0;
    background: transparent;
    border-color: var(--gallery-line);
    color: var(--gallery-mute);
    font-size: var(--step-caption);
    letter-spacing: 0.08em;
    text-transform: uppercase;

    &:hover { background: var(--gallery-invert-bg); color: var(--gallery-invert-fg); }
  }

  /* ============================================
     PDP — asymmetric museum layout + passe-partout mat frame.
     ============================================ */
  & .pdp {
    grid-template-columns: 1.4fr 1fr;
    gap: clamp(3.5rem, 8vw, 7rem);
  }

  /* SIGNATURE motif on PDP: matted, framed artwork (no AI drop-shadow) */
  & .pdp-gallery > .pdp-hero {
    border-radius: 0;
    box-shadow:
      0 0 0 1px var(--gallery-line),
      0 0 0 16px var(--surface),
      0 0 0 17px var(--gallery-line);
  }

  & .pdp-gallery > nav > button {
    border-radius: 0;
    border: none;
    border-block-end: 2px solid transparent;
    opacity: 0.55;
    transition: opacity 0.35s var(--ease-out), border-color 0.35s var(--ease-out);

    &:hover { opacity: 0.85; border-color: var(--gallery-line); }

    &[aria-pressed="true"] {
      opacity: 1;
      border-block-end: 2px solid var(--accent);
    }
  }

  & .pdp-info {
    & .pdp-brand {
      font-family: var(--font-body);
      font-size: var(--step-caption);
      font-weight: 600;
      letter-spacing: 0.22em;
      text-transform: uppercase;
      color: var(--gallery-mute);
    }

    & h1 {
      font-family: var(--font-display);
      font-weight: 400;
      font-style: normal;
      font-size: var(--step-3);
      line-height: 1.05;
      letter-spacing: -0.01em;
      color: var(--gallery-ink);
    }

    & .pdp-price {
      font-family: var(--font-body);
      font-size: var(--step-1);
      font-weight: 400;
      font-variant-numeric: tabular-nums;
      color: var(--gallery-ink);
      border-block-end: 1px solid var(--gallery-line);
    }

    & .pdp-description {
      font-size: var(--step-0);
      line-height: 1.85;
      color: var(--gallery-mute);
      max-width: 62ch;
    }

    & .pdp-subtitle { color: var(--gallery-mute); }
  }

  & .pdp-add-btn {
    border-radius: 0;
    background: var(--gallery-invert-bg);
    color: var(--gallery-invert-fg);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-size: var(--step-meta);
    transition: opacity 0.35s var(--ease-out);

    &:hover { opacity: 0.85; }
  }

  & .pdp-actions .quantity-selector {
    border-radius: 0;
    background: transparent;
    border: 1px solid var(--gallery-line);
    color: var(--gallery-ink);
  }

  & .pdp-variants .pdp-variant-btn {
    border-radius: 0;
    background: transparent;
    border: 1px solid var(--gallery-line);
    color: var(--gallery-mute);
    font-size: var(--step-caption);
    letter-spacing: 0.08em;
    transition: color 0.3s var(--ease-out), border-color 0.3s var(--ease-out);

    &:hover { color: var(--gallery-ink); border-color: var(--gallery-line); }
    &[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
  }

  & .pdp-trust {
    font-family: var(--font-body);
    font-size: var(--step-caption);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gallery-faint);
  }

  & .pdp-tabs .pdp-tab-nav button {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: var(--step-meta);
    color: var(--gallery-mute);
    transition: color 0.3s var(--ease-out);

    &:hover { color: var(--gallery-ink); }
    &[aria-selected="true"] { color: var(--accent); }
  }

  /* ============================================
     RELATED — closing wall, exhibition rule.
     ============================================ */
  & .related-section {
    border-block-start: 1px solid var(--gallery-line);
    padding-block-start: var(--rhythm);
    margin-block-start: var(--rhythm);

    & .section-head p {
      font-family: var(--font-display);
      font-style: italic;
      font-weight: 400;
      color: var(--gallery-ink);
    }
  }

  /* ============================================
     FOOTER — quiet baseline of the exhibition.
     ============================================ */
  & footer {
    background: color-mix(in oklab, var(--text) 4%, var(--surface));
    border-block-start: 1px solid var(--gallery-line);

    & .footer-brand .logo-text {
      font-family: var(--font-display);
      font-style: italic;
      font-weight: 400;
    }
  }
}
