/* ============================================================================
 * base.css — Depalma design tokens + primitives.
 * The single source of truth for colour, type and shared primitives.
 * Page-specific rules belong in that page's own stylesheet, never here.
 * See DESIGN.md for why each value is what it is.
 * ========================================================================== */
@import url("fonts.css");

:root {
  /* palette — taken from the garments (bone, sage, grey, black) */
  --ground:   #141312;
  --ground-2: #1C1A18;
  --ink:      #E8E2D6;
  --muted:    #8B857A;
  --sage:     #9FAE9A;
  --seam:     rgba(232, 226, 214, .22);

  /* the footer is the brand's black ground in both themes */
  --footer-ground: #141312;
  --footer-ink:    #E8E2D6;
  --footer-accent: #9FAE9A;

  /* named layers keep sticky chrome below modal UI */
  --z-local: 1;
  --z-content: 1;
  --z-raised: 2;
  --z-header: 20;
  --z-overlay: 40;
  --z-skip: 50;

  /* product colours stay true when the interface theme changes */
  --garment-bone:  #E8E2D6;
  --garment-sage:  #9FAE9A;
  --garment-grey:  #8B857A;
  --garment-black: #141312;

  /* type */
  --display: "Bodoni Moda", Georgia, serif;
  --body:    "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --data:    "Space Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* rhythm */
  --gutter:  clamp(1.25rem, 4vw, 3rem);
  --stack:   clamp(3.5rem, 9vw, 8rem);
  --measure: 62ch;
  --radius:  2px;
  --tap:     44px;
  --header-height: 76px;

  /* motion */
  --ease: cubic-bezier(.22, .61, .36, 1);
  --fast: 160ms;
  --slow: 320ms;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --ground:   #EFEBE3;
  --ground-2: #E4DFD5;
  --ink:      #1A1917;
  --muted:    #6E6A62;
  --sage:     #5F6E58;
  --seam:     rgba(26, 25, 23, .20);

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-height) + 1rem);
}

html, body { overflow-x: clip; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.6;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
}

img, video { max-width: 100%; height: auto; display: block; }

button, input, select { font: inherit; }

a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--sage); }

:focus-visible {
  outline: 2px solid var(--sage);
  outline-offset: 2px;
  border-radius: var(--radius);
}

/* ---------------------------------------------------------------- type ---- */
.display {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.75rem, 9vw, 7rem);
  line-height: .92;
  letter-spacing: -.02em;
  margin: 0;
}

.head {
  font-family: var(--body);
  font-weight: 700;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  line-height: 1.15;
  letter-spacing: -.01em;
  margin: 0;
}

/* Every number the shop knows about: prices, sizes, stock, order refs. */
.data {
  font-family: var(--data);
  font-size: .8125rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

.data--ink { color: var(--ink); }
.prose { max-width: var(--measure); }
.prose p { margin: 0 0 1em; }

/* A section label with a hairline running to each side. */
.seam-label {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.25rem;
  margin: 0 0 2rem;
}
.seam-label::before, .seam-label::after {
  content: ""; height: 1px; background: var(--seam);
}

/* --------------------------------------------------------------- layout --- */
.wrap { width: min(100% - var(--gutter) * 2, 1360px); margin-inline: auto; }
.stack > * + * { margin-top: var(--stack); }
.page-main { min-height: 65vh; padding-block: clamp(2rem, 6vw, 5rem) var(--stack); }
.status { padding: 2rem; border: 1px solid var(--seam); background: var(--ground-2); }
.status p { margin: 0 0 1.25rem; }

/* An even column count keeps the product rhythm balanced. */
.grid-products {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(.75rem, 2vw, 2rem);
}
@media (min-width: 900px)  { .grid-products { grid-template-columns: repeat(4, 1fr); } }

/* -------------------------------------------------------------- controls -- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: var(--tap);
  padding: .75rem 1.5rem;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--ground);
  font-family: var(--body);
  font-size: .9375rem;
  font-weight: 600;
  letter-spacing: .01em;
  cursor: pointer;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.btn:hover:not(:disabled) { background: var(--sage); border-color: var(--sage); color: var(--ground); }
.btn:disabled { background: transparent; border-color: var(--seam); color: var(--muted); cursor: not-allowed; }

.btn--ghost { background: transparent; color: var(--ink); border-color: var(--seam); }
.btn--ghost:hover:not(:disabled) { background: transparent; border-color: var(--sage); color: var(--sage); }

.field { display: block; margin-bottom: 1.25rem; }
.field > span { display: block; margin-bottom: .375rem; }
.input {
  width: 100%;
  min-height: var(--tap);
  padding: .625rem .875rem;
  background: var(--ground-2);
  border: 1px solid var(--seam);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1rem;
}
.input:focus-visible { border-color: var(--sage); }
.input[aria-invalid="true"] { border-color: var(--ink); }

.theme-toggle {
  width: var(--tap);
  min-width: var(--tap);
  height: var(--tap);
  min-height: var(--tap);
  padding: 0;
  border: 1px solid var(--seam);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--sage); color: var(--sage); }

.brand-mark {
  display: inline-block;
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  background: var(--ink);
  -webkit-mask: url("img/mark.png") center / contain no-repeat;
  mask: url("img/mark.png") center / contain no-repeat;
}

/* ---------------------------------------------------------- product card -- */
.card { position: relative; display: block; }
.card__media {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--ground-2);
  border-radius: var(--radius);
}
.card__media img { width: 100%; height: 100%; object-fit: cover; }
/* No photo yet: show the mark, small and quiet, on the surface colour —
   not a full-bleed white box. */
.media-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  opacity: .34;
  background: var(--ink);
  -webkit-mask: url("img/mark.png") center / 56% auto no-repeat;
  mask: url("img/mark.png") center / 56% auto no-repeat;
}

/* Hover mirrors the garment about its own axis — the monogram's trick. */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .card__media img { transition: transform var(--slow) var(--ease); }
  .card:hover .card__media img { transform: scaleX(-1); }
}

.card__meta { display: flex; justify-content: space-between; gap: 1rem; margin-top: .75rem; }
.card__title { font-weight: 600; }
.card--sold .card__media img { opacity: .45; }

.price-display { display: inline-flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-end; gap: .25rem .5rem; }
.price-old { color: var(--muted); text-decoration: line-through; }
.sale-label { padding: .12rem .35rem; border: 1px solid currentColor; color: var(--ink); font-size: .65rem; }
.saving-line { color: var(--muted); }
.tag-chip { display: inline-flex; align-items: center; min-height: var(--tap); padding: .45rem .7rem; border: 1px solid var(--seam); font: .72rem var(--data); text-transform: lowercase; }
.tag-chip:hover { border-color: var(--sage); }

:where([id]) { scroll-margin-top: calc(var(--header-height) + 1rem); }

/* ---------------------------------------------------------------- utils --- */
.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;
}
[hidden] { display: none !important; }

@media (prefers-reduced-motion: no-preference) {
  main { animation: content-in var(--slow) var(--ease) both; }
  @keyframes content-in { from { opacity: 0; } to { opacity: 1; } }
}

@media (max-width: 430px) {
  :root { --header-height: 68px; }
}
