/* Fettle: tokens, base, bar, index of pieces, buttons, labels, placeholders, the shelf, footer.
   Responsive method (the responsive-design skill): fluid type and spacing from clamp(), components that answer to their own
   container (@container) instead of the window, auto-fill grids, 44px touch targets on touch screens. The agreed bands
   (max-width 1099px and 640px) stay only where the whole page changes shape (stacking, the bar, the shelf). */
@import url("fonts/fonts.css");

:root {
  --ground: #dfe0db;       /* plaster: the page, and the backdrop the photos are made on */
  --ground-2: #d2d4cd;     /* a step deeper: panels, the footer */
  --paper: #e9eae6;        /* a step lighter: placeholders, fields */
  --ink: #16181d;
  --ink-soft: #434852;
  --accent: #2447d6;       /* cobalt, the one strong colour on a soft page */
  --accent-ink: #f4f5f2;
  --hair: rgb(22 24 29 / 0.16);
  --hair-2: rgb(22 24 29 / 0.34);
  --f-text: "Familjen Grotesk", system-ui, sans-serif;
  --f-mono: "Geist Mono", ui-monospace, monospace;

  /* fluid spacing: the small steps are fixed, the big ones grow with the screen and stop at their old desktop value */
  --s1: 0.25rem; --s2: 0.5rem; --s3: 0.75rem; --s4: 1rem;
  --s5: clamp(1.1rem, 0.95rem + 0.75vw, 1.5rem);
  --s6: clamp(1.5rem, 1.2rem + 1.5vw, 2rem);
  --s7: clamp(2rem, 1.5rem + 2.5vw, 3rem);
  --s8: clamp(2.5rem, 1.8rem + 3.5vw, 4rem);
  --s9: clamp(3.5rem, 2.5rem + 5vw, 6rem);
  --s10: clamp(5rem, 3.5rem + 7vw, 8rem);
  --gutter: clamp(1.25rem, 4vw, 4.5rem);
  --maxw: 92rem;
  --section: clamp(4.5rem, 9vw, 9rem);
  --bar-h: 4rem;
  --shelf-h: 4.5rem;
  --r: 3px;

  --t-xs: clamp(0.75rem, 0.72rem + 0.12vw, 0.8125rem); --t-sm: clamp(0.875rem, 0.85rem + 0.12vw, 0.9375rem);
  --t-base: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem); --t-lg: clamp(1.125rem, 1.05rem + 0.4vw, 1.25rem); --t-xl: clamp(1.5rem, 2.2vw, 2rem);
  --t-2xl: clamp(2rem, 3.6vw, 3.25rem); --t-3xl: clamp(2.6rem, 5.4vw, 5rem);

  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --shadow: 0 10px 18px -10px rgb(22 24 29 / 0.35);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar-h) + var(--s5)); }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 var(--t-base) / 1.6 var(--f-text); padding-bottom: var(--shelf-h); text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, p, dl, dd, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: fixed; left: var(--s4); top: -4rem; z-index: 100; background: var(--ink); color: var(--ground); padding: var(--s2) var(--s4); border-radius: var(--r); }
.skip:focus { top: var(--s3); }
[hidden] { display: none !important; }

