:root {
  --navy: #002147;        /* Imperial deep navy */
  --blue: #0072ce;        /* Imperial blue accent */
  --blue-dark: #005bab;
  --ink: #1a1f29;
  --muted: #5d6675;
  --line: #e7e9ef;
  --bg: #f5f6f9;
  --card: #ffffff;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 12px 28px -12px rgba(16,24,40,.18);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Hero ---------- */
.hero {
  background:
    radial-gradient(1200px 400px at 80% -10%, rgba(0,114,206,.35), transparent 60%),
    linear-gradient(135deg, var(--navy), #00132b);
  color: #fff;
  padding: clamp(3rem, 8vw, 6rem) 1.5rem clamp(3.5rem, 9vw, 7rem);
  text-align: center;
}
.hero-inner { max-width: 720px; margin: 0 auto; }
.kicker {
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: .78rem;
  font-weight: 600;
  color: #8fd0ff;
  margin: 0 0 .9rem;
}
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1.04;
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
  font-weight: 800;
}
.lede {
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  color: #c4d4e6;
  margin: 0 auto;
  max-width: 32rem;
  line-height: 1.6;
}

/* ---------- Grid ---------- */
main { max-width: 1240px; margin: 0 auto; padding: 0 1.5rem; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.5rem;
  margin-top: -3rem;
  padding-bottom: 4rem;
}

/* ---------- Card ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: transform .25s ease, box-shadow .25s ease;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 2px 4px rgba(16,24,40,.08), 0 24px 44px -18px rgba(16,24,40,.32);
}

.media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #eef1f6;
  background-image:
    linear-gradient(135deg, #f3f5f9 0%, #e8ecf3 100%);
}
.media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 1.2rem;
}
/* Hover swap: reveal the back photo where a product has one. */
.media.has-back .back-img {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .3s ease;
}
.card:hover .media.has-back .back-img { opacity: 1; }
.card:hover .media.has-back .front-img { opacity: 0; transition: opacity .3s ease; }
.thumbs {
  position: absolute;
  bottom: .7rem;
  left: .7rem;
  display: flex;
  gap: .4rem;
}
.thumb {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  border: 2px solid #fff;
  background-size: cover;
  background-position: center;
  background-color: #fff;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 2px 6px rgba(16,24,40,.18);
  opacity: .85;
  transition: opacity .15s ease, transform .15s ease;
}
.thumb:hover { opacity: 1; transform: translateY(-1px); }
.thumb.active { outline: 2px solid var(--blue); opacity: 1; }

/* ---------- Body ---------- */
.body { padding: 1.15rem 1.25rem 1.4rem; display: flex; flex-direction: column; flex: 1; }
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .75rem;
}
.card-head h2 {
  font-size: 1.18rem;
  margin: 0 0 .3rem;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.colour {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin: 0;
  font-size: .85rem;
  color: var(--muted);
}
.dot {
  width: 13px; height: 13px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,.18);
  background: #ccc;
  flex: none;
}
.price {
  margin: 0;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--navy);
  white-space: nowrap;
}
.blurb {
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.5;
  margin: .85rem 0 1.1rem;
}
.cta {
  margin-top: auto;
  font-weight: 700;
  font-size: .92rem;
  color: var(--blue);
  transition: transform .15s ease;
}
.card:hover .cta { transform: translateX(3px); }

.sizes-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 600;
  color: #97a0b0;
  margin: 0 0 .55rem;
}
.sizes {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 0 0 1.4rem;
}
.size {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: .6rem .8rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
}
.size:hover {
  border-color: var(--blue);
  color: var(--blue);
  transform: translateY(-1px);
}
.size.selected {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
  box-shadow: 0 6px 14px -6px rgba(0,33,71,.6);
}

