/* Ritual product page. Builds on styles.css (tokens, base, buttons, .bar, .foot, .rise). */

/* Tone: the product's pastel and its deep field */
body { --tone: var(--lilac); --tone-deep: var(--lilac-deep); }
body[data-tone="lilac"] { --tone: var(--lilac); --tone-deep: var(--lilac-deep); }
body[data-tone="rose"] { --tone: var(--rose); --tone-deep: var(--rose-deep); }
body[data-tone="sage"] { --tone: var(--sage); --tone-deep: var(--sage-deep); }
body[data-tone="slate"] { --tone: var(--slate); --tone-deep: var(--slate-deep); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Header: static here, so nothing slides under it */
.pp .bar { position: relative; inset: auto; }

#product { padding: 0 var(--margin); }

/* Breadcrumb */
.crumbs ol { list-style: none; margin: 0; padding: 8px 0 0; display: flex; flex-wrap: wrap; gap: 4px 0; color: var(--muted); }
.crumbs li + li::before { content: "/" / ""; padding: 0 10px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.crumbs [aria-current] { color: var(--ink); }

/* Top: gallery and buy column */
.pp-top {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: clamp(24px, 3vw, 56px); row-gap: 40px;
  margin-top: 24px; align-items: start;
}
.gallery { grid-column: 1 / 8; min-width: 0; }
.buy { grid-column: 8 / 13; position: sticky; top: 24px; min-width: 0; }

/* Gallery */
.g-stage {
  position: relative; display: block; width: 100%; aspect-ratio: 16 / 10;
  padding: 0; border: 0; border-radius: 0; overflow: hidden; cursor: zoom-in;
  background: var(--tone-deep);
}
.g-img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .15s var(--ease), transform .3s var(--ease);
}
.g-img.on { opacity: 1; }
.g-img.instant { transition: none; }
@media (hover: hover) and (pointer: fine) { .g-stage:hover .g-img.on { transform: scale(1.015); } }
.g-cap { margin-top: 12px; font-size: var(--step-small); color: var(--muted); min-height: 1.5em; }

.thumbs {
  display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr));
  gap: 12px; margin-top: 20px;
}
.thumb {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  padding: 0 0 10px; border: 0; border-radius: 0; background: none; cursor: pointer;
  color: var(--muted); font: 400 var(--step-small)/1.25 var(--text); text-align: left;
  transition: transform .18s var(--ease), color .15s ease;
}
.thumb::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--tone);
  transform: scaleX(0); transform-origin: left; transition: transform .15s var(--ease);
}
.thumb-pic { display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--tone-deep); }
.thumb-pic img { width: 100%; height: 100%; object-fit: cover; opacity: .62; transition: opacity .15s ease; }
@media (hover: hover) and (pointer: fine) {
  .thumb:hover { color: var(--ink); }
  .thumb:hover .thumb-pic img { opacity: .9; }
}
.thumb:active { transform: scale(.97); }
.thumb[aria-selected="true"] { color: var(--ink); font-weight: 500; }
.thumb[aria-selected="true"]::after { transform: scaleX(1); }
.thumb[aria-selected="true"] .thumb-pic img { opacity: 1; }

/* Buy column */
.buy-cat { color: var(--tone); font-size: 1.1875rem; line-height: 1.3; }
.buy-title {
  margin-top: 8px;
  font: 800 clamp(3rem, 1.6rem + 3.4vw, 5.5rem)/.9 var(--display);
  text-transform: uppercase; letter-spacing: -0.01em; text-wrap: balance;
}
.buy-tag { margin-top: 16px; font-size: var(--step-lead); line-height: 1.3; max-width: 30ch; }
.buy-price {
  margin-top: 28px;
  font: 800 clamp(2.75rem, 2rem + 2vw, 4rem)/1 var(--display);
  font-variant-numeric: tabular-nums; color: var(--ink);
}

.lic { margin-top: 24px; }
.lic-label { font-weight: 500; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; margin-top: 10px; }
.seg-opt {
  position: relative; display: flex; flex-direction: column; justify-content: center; gap: 2px;
  min-height: 64px; padding: 10px 16px; cursor: pointer;
  background: var(--surface-2); color: var(--ink);
  transition: background-color .15s ease, color .15s ease, transform .18s var(--ease);
}
.seg-opt input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.seg-name { font-weight: 500; line-height: 1.2; }
.seg-add { font-size: var(--step-small); color: var(--muted); font-variant-numeric: tabular-nums; }
.seg-opt:hover { background: #26242e; }
.seg-opt:active { transform: scale(.97); }
.seg-opt:has(input:checked) { background: var(--tone); color: var(--accent-ink); }
.seg-opt:has(input:checked) .seg-add { color: var(--accent-ink); }
.seg-opt:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 2px; }
.lic-hint { margin-top: 10px; color: var(--muted); min-height: 1.5em; }

