/* THREAD — base, layout & components */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- Type helpers ---------- */
.h1 { font-size: 80px; line-height: 1.1; font-weight: 700; letter-spacing: -0.02em; }
.h2 { font-size: 40px; line-height: 1.1; font-weight: 700; letter-spacing: -0.01em; }
.h3 { font-size: 28px; line-height: 1.1; font-weight: 700; }
.body { font-size: 16px; line-height: 1.5; }
.secondary { font-size: 14px; color: var(--ink-secondary); }
.caption { font-size: 12px; color: var(--ink-secondary); }
.label-caps { font-size: 12px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; }
.accent { color: var(--accent-text); }

/* ---------- Layout ---------- */
.wrap { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--page-margin); }
.pad-section { padding-top: 40px; padding-bottom: 120px; }

/* ---------- Top bar ---------- */
.topbar {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 40;
}
.logo { font-size: 18px; font-weight: 700; letter-spacing: 0.04em; }
.logo .dot {
  display: inline-block; width: 5px; height: 5px;
  border-radius: 1.3px; background: var(--accent);
  margin-left: 3px; vertical-align: baseline;
}
.nav { display: flex; gap: 40px; }
.nav a { font-size: 14px; font-weight: 500; transition: color var(--dur); }
.nav a:hover, .nav a.active { color: var(--accent-text); }
.icons { display: flex; gap: 20px; align-items: center; }
.icon-btn { position: relative; display: grid; place-items: center; width: 24px; height: 24px; color: var(--ink); }
.icon-btn::after { content: ""; position: absolute; inset: -10px; } /* 44x44 hit area without touching the 24px visual */
.icon-btn svg { width: 21px; height: 21px; }
.badge {
  position: absolute; top: -6px; right: -8px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--accent-btn); color: var(--ink);
  border-radius: var(--radius-pill);
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}
.badge:empty, .badge[data-count="0"] { display: none; }
.burger { display: none; }

/* ---------- Breadcrumb ---------- */
.crumbs { display: flex; gap: 8px; padding: 32px 0 8px; font-size: 14px; color: var(--ink-secondary); }
.crumbs a:hover { color: var(--ink); }
.crumbs .cur { color: var(--ink); font-weight: 500; }

/* ---------- Page header ---------- */
.page-head { padding: 24px 0 32px; }
.page-head .title-row { display: flex; align-items: baseline; gap: 16px; }
.page-head .sub { margin-top: 12px; color: var(--ink-secondary); max-width: 480px; }

/* ---------- Pills / chips ---------- */
.pill-row { display: flex; flex-wrap: wrap; gap: 12px; }
.pill {
  height: 33px; padding: 0 20px;
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  background: var(--surface); font-size: 14px; font-weight: 500;
  display: inline-flex; align-items: center;
  transition: border-color var(--dur), background var(--dur), color var(--dur);
}
.pill:hover { border-color: var(--ink); }
.pill.selected { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 0 32px;
}
.toolbar .count { font-size: 14px; color: var(--ink-secondary); }
.sort {
  height: 44px; padding: 0 44px 0 20px;
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  font-size: 14px; color: var(--ink); cursor: pointer;
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' stroke='%23141414' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 18px center;
}
.sort strong { font-weight: 500; }

