@import url("tokens.css");

/* Instrument Sans, self-hosted (SIL Open Font License 1.1) */
@font-face { font-family: "Instrument Sans"; font-weight: 400; font-display: swap; src: url("../assets/fonts/instrument-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-weight: 500; font-display: swap; src: url("../assets/fonts/instrument-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-weight: 600; font-display: swap; src: url("../assets/fonts/instrument-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-weight: 700; font-display: swap; src: url("../assets/fonts/instrument-sans-latin-700-normal.woff2") format("woff2"); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3 { color: var(--text-strong); font-weight: 600; margin: 0; letter-spacing: -0.015em; text-wrap: balance; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.label {
  font-size: var(--fs-label); font-weight: 500; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-muted);
}
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.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;
}
.skip { position: absolute; left: 8px; top: -60px; background: var(--cielo); color: var(--marino); padding: 8px 14px; border-radius: 8px; z-index: 100; text-decoration: none; font-weight: 600; }
.skip:focus { top: 8px; }

.wrap { width: 100%; max-width: calc(var(--max) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Header (matches the mockup at 1440px) ---------- */
.site-header .bar {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 2px solid var(--rule);
}
.logo { display: block; width: 205px; margin: -3px 0 0 -2px; }
.logo img { width: 205px; height: auto; }
.nav { display: flex; align-items: center; gap: 30px; margin-top: 19px; }
.nav a {
  text-decoration: none; font-size: var(--fs-nav); font-weight: 500;
  color: var(--bruma); letter-spacing: -0.005em; padding: 6px 0; position: relative;
}
.nav a[aria-current="page"]::after, .nav a:hover::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 6' preserveAspectRatio='none'%3E%3Cpath d='M1 3.6C18 2.2 33 4.1 50 3.1S83 2.4 99 3.4' fill='none' stroke='%238CC4EE' stroke-width='1.6' stroke-linecap='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
}
.bag-btn {
  position: relative; display: inline-grid; place-items: center;
  width: 44px; height: 44px; margin-left: 8px; margin-right: -16px;
  background: none; border: 0; cursor: pointer; color: var(--bruma); border-radius: 10px;
}
.bag-btn:hover { color: var(--cielo); }
.bag-btn svg { width: 28px; height: 28px; }
.bag-count {
  position: absolute; right: 2px; top: 4px; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 10px; background: var(--cielo); color: var(--marino);
  font-size: 11.5px; font-weight: 600; line-height: 19px; text-align: center;
  font-variant-numeric: tabular-nums; transform: scale(1); transition: transform .25s var(--ease);
}
.bag-count[data-zero] { display: none; }
.bag-count.bump { transform: scale(1.25); }

.nav .menu-btn { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 52px; padding: 0 34px; border-radius: var(--radius-pill);
  background: var(--cielo); color: var(--marino); border: 0; cursor: pointer;
  font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.01em; text-decoration: none;
  transition: background .2s var(--ease), transform .2s var(--ease);
}
.btn:hover { background: #a3d1f2; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--bruma); box-shadow: inset 0 0 0 1.5px var(--anil); }
.btn-ghost:hover { background: var(--panel); }
.btn-block { width: 100%; }

/* ---------- Hero ---------- */
.hero .wrap {
  display: grid; grid-template-columns: 796fr 516fr; align-items: start;
  padding-top: 45px; padding-bottom: 60px;
}
.hero h1 { font-size: var(--fs-display); font-weight: 700; line-height: 1.12; letter-spacing: -0.007em; font-kerning: none; }
.hero .lead { font-size: var(--fs-lead); color: var(--bruma); margin-top: 11px; letter-spacing: -0.006em; }
.hero .btn { margin-top: 33px; width: 220px; padding: 0; font-size: 1.125rem; font-weight: 700; }
.hero .copy { margin-top: 91px; }
.hero-photo {
  aspect-ratio: 516 / 330; border-radius: var(--radius); background: var(--panel);
  overflow: hidden; position: relative;
}
.hero-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 52%; }

/* ---------- Sections ---------- */
.section { padding: 72px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.section-head h2 { font-size: var(--fs-title); }
.section-head p { color: var(--text-muted); max-width: 48ch; }
.pen-rule { display: block; width: 100%; height: 10px; color: var(--rule); }

/* ---------- Collection grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 28px 24px; }
.card { text-decoration: none; display: flex; flex-direction: column; gap: 14px; }
.card .ph { aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--panel); position: relative; }
.card .ph img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.card:hover .ph img { transform: scale(1.03); }
.card .meta { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.card h2 { font-size: 1.125rem; letter-spacing: -0.01em; }
.card .place { color: var(--text-muted); font-size: .9375rem; }
.card .price { color: var(--text-strong); font-weight: 500; }
.card.slot { pointer-events: none; }
.card.slot .ph {
  background: transparent; display: grid; place-items: center; color: var(--anil);
  border: 1.5px dashed #3a4a86;
}
.card.slot h2 { color: var(--text-muted); font-weight: 500; }
.tag {
  position: absolute; left: 12px; top: 12px; background: rgba(30, 42, 90, .86); color: var(--bruma);
  font-size: 11px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase;
  padding: 5px 9px; border-radius: 6px;
}

/* ---------- Product page ---------- */
.product { display: grid; grid-template-columns: 1.15fr 1fr; gap: 56px; padding-top: 48px; padding-bottom: 72px; align-items: start; }
.gallery { display: grid; gap: 12px; }
.gallery .main { aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--panel); position: relative; }
.gallery .main img { width: 100%; height: 100%; object-fit: cover; }
.thumbs { display: flex; gap: 10px; }
.thumbs button { width: 76px; aspect-ratio: 1; padding: 0; border-radius: 8px; overflow: hidden; border: 2px solid transparent; background: var(--panel); cursor: pointer; }
.thumbs button[aria-current="true"] { border-color: var(--cielo); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.buy { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 22px; }
.buy h1 { font-size: var(--fs-title); line-height: 1.15; }
.buy .place { color: var(--text-muted); margin-top: 6px; }
.buy .price { font-size: 1.375rem; font-weight: 500; color: var(--text-strong); }
.sizes { border: 0; margin: 0; padding: 0; }
.sizes legend { padding: 0; margin-bottom: 10px; }
.size-row { display: flex; flex-wrap: wrap; gap: 8px; }
.size-row label { position: relative; }
.size-row input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.size-row span {
  display: grid; place-items: center; min-width: 56px; height: 46px; padding: 0 12px;
  border-radius: 10px; box-shadow: inset 0 0 0 1.5px #3a4a86; font-weight: 500; font-variant-numeric: tabular-nums;
  transition: box-shadow .15s, background .15s;
}
.size-row input:hover + span { box-shadow: inset 0 0 0 1.5px var(--anil); }
.size-row input:checked + span { background: var(--cielo); color: var(--marino); box-shadow: none; }
.size-row input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 3px; }
.form-error { color: var(--danger); font-size: .9375rem; min-height: 1.4em; }
.details { border-top: 1px solid var(--rule); padding-top: 18px; display: grid; gap: 8px; color: var(--text-muted); font-size: .9375rem; }
.details strong { color: var(--bruma); font-weight: 500; }
.story-link { color: var(--cielo); }

/* ---------- Bag drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(10, 14, 32, .55); opacity: 0; pointer-events: none; transition: opacity .25s var(--ease); z-index: 40; }
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(440px, 100%);
  background: var(--marino); border-left: 2px solid var(--rule); z-index: 50;
  transform: translateX(100%); transition: transform .3s var(--ease);
  display: flex; flex-direction: column; visibility: hidden;
}
.drawer.open { transform: none; visibility: visible; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px; border-bottom: 2px solid var(--rule); }
.drawer-head h2 { font-size: var(--fs-heading); }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; background: none; border: 0; border-radius: 10px; cursor: pointer; color: var(--bruma); }
.icon-btn:hover { background: var(--panel); }
.drawer-body { flex: 1; overflow-y: auto; padding: 8px 24px; }
.line { display: grid; grid-template-columns: 76px 1fr auto; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.line img { width: 76px; height: 76px; border-radius: 8px; object-fit: cover; background: var(--panel); }
.line h3 { font-size: 1rem; }
.line .sub { color: var(--text-muted); font-size: .875rem; }
.line .right { display: flex; flex-direction: column; align-items: end; justify-content: space-between; }
.qty { display: inline-flex; align-items: center; gap: 2px; margin-top: 8px; box-shadow: inset 0 0 0 1.5px #3a4a86; border-radius: 999px; }
.qty button { width: 32px; height: 32px; border: 0; background: none; cursor: pointer; border-radius: 999px; }
.qty button:hover { background: var(--panel); }
.qty output { min-width: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.remove { background: none; border: 0; padding: 0; color: var(--text-muted); font-size: .8125rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.remove:hover { color: var(--bruma); }
.drawer-foot { padding: 20px 24px 24px; border-top: 2px solid var(--rule); display: grid; gap: 10px; }
.sum { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.sum.total { color: var(--text-strong); font-weight: 600; font-size: 1.125rem; }
.fine { color: var(--text-muted); font-size: .8125rem; }
.empty { text-align: center; padding: 64px 12px; display: grid; gap: 18px; justify-items: center; }
.empty svg { width: 64px; height: 64px; color: var(--anil); }
.drawer-foot .btn { margin-top: 6px; }

/* ---------- Prose pages ---------- */
.prose { max-width: 680px; padding-top: 56px; padding-bottom: 80px; display: grid; gap: 20px; }
.prose h1 { font-size: var(--fs-title); }
.prose h2 { font-size: var(--fs-heading); margin-top: 28px; }
.prose p { font-size: 1.0625rem; }
.prose .label { margin-bottom: -8px; }
.story { display: grid; grid-template-columns: 1fr 1.2fr; gap: 48px; padding: 48px 0; border-bottom: 1px solid var(--rule); align-items: center; }
.story:last-child { border-bottom: 0; }
.story .ph { aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.story .ph img { width: 100%; height: 100%; object-fit: cover; }
.story .txt { display: grid; gap: 14px; }
.story h2 { font-size: var(--fs-title); }
.notice { background: var(--panel); border-radius: var(--radius); padding: 16px 18px; color: var(--bruma); font-size: .9375rem; }
.notice strong { color: var(--cielo); }

/* ---------- Checkout result / demo ---------- */
.center-page { padding-top: 72px; padding-bottom: 96px; display: grid; gap: 18px; justify-items: start; max-width: 620px; }
.center-page h1 { font-size: var(--fs-title); }
.summary { width: 100%; display: grid; gap: 10px; background: var(--panel); border-radius: var(--radius); padding: 20px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 2px solid var(--rule); margin-top: auto; }
.site-footer .wrap { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding-top: 28px; padding-bottom: 36px; flex-wrap: wrap; }
.site-footer p { color: var(--text-muted); font-size: .875rem; }
.site-footer nav { display: flex; gap: 22px; flex-wrap: wrap; }
.site-footer a { color: var(--bruma); font-size: .875rem; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  :root { --header-h: 72px; }
  .logo, .logo img { width: 132px; }
  .logo { margin-top: -4px; }
  .nav { margin-top: 0; gap: 4px; }
  .nav .links { display: none; }
  .nav .links.open {
    display: flex; flex-direction: column; position: absolute; top: var(--header-h); left: 0; right: 0;
    background: var(--marino); border-bottom: 2px solid var(--rule); padding: 8px var(--gutter) 20px; z-index: 30; gap: 0;
  }
  .nav .links.open a { padding: 14px 0; font-size: 1.125rem; border-bottom: 1px solid var(--rule); }
  .nav .links.open a::after { display: none; }
  .site-header { position: relative; }
  .nav .menu-btn { display: grid; }
  .hero .wrap { grid-template-columns: 1fr; gap: 32px; padding-top: 28px; padding-bottom: 8px; }
  .hero h1 { margin-top: 0; }
  .hero .copy { margin-top: 0; }
  .hero .btn { margin-top: 26px; }
  .product { grid-template-columns: 1fr; gap: 28px; padding-top: 24px; }
  .buy { position: static; }
  .story { grid-template-columns: 1fr; gap: 20px; }
  .section { padding: 48px 0; }
  .section-head { flex-direction: column; align-items: start; }
}
@media (min-width: 901px) { .nav .links { display: flex; gap: 30px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Reserve space while the catalog loads, so nothing jumps (layout shift). */
[data-product]:empty { min-height: 140vh; }
[data-grid]:empty { min-height: 120vh; }
[data-stories]:empty { min-height: 200vh; }