/* ---------- Topbar (detail page) ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--navy);
  color: #fff;
}
.topbar-title { font-weight: 600; letter-spacing: -0.01em; opacity: .85; }
.back {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: .92rem;
  opacity: .9;
}
.back:hover { opacity: 1; text-decoration: underline; }

/* ---------- Detail layout ---------- */
.detail-main { max-width: 1080px; margin: 0 auto; padding: clamp(1.5rem,4vw,3rem) 1.5rem; }
.detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
}
.gallery { position: sticky; top: 1.5rem; }
.gallery-main {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: linear-gradient(135deg, #f3f5f9 0%, #e8ecf3 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.gallery-thumbs { display: flex; gap: .6rem; margin-top: .8rem; }
.g-thumb {
  width: 70px; height: 70px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background-size: cover;
  background-position: center;
  background-color: #fff;
  cursor: pointer;
  padding: 0;
  transition: border-color .15s ease;
}
.g-thumb:hover { border-color: #b9c2d0; }
.g-thumb.active { border-color: var(--blue); }

.info h1 {
  font-size: clamp(1.6rem, 3.5vw, 2.3rem);
  letter-spacing: -0.02em;
  margin: .35rem 0 .6rem;
  line-height: 1.1;
}
.colour.big { font-size: .95rem; margin: 0; }
.colour.big .dot { width: 15px; height: 15px; }
.price.big { font-size: 1.6rem; margin: 0 0 1.1rem; }
.info .blurb { margin: 0 0 1.8rem; font-size: .95rem; }

.buy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  box-shadow: 0 10px 24px -10px rgba(0,114,206,.7);
  transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}
.buy-btn:hover { background: var(--blue-dark); transform: translateY(-2px); }
.buy-btn.disabled {
  background: #e7e9ef;
  color: #98a1b1;
  cursor: not-allowed;
  box-shadow: none;
  pointer-events: auto;
}
.shop-note { font-size: .8rem; color: var(--muted); margin: .9rem 0 0; text-align: center; }

/* ---------- Size guide ---------- */
.size-guide {
  margin-top: 1.4rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.size-guide summary {
  cursor: pointer;
  padding: .85rem 1.1rem;
  font-weight: 600;
  font-size: .92rem;
  color: var(--navy);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.size-guide summary::-webkit-details-marker { display: none; }
.size-guide summary::after {
  content: "+";
  font-size: 1.2rem;
  color: var(--muted);
  line-height: 1;
}
.size-guide[open] summary::after { content: "\2212"; } /* minus */
.size-guide summary:hover { background: #f8f9fc; }

.size-guide-scroll { overflow-x: auto; padding: 0 1.1rem; }
.size-guide table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  min-width: 360px;
}
.size-guide th, .size-guide td {
  padding: .55rem .6rem;
  text-align: center;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.size-guide thead th { color: var(--navy); font-weight: 700; }
.size-guide th:first-child, .size-guide td:first-child {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
}
.size-guide tbody tr:last-child td { border-bottom: none; }
.size-guide-note {
  margin: 0;
  padding: .7rem 1.1rem 1rem;
  font-size: .78rem;
  color: var(--muted);
}

.not-found { text-align: center; padding: 4rem 1rem; }
.not-found h1 { margin-bottom: 1rem; }

@media (max-width: 760px) {
  .detail { grid-template-columns: 1fr; }
  .gallery { position: static; }
}

/* ---------- Colour swatches ---------- */
.dot[data-colour="Washed Black"]  { background:#2b2b2e; }
.dot[data-colour="Vintage Black"] { background:#2b2b2e; }
.dot[data-colour="Black"]         { background:#161616; }
.dot[data-colour="Washed Grey"]   { background:#8d9095; }
.dot[data-colour="Oxford Navy"]   { background:#1f2a44; }
.dot[data-colour="Deep Navy"]     { background:#23314f; }
.dot[data-colour="Vintage White"] { background:#f3f0e9; }
.dot[data-colour="Washed Maroon"] { background:#7a3340; }
.dot[data-colour="Cement"]        { background:#b9b3a7; }
.dot[data-colour="Vintage Denim"] { background:#5d7390; }

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 2.5rem 1.5rem 3rem;
  color: var(--muted);
  font-size: .85rem;
  border-top: 1px solid var(--line);
  background: #fff;
}
.footer p { margin: 0; }

@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr; margin-top: -2rem; }
}