/* ---------- Product grid & card ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 48px 24px;
}
.card { display: block; }
.card .media {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--surface-alt);
}
.card .media img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  transition: opacity var(--dur) var(--ease);
}
.card .media .hover-img { opacity: 0; }
.card:hover .media .base-img { opacity: 0; }
.card:hover .media .hover-img { opacity: 1; }
.card .info { padding-top: 16px; display: flex; flex-direction: column; gap: 4px; }
.card .name { font-size: 18px; font-weight: 600; line-height: 1.2; }
.card .colour { font-size: 14px; color: var(--ink-secondary); }
.card .price { font-size: 20px; font-weight: 700; color: var(--accent-text); margin-top: 4px; }
.wish-btn {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px; border-radius: var(--radius-pill);
  background: rgba(255,255,255,.92); display: grid; place-items: center;
  opacity: 0; transform: translateY(-4px);
  transition: opacity var(--dur), transform var(--dur), background var(--dur);
  z-index: 2;
}
.card:hover .wish-btn { opacity: 1; transform: translateY(0); }
.wish-btn:focus-visible { opacity: 1; transform: translateY(0); } /* keyboard focus must never land on an invisible control */
@media (hover: none) { .wish-btn { opacity: 1; transform: translateY(0); } } /* no hover on touch - hearts always visible */
.wish-btn::after { content: ""; position: absolute; inset: -4px; border-radius: inherit; } /* 44x44 hit area, circle stays 36px */
.wish-btn svg { width: 18px; height: 18px; }
.wish-btn.saved svg path { fill: var(--accent); stroke: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
  height: 48px; padding: 0 32px;
  border-radius: var(--radius-pill);
  font-size: 16px; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background var(--dur), border-color var(--dur), color var(--dur), opacity var(--dur);
}
.btn-primary { background: var(--accent-btn); color: var(--ink); }
.btn-primary:hover { background: #e57638; }
.btn-primary:active { background: #d96d31; }
.btn-primary:disabled { background: var(--surface-alt); color: var(--ink-disabled); cursor: not-allowed; }
.btn-secondary { border: 1px solid var(--ink); color: var(--ink); }
.btn-secondary:hover { background: var(--surface-alt); }
.btn-block { width: 100%; }

.link-underline { font-size: 16px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.link-coral { color: var(--accent-text); }
.skip-link { position: fixed; top: -56px; left: 16px; z-index: 100; background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 100px; font-size: 14px; font-weight: 500; transition: top .15s; }
.skip-link:focus { top: 12px; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); margin-top: 40px; padding: 64px 0 80px; }
.footer .cols { display: grid; grid-template-columns: 2.2fr 1fr 1fr 1fr 1fr; gap: 40px 48px; }
.footer .brand-col { max-width: 320px; }
.footer .brand-col .logo { margin-bottom: 24px; }
.footer .brand-col p { font-size: 18px; color: var(--ink-secondary); line-height: 1.5; }
.footer .col { display: flex; flex-direction: column; gap: 12px; }
.footer .col h3 { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.footer .col a { font-size: 14px; color: var(--ink-secondary); }
.footer .col a:hover { color: var(--ink); }
/* Display-size wordmark signs the page off (composition from the mentor's edit,
   executed in our system: Inter, --ink, brand-dot proportions from the header logo) */
.footer .brand-col .logo { font-size: 44px; letter-spacing: -0.01em; }
.footer .brand-col .logo .dot { width: 12px; height: 12px; border-radius: 3px; margin-left: 6px; }
.foot-bottom { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--border); margin-top: 56px; padding-top: 24px; }
.foot-legal { font-size: 13px; color: var(--ink-secondary); display: flex; align-items: center; gap: 16px; }
.foot-legal a { color: var(--ink-secondary); text-decoration: underline; text-underline-offset: 3px; }
.foot-legal a:hover { color: var(--ink); }
.foot-pay { display: flex; gap: 8px; }
.pay-chip { min-width: 46px; height: 28px; padding: 0 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); display: inline-flex; align-items: center; justify-content: center; }
.pay-chip.visa { font-size: 10px; font-weight: 800; font-style: italic; letter-spacing: .04em; color: #1A1F71; }
.pay-chip .mc-c { width: 14px; height: 14px; border-radius: 50%; }
.pay-chip .mc-red { background: #EB001B; }
.pay-chip .mc-org { background: #F79E1B; margin-left: -6px; opacity: .92; }
.pay-chip.apple { font-size: 11px; font-weight: 600; color: var(--ink); }

/* ---------- Back to top ---------- */
.back-top {
  position: fixed; right: 24px; bottom: 24px; z-index: 30;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border); color: var(--ink);
  display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 8px 24px rgba(5,5,5,.10);
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity var(--dur), transform var(--dur), border-color var(--dur);
}
.back-top.show { opacity: 1; transform: none; pointer-events: auto; }
.back-top:hover { border-color: var(--ink); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--ink); color: #fff;
  border-radius: var(--radius-pill); padding: 14px 24px;
  display: flex; align-items: center; gap: 16px;
  font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(20,15,10,.18);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur), transform var(--dur);
  z-index: 60;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast a { color: var(--accent-btn); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Utility ---------- */
.hidden { display: none !important; }
.divider { height: 1px; background: var(--border); border: 0; }

/* ---------- Reduced motion ---------- */
/* Vestibular-safe: collapse every animation/transition when the OS asks for less motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