h1, h2, h3, .wm, .label__n { font-family: var(--f-text); font-weight: 600; letter-spacing: -0.03em; line-height: 1.02; text-wrap: balance; }
p { text-wrap: pretty; }
.mono, .ref { font: 500 var(--t-xs) / 1.3 var(--f-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }

/* ---- bar ------------------------------------------------------------------------------------ */
.bar { position: fixed; inset: 0 0 auto; z-index: 40; height: var(--bar-h); display: flex; align-items: center; gap: var(--s6); padding-inline: var(--gutter); background: var(--ground); border-bottom: 1px solid var(--hair); }
.wm { font-size: 1.75rem; text-decoration: none; letter-spacing: -0.045em; margin-right: auto; }
.bar__nav { display: flex; align-items: center; gap: var(--s6); font-size: var(--t-sm); font-weight: 500; }
.bar__nav a, .idx-btn { text-decoration: none; padding: var(--s2) 0; border-bottom: 1px solid transparent; transition: border-color 0.16s var(--ease); }
.bar__nav a:hover, .idx-btn:hover, .bar__nav a[aria-current="page"] { border-bottom-color: var(--ink); }
.idx-btn { background: none; border: 0; border-bottom: 1px solid transparent; color: inherit; font: inherit; cursor: pointer; display: inline-flex; gap: var(--s2); align-items: center; }
.idx-btn::after { content: ""; width: 0.45rem; height: 0.45rem; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg) translateY(-2px); transition: transform 0.16s var(--ease); }
.idx-btn[aria-expanded="true"]::after { transform: rotate(225deg) translateY(-2px); }
.bar__shelf { display: inline-flex; align-items: center; gap: var(--s2); font-size: var(--t-sm); font-weight: 500; text-decoration: none; padding: var(--s2) var(--s4); border: 1px solid var(--ink); border-radius: var(--r); transition: background 0.16s var(--ease), color 0.16s var(--ease); }
.bar__shelf:hover { background: var(--ink); color: var(--ground); }
.bar__n { min-width: 1.4rem; height: 1.4rem; display: inline-grid; place-items: center; background: var(--accent); color: var(--accent-ink); border-radius: 99px; font: 600 0.72rem / 1 var(--f-mono); padding-inline: 0.3rem; }
.bar__n[hidden] { display: none; }

/* ---- index of pieces (the nav: it jumps) ------------------------------------------------------ */
.index { position: fixed; z-index: 39; top: var(--bar-h); inset-inline: 0; background: var(--ground-2); border-bottom: 1px solid var(--hair-2); box-shadow: 0 18px 30px -22px rgb(22 24 29 / 0.5); max-height: calc(100svh - var(--bar-h) - var(--shelf-h)); overflow: auto; }
.index__in { padding: var(--s5) var(--gutter) var(--s6); max-width: var(--maxw); margin-inline: auto; }
.index__h { font: 500 var(--t-xs) / 1 var(--f-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: var(--s4); }
.index__list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 var(--s6); }
.index__list a { display: grid; grid-template-columns: 2.75rem auto 1fr auto; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--hair); text-decoration: none; transition: background 0.16s var(--ease); }
.index__list a:hover .index__n { text-decoration: underline; text-underline-offset: 0.2em; }
.index__sil { width: 2.75rem; height: 2.5rem; }
.index__n { font-weight: 600; letter-spacing: -0.02em; }
.index__p { font: 500 var(--t-sm) / 1 var(--f-mono); }

/* ---- buttons and lines ------------------------------------------------------------------------ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 2.9rem; padding: 0 var(--s5); border: 1px solid var(--ink); border-radius: var(--r); background: var(--ink); color: var(--ground); font: 600 var(--t-sm) / 1 var(--f-text); letter-spacing: 0.01em; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background 0.16s var(--ease), color 0.16s var(--ease), transform 0.12s var(--ease); }
.btn:hover { background: transparent; color: var(--ink); }
.btn:active { transform: translateY(1px) scale(0.985); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: transparent; color: var(--accent); }
.btn--sm { min-height: 2.4rem; padding: 0 var(--s4); }
.btn--block { display: flex; width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.line { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 0.28em; }
.line::after { content: "→"; text-decoration: none; display: inline-block; transition: transform 0.16s var(--ease); }
.line:hover::after { transform: translateX(3px); }
.line + .line { margin-left: var(--s5); }

/* ---- the label: reference, name, glaze, size, price. Same everywhere ----------------------------- */
.label { display: grid; grid-template-columns: minmax(0, 1fr) auto; min-width: 0; gap: var(--s1) var(--s4); padding-top: var(--s3); border-top: 1px solid var(--hair-2); }
.label .ref { grid-column: 1 / -1; }
.label__n { font-size: var(--t-xl); }
.label__n a { text-decoration: none; }
.label__n a:hover { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 0.18em; }
.label__d { grid-column: 1; font-size: var(--t-sm); color: var(--ink-soft); }
.label__d div { display: grid; grid-template-columns: 3rem 1fr; gap: var(--s2); }
.label__d dt { font: 500 var(--t-xs) / 1.7 var(--f-mono); letter-spacing: 0.06em; text-transform: uppercase; }
.label__p { grid-column: 2; grid-row: 2 / span 2; align-self: start; font: 600 var(--t-lg) / 1.1 var(--f-text); letter-spacing: -0.02em; }