.buy-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; height: 56px; margin-top: 24px; padding: 0 20px;
  border: 0; border-radius: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-ink);
  font: 500 var(--step-body)/1 var(--text); font-variant-numeric: tabular-nums;
  transition: transform .18s var(--ease), background-color .15s ease;
}
.buy-btn:hover { background: #dcb4c2; }
.buy-btn:active { transform: scale(.97); }
.buy-btn[data-state="added"] { background: var(--tone); }
.tick { flex: none; transition: opacity .18s var(--ease), transform .18s var(--ease); }
@starting-style { .tick { opacity: 0; transform: scale(.9); } }
.buy-cfg { display: inline-flex; align-items: center; min-height: 44px; margin-top: 6px; color: var(--muted); text-underline-offset: 4px; }
.buy-cfg:hover { color: var(--ink); text-decoration-thickness: 2px; }

.facts { margin: 32px 0 0; padding: 20px 24px; background: var(--surface); display: grid; gap: 8px; }
.facts div { display: grid; grid-template-columns: 9rem 1fr; gap: 16px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.facts a { text-underline-offset: 3px; }
.facts a:hover { color: var(--tone); }

/* Sections below */
.sec { margin-top: clamp(96px, 10vw, 160px); }
.sec-title {
  font: 800 clamp(2.75rem, 1.6rem + 3.4vw, 5rem)/.9 var(--display);
  text-transform: uppercase; letter-spacing: -0.01em; text-wrap: balance;
  margin-bottom: clamp(28px, 3vw, 44px);
}

.about-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: clamp(24px, 3vw, 56px); row-gap: 32px; }
.about-text { grid-column: 1 / 7; max-width: 46ch; font-size: var(--step-lead); line-height: 1.4; }
.feats { grid-column: 8 / 13; list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.feats li { position: relative; padding-left: 30px; }
.feats li::before {
  content: ""; position: absolute; left: 0; top: .45em; width: 14px; height: 14px; background: var(--tone);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
}

.pair { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: clamp(24px, 3vw, 56px); }
.pair .specs { grid-column: 1 / 7; }
.pair .log { grid-column: 8 / 13; }
.pair-one .specs { grid-column: 1 / 8; }

.spec-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.spec-table th, .spec-table td { padding: 14px 0; text-align: left; vertical-align: top; border-bottom: 1px solid #2a2832; }
.spec-table th { font-weight: 400; color: var(--muted); width: 42%; padding-right: 16px; }
.spec-table tr:first-child th, .spec-table tr:first-child td { border-top: 1px solid #2a2832; }

.log-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.log-list li { display: grid; grid-template-columns: auto 1fr; column-gap: 20px; align-items: baseline; padding: 20px 24px; background: var(--surface); }
.log-v { font: 800 clamp(1.75rem, 1.4rem + 1vw, 2.25rem)/1 var(--display); color: var(--tone); font-variant-numeric: tabular-nums; }
.log-d { color: var(--muted); }
.log-note { grid-column: 1 / -1; margin-top: 8px; }

/* Install: one card per step, the step number large in the tone */
.steps {
  list-style: none; margin: 0; padding: 0; counter-reset: step;
  display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 12px;
}
.step {
  counter-increment: step; background: var(--surface); padding: 24px 24px 28px;
  display: flex; flex-direction: column; gap: 20px; min-height: 240px;
}
.step::before {
  content: counter(step);
  font: 900 clamp(4rem, 3rem + 3vw, 6rem)/.8 var(--display); color: var(--tone);
  font-variant-numeric: tabular-nums;
}
.step p { margin-top: auto; }
pre.cfg-line { margin: 12px 0 0; padding: 24px 28px; background: var(--surface); overflow-x: auto; }
pre.cfg-line code { font: 16px/1.7 var(--code); color: var(--ink); white-space: pre; }
pre.cfg-line .c { color: var(--muted); }
pre.cfg-line .k { color: var(--tone); }

/* Product cards */
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.cards-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cards > li { display: flex; }
.card {
  position: relative; flex: 1; display: flex; flex-direction: column;
  background: var(--surface); color: var(--ink); text-decoration: none;
  transition: transform .18s var(--ease), background-color .15s ease;
}
.card:hover { background: var(--surface-2); }
.card:active { transform: scale(.99); }
.card-pic { display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--tone-deep); }
.card-pic img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s var(--ease); }
@media (hover: hover) and (pointer: fine) { .card:hover .card-pic img { transform: scale(1.04); } }
.card-body { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-name { font: 800 clamp(1.75rem, 1.4rem + 1vw, 2.25rem)/1 var(--display); text-transform: uppercase; letter-spacing: -0.01em; }
.card-tag { color: var(--muted); }
.card-price { margin-top: auto; padding-top: 8px; font: 700 1.375rem/1 var(--display); font-variant-numeric: tabular-nums; color: var(--tone); }

/* Not found */
.pp-missing { min-height: 60svh; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 20px; padding: 48px 0; }
.pp-missing-title { font: 800 var(--step-head)/.9 var(--display); text-transform: uppercase; letter-spacing: -0.01em; text-wrap: balance; }
.pp-missing p { max-width: 52ch; font-size: var(--step-lead); line-height: 1.35; }
.pp-id { color: var(--accent); }

/* Full-screen pictures */
.lb {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0;
  border: 0; background: transparent; color: var(--ink); overflow: hidden;
}
.lb::backdrop { background: rgba(5, 5, 6, .95); }
.lb[open] { display: grid; grid-template-rows: 1fr auto; transition: opacity .2s var(--ease), transform .2s var(--ease); }
@starting-style { .lb[open] { opacity: 0; transform: scale(.97); } }
.lb-fig { margin: 0; padding: 72px var(--margin) 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; min-height: 0; }
.lb-img { max-width: 100%; max-height: calc(100dvh - 210px); width: auto; height: auto; object-fit: contain; background: var(--tone-deep); }
.lb-cap { color: var(--muted); font-size: var(--step-small); text-align: center; }
.lb-nav { display: flex; align-items: center; justify-content: center; gap: 20px; padding: 20px var(--margin) 28px; }
.lb-count { min-width: 6ch; text-align: center; font-variant-numeric: tabular-nums; color: var(--muted); }
.lb-btn {
  min-width: 48px; height: 48px; padding: 0 16px; border: 0; border-radius: 0; cursor: pointer;
  background: var(--surface-2); color: var(--ink); font: 500 var(--step-body)/1 var(--text);
  transition: transform .18s var(--ease), background-color .15s ease;
}
.lb-btn:hover { background: #26242e; }
.lb-btn:active { transform: scale(.97); }
.lb-close { position: absolute; top: 16px; right: var(--margin); }

/* Phone dock: off by default, only on phones */
.dock { display: none; }

/* Tablet */
@media (max-width: 1100px) {
  .gallery { grid-column: 1 / 7; }
  .buy { grid-column: 7 / 13; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pair .specs, .pair-one .specs { grid-column: 1 / -1; }
  .pair .log { grid-column: 1 / -1; margin-top: clamp(96px, 10vw, 160px); }
}
@media (max-width: 900px) {
  .gallery, .buy { grid-column: 1 / -1; }
  .buy { position: static; }
  /* Stacked: say what the product is before the pictures, then the rest of the buy panel */
  .pp-top { row-gap: 0; }
  .buy { display: contents; }
  .buy > * { grid-column: 1 / -1; order: 2; }
  .buy-cat, .buy-title, .buy-tag { order: 0; }
  .gallery { order: 1; margin: 28px 0 32px; }
  .about-text, .feats { grid-column: 1 / -1; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Phone */
@media (max-width: 720px) {
  #product { padding: 0 16px; }
  .pp .bar { padding: 16px; }
  .pp .bar .btn { padding: 0 12px; }
  .pp-top { margin-top: 16px; row-gap: 0; }
  .thumbs { gap: 8px; grid-template-columns: repeat(var(--np, 4), minmax(0, 1fr)); }
  .thumb { font-size: 14px; padding-bottom: 8px; gap: 6px; }
  .buy-title { font-size: clamp(2.75rem, 1.5rem + 6vw, 3.5rem); }
  .facts { padding: 16px; }
  .facts div { grid-template-columns: 7.5rem 1fr; gap: 12px; }
  .steps, .cards, .cards-4 { grid-template-columns: 1fr; }
  .step { min-height: 0; flex-direction: row; align-items: flex-start; gap: 20px; padding: 20px; }
  .step::before { font-size: 3.5rem; min-width: 1ch; }
  .step p { margin-top: 0; }
  pre.cfg-line { padding: 16px; }
  pre.cfg-line code { font-size: 14px; white-space: pre-wrap; }
  .log-list li { padding: 16px; }
  .log-v { font-size: 1.375rem; }

  .dock {
    display: flex; align-items: center; gap: 12px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface-2); color: var(--ink);
    box-shadow: 0 -12px 32px rgba(0, 0, 0, .5); /* taste-skill-ignore: floating bar */
    transform: translateY(110%); transition: transform .2s var(--ease);
  }
  .dock.show { transform: none; transition: transform .3s var(--ease-drawer); }
  .dock-text { flex: 1; min-width: 0; }
  .dock-name { font: 800 1.375rem/1 var(--display); text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dock-sub { font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 2px; }
  .dock-btn {
    flex: none; display: inline-flex; align-items: center; gap: 8px;
    min-width: 104px; height: 48px; padding: 0 18px; justify-content: center;
    border: 0; border-radius: 0; cursor: pointer;
    background: var(--accent); color: var(--accent-ink); font: 500 17px/1 var(--text);
    transition: transform .18s var(--ease);
  }
  .dock-btn[data-state="added"] { background: var(--tone); }
  .dock-btn:active { transform: scale(.97); }
}
@media (max-width: 420px) {
}

@media (prefers-reduced-motion: reduce) {
  .dock { transition: none !important; }
}