.sw { display: inline-block; width: 0.85rem; height: 0.85rem; border-radius: 99px; background: var(--g); border: 1px solid rgb(22 24 29 / 0.35); vertical-align: -0.1em; margin-right: var(--s2); }

/* ---- pictures and placeholders ------------------------------------------------------------------ */
/* A photo is matched to the page's ground by tools/make-img.mjs; its edges fade into the page so any leftover difference doesn't show as a box. */
.pic { --f: 4%; display: block; width: 100%; overflow: hidden; -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--f), #000 calc(100% - var(--f)), transparent), linear-gradient(to bottom, transparent, #000 var(--f), #000 calc(100% - var(--f)), transparent); mask-image: linear-gradient(to right, transparent, #000 var(--f), #000 calc(100% - var(--f)), transparent), linear-gradient(to bottom, transparent, #000 var(--f), #000 calc(100% - var(--f)), transparent); -webkit-mask-composite: source-in; mask-composite: intersect; }
.photo { display: block; width: 100%; height: 100%; object-fit: cover; }
.ph { position: relative; width: 100%; background: var(--paper); border: 1px dashed var(--hair-2); display: grid; place-items: center; overflow: hidden; }
.ph__tag { position: absolute; left: var(--s3); top: var(--s3); font: 500 0.66rem / 1 var(--f-mono); letter-spacing: 0.04em; color: var(--ink-soft); }
.ph__sil { width: 72%; height: auto; margin-top: 8%; filter: drop-shadow(0 6px 5px rgb(22 24 29 / 0.16)); }
.ph--scene { padding: var(--s6); text-align: center; }
.ph__what { max-width: 26ch; font-size: var(--t-sm); color: var(--ink-soft); text-wrap: balance; }
.sil { width: 100%; height: auto; }

/* ---- the shelf: the cart, drawn as a shelf along the bottom edge ----------------------------------- */
.shelf { position: fixed; inset: auto 0 0; z-index: 38; height: var(--shelf-h); display: flex; align-items: flex-end; gap: var(--s5); padding: 0 var(--gutter); background: var(--ground); border-top: 1px solid var(--hair); }
html:not(.js) .shelf { display: none; }
.shelf__label { align-self: center; display: grid; gap: 2px; min-width: 9.5rem; }
.shelf__t { font-size: var(--t-sm); font-weight: 600; }
.shelf__board { flex: 1; min-width: 0; align-self: stretch; display: flex; align-items: flex-end; gap: 0; padding-bottom: 8px; position: relative; }
.shelf__board::after { content: ""; position: absolute; inset: auto 0 5px; height: 3px; background: var(--ink); border-radius: 2px; }
.shelf__board > li { position: relative; z-index: 1; margin-right: -6px; }
.unit { display: block; width: 3.1rem; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; transform-origin: 50% 100%; transition: transform 0.16s var(--ease); }
.unit .sil { height: 3.1rem; filter: drop-shadow(0 2px 1.5px rgb(22 24 29 / 0.25)); }
.unit:hover, .unit:focus-visible { transform: translateY(-5px); }
.unit.is-new { animation: settle 0.34s var(--spring) both; }
@keyframes settle { from { transform: translateY(-1.6rem); opacity: 0; } 60% { opacity: 1; } to { transform: none; opacity: 1; } }
.shelf__hint { align-self: center; font-size: var(--t-sm); color: var(--ink-soft); padding-bottom: 6px; }
.shelf__more { align-self: center; padding: 0 var(--s3) 6px; }
.shelf__go { align-self: center; flex: none; }
.shelf__go.is-off { display: none; }
body.page-cart .shelf, body.page-checkout .shelf { display: none; }
body.page-cart, body.page-checkout { padding-bottom: 0; }

/* ---- footer ---------------------------------------------------------------------------------------- */
.foot { margin-top: var(--section); background: var(--ground-2); border-top: 1px solid var(--hair); }
.foot__main { display: grid; grid-template-columns: 1.1fr 1fr 0.7fr 1fr; gap: var(--s7); padding: var(--s8) var(--gutter) var(--s7); max-width: var(--maxw); margin-inline: auto; font-size: var(--t-sm); }
.foot h2 { font: 500 var(--t-xs) / 1 var(--f-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: var(--s3); }
.foot address { font-style: normal; }
.foot__small { color: var(--ink-soft); margin-top: var(--s2); }
.foot__links li + li { margin-top: var(--s1); }
.wm--foot { font-size: 3rem; align-self: start; margin: 0; }
.foot__end { display: flex; justify-content: space-between; gap: var(--s5); flex-wrap: wrap; padding: var(--s4) var(--gutter) var(--s5); max-width: var(--maxw); margin-inline: auto; font-size: var(--t-xs); color: var(--ink-soft); border-top: 1px solid var(--hair); }
body.page-cart .foot, body.page-checkout .foot { margin-top: var(--s9); }

main { padding-top: var(--bar-h); min-height: 60svh; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

/* ---- tablet and phone ---------------------------------------------------------------------------------- */
@media (max-width: 1099px) {
  .index__list { grid-template-columns: repeat(2, 1fr); }
  .foot__main { grid-template-columns: 1fr 1fr; }
  .bar__nav { gap: var(--s5); }
}
@media (max-width: 640px) {
  :root { --bar-h: 3.5rem; --shelf-h: 4rem; --gutter: 1.25rem; }
  .wm { font-size: 1.5rem; }
  .bar { gap: var(--s4); }
  .bar__nav a { display: none; }
  .bar__nav { gap: var(--s4); }
  .index__list { grid-template-columns: 1fr; }
  .shelf { gap: var(--s3); }
  .shelf__label { min-width: 5.5rem; }
  .shelf__t { font-size: var(--t-xs); }
  .unit { width: 2.75rem; } .unit .sil { height: 2.75rem; }
  .shelf__hint { display: none; }
  .foot__main { grid-template-columns: 1fr; gap: var(--s6); }
}

/* ---- components that answer to their own container (not the window) ------------------------------------- */
/* A piece's label sits in a shop tile, a walk card or a "more" tile: their widths run from about 10rem to 17rem. */
.tile, .obj { container-type: inline-size; }
@container (max-width: 13rem) {
  .label { grid-template-columns: minmax(0, 1fr); }
  .label .ref { order: 0; }
  .label__n { order: 1; font-size: clamp(1.05rem, 9cqi, 1.4rem); }
  .label__p { order: 2; grid-column: 1; grid-row: auto; font-size: var(--t-base); }
  .label__d { order: 3; }
  .label__d div { grid-template-columns: 2.6rem minmax(0, 1fr); }
}

/* ---- touch screens: every control at least 44px (decided by the input, not the width) ------------------- */
@media (pointer: coarse) {
  .idx-btn { min-block-size: 2.75rem; }
  .bar__shelf { min-block-size: 2.75rem; }
  .btn, .btn--sm { min-block-size: 2.75rem; }
  .line { min-block-size: 2.75rem; }
  .foot__links a, .foot__main a:not(.wm) { display: inline-block; padding-block: 0.4rem; }
  .qty button, .qty input { min-block-size: 2.75rem; }
  .row__x { min-block-size: 2.75rem; padding-inline: var(--s3); }
}
@media (pointer: coarse) and (min-width: 641px) { .bar__nav a { min-block-size: 2.75rem; display: inline-flex; align-items: center; } }
