/* Cocoon Rugs · Direction A "Earth" · built from REDESIGN_SPEC.v3 (§1 A tokens, §3 motion, §4 components) */
:root {
  --color-surface: #faf6f0;
  --color-surface-2: #f1e9de;
  --color-ink: #2a2118;
  --color-muted: #5e544a;
  --color-brand: #7a5123;
  --color-link: #7a5123;
  --color-accent: #2f5f8a;
  --color-on-brand: #ffffff;
  --scrim: rgba(0, 0, 0, 0.4);
  --color-error: #b3261e;
  --font-display: "Fraunces", Georgia, serif;
  --font-text: "Work Sans", system-ui, sans-serif;
  --text-body: 1.125rem;
  --measure: 65ch;
  --space-unit: 8px;
  --radius: 2px;
  --bar-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-surface: #1a1612; --color-surface-2: #241e18; --color-ink: #f2ece4; --color-muted: #b9ada0;
    --color-brand: #d9a86a; --color-link: #d9a86a; --color-accent: #8fb6dd; --color-on-brand: #1a1612;
    --scrim: rgba(0, 0, 0, 0.6); --color-error: #ffb4ab; color-scheme: dark;
  }
}
[data-theme="dark"] {
  --color-surface: #1a1612; --color-surface-2: #241e18; --color-ink: #f2ece4; --color-muted: #b9ada0;
  --color-brand: #d9a86a; --color-link: #d9a86a; --color-accent: #8fb6dd; --color-on-brand: #1a1612;
  --scrim: rgba(0, 0, 0, 0.6); --color-error: #ffb4ab; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
/* [hidden] must win over component display rules (menu panel, backdrop, contact bar, arrows) — QA round 1 */
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--color-surface); color: var(--color-ink); font: 400 var(--text-body)/1.6 var(--font-text); -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--color-link); }
p { max-width: var(--measure); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; font-optical-sizing: auto; margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: clamp(2.5rem, 5.6vw, 4.75rem); line-height: 1.02; }
h2 { font-size: clamp(2rem, 4vw, 3.25rem); line-height: 1.06; }
h3 { font-size: 1.5rem; line-height: 1.2; }
:where(ul[role="list"], ol[role="list"]) { list-style: none; margin: 0; padding: 0; } /* :where keeps this reset below component margins */
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 max(32px, env(safe-area-inset-left)) 0 max(32px, env(safe-area-inset-right)); }
section { padding: 96px 0; }
.alt { background: var(--color-surface-2); }
.eyebrow { font-size: 0.8125rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-muted); margin: 0 0 14px; }
.lead { color: var(--color-muted); max-width: 52ch; margin: 18px 0 0; }

/* Focus ring (§4): 2 px accent, 2 px offset */
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.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: 16px; top: -60px; z-index: 50; background: var(--color-brand); color: var(--color-on-brand); padding: 12px 16px; }
.skip:focus { top: 12px; }

/* Buttons (§4): 48 px tall, press scale 0.98 / 120 ms */
.btns { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; min-width: 44px; padding: 0 24px;
  border-radius: var(--radius); font: 600 1rem/1 var(--font-text); text-decoration: none; cursor: pointer;
  transition: transform 120ms ease-out, background-color 120ms ease-out, color 120ms ease-out; }
.btn.primary { background: var(--color-brand); color: var(--color-on-brand); border: 1.5px solid var(--color-brand); }
.btn.primary:hover { background: color-mix(in srgb, var(--color-brand) 88%, var(--color-ink)); }
.btn.secondary { background: transparent; color: var(--color-ink); border: 1.5px solid var(--color-ink); }
.btn.secondary:hover { background: color-mix(in srgb, var(--color-ink) 8%, transparent); }
.btn:active { transform: scale(0.98); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 1; background: var(--color-surface-2); color: var(--color-muted); border-color: var(--color-muted); cursor: not-allowed; }
@media (prefers-reduced-motion: reduce) { .btn:active { transform: none; background-color: color-mix(in srgb, var(--color-ink) 14%, transparent); } }
.text-link { display: inline-flex; align-items: center; min-height: 44px; margin-top: 20px; font-weight: 600; text-underline-offset: 4px; }
.text-link:hover { text-decoration-thickness: 2px; }

/* Header (§4): sticky, safe areas, 5 nav items, collapses below 768 px */
.site-header { position: sticky; top: 0; z-index: 30; background: var(--color-surface); padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid color-mix(in srgb, var(--color-muted) 28%, transparent); }
.header-row { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.logo-link { display: inline-flex; align-items: center; min-height: 44px; }
.logo { height: 38px; width: auto; }
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-light { display: none; } :root:not([data-theme="light"]) .logo-dark { display: block; } }
[data-theme="dark"] .logo-light { display: none; } [data-theme="dark"] .logo-dark { display: block; }
.nav { display: flex; gap: 8px; }
.nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; color: var(--color-ink); text-decoration: none; font-size: 1rem; border-radius: var(--radius); }
.nav a:hover { color: var(--color-link); }
.nav a:active { background: color-mix(in srgb, var(--color-ink) 10%, transparent); }
.nav a[aria-current="true"] { color: var(--color-link); box-shadow: inset 0 -2px 0 var(--color-brand); }
.menu-btn { display: none; min-width: 48px; min-height: 48px; padding: 0 16px; font: 600 1rem/1 var(--font-text); color: var(--color-ink);
  background: transparent; border: 1.5px solid var(--color-ink); border-radius: var(--radius); cursor: pointer; }
.menu-btn:hover { background: color-mix(in srgb, var(--color-ink) 8%, transparent); }
.menu-btn:active { transform: scale(0.98); }

/* Mobile menu panel + backdrop (§4 v3) */
.menu-backdrop { position: fixed; inset: 0; z-index: 20; background: var(--scrim); }
.menu-panel { position: fixed; z-index: 25; top: 0; right: 0; bottom: 0; width: min(86vw, 360px); background: var(--color-surface);
  padding: calc(88px + env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) 24px;
  display: flex; flex-direction: column; gap: 4px; box-shadow: -8px 0 32px rgba(0,0,0,.18); }
.menu-panel a:not(.btn) { display: flex; align-items: center; min-height: 48px; color: var(--color-ink); text-decoration: none; font-size: 1.25rem;
  border-bottom: 1px solid color-mix(in srgb, var(--color-muted) 25%, transparent); }
.menu-panel a:not(.btn):hover { color: var(--color-link); }
.menu-panel a:not(.btn):active { background: color-mix(in srgb, var(--color-ink) 8%, transparent); }
.menu-panel a[aria-current="true"] { color: var(--color-brand); font-weight: 600; }
.menu-panel .btn { margin-top: 20px; }

/* 1 · Hero: rooms first (route B) — copy left on the surface, a room photo right */
.hero { padding: 0; }
.hero-rooms { display: grid; grid-template-columns: 45% 55%; min-height: min(78vh, 760px); }
.hero-rooms .hero-copy { display: flex; flex-direction: column; justify-content: center;
  padding: 64px 48px 64px max(32px, calc((100vw - 1200px) / 2 + 32px)); }
.hero-room { width: 100%; height: 100%; object-fit: cover; object-position: center 60%; }

/* 2 · Rug cards (§4): one stretched link per card */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 40px; }
.card { position: relative; background: var(--color-surface); border: 1px solid color-mix(in srgb, var(--color-muted) 25%, transparent); border-radius: var(--radius); overflow: hidden;
  transition: transform 120ms ease-out, box-shadow 120ms ease-out; }
.card img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.card-body { padding: 18px 20px 20px; }
.card-body p { margin: 6px 0 4px; color: var(--color-muted); font-size: 1rem; }
.card-link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; font-size: 1rem; text-decoration: none; }
.card-link::after { content: ""; position: absolute; inset: 0; }
.card:hover { box-shadow: 0 6px 24px rgba(0,0,0,.08); }
.card:hover .card-link { text-decoration: underline; text-underline-offset: 4px; }
.card:has(.card-link:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.card-link:focus-visible { outline: none; }
.card:active { transform: scale(0.98); }
@media (prefers-reduced-motion: reduce) { .card:active { transform: none; background: var(--color-surface-2); } }

/* Two-column sections */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; }

/* 4 · Rooms carousel (§3, §4): grid without JS or with reduced motion */
.rooms-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.carousel { margin-top: 40px; }
.track { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.slide img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); }
.slide p { margin: 8px 0 0; font-size: 0.9375rem; color: var(--color-muted); }
.carousel.is-live { overflow: hidden; touch-action: pan-y; cursor: grab; }
.carousel.is-live.dragging { cursor: grabbing; user-select: none; }
.carousel.is-live .track { display: flex; gap: 16px; will-change: transform; }
.carousel.is-live .slide { flex: 0 0 min(42%, 520px); }
.carousel.is-live img { pointer-events: none; }
.arrows { display: flex; gap: 8px; }
.arrow { width: 44px; height: 44px; border-radius: 50%; font-size: 1.125rem; cursor: pointer; background: var(--color-surface);
  color: var(--color-ink); border: 1px solid var(--color-muted); transition: transform 120ms ease-out, background-color 120ms ease-out; }
.arrow:hover { background: color-mix(in srgb, var(--color-ink) 8%, var(--color-surface)); }
.arrow:active { transform: scale(0.98); }
.arrow[aria-disabled="true"] { color: var(--color-muted); border-color: var(--color-muted); background: transparent; cursor: default; }

/* 5 · Instagram banner (replaces "Made to order", 2026-11-21) */
.insta .lead { margin-bottom: 28px; }
.insta-btn { gap: 10px; }
.insta-btn svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.insta-img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); }

/* 6 · Guide */
.guide-img { width: 100%; max-width: 420px; justify-self: center; border-radius: var(--radius); }
/* the placement graphic is a light raster: tone it down so it isn't a bright panel in dark mode (QA round 3) */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .guide-img { filter: brightness(0.82); } }
[data-theme="dark"] .guide-img { filter: brightness(0.82); }
.tips { display: grid; gap: 18px; margin-top: 28px; }
.tips h3 { font-size: 1.25rem; }
.tips p { margin: 4px 0 0; color: var(--color-muted); }

/* 7 · Visit + form (§4) */
address { font-style: normal; margin-top: 24px; }
address p { margin: 0 0 14px; color: var(--color-muted); }
address strong { color: var(--color-ink); }
.enquiry { background: var(--color-surface-2); padding: 32px; border-radius: var(--radius); }
.enquiry h3 { margin-bottom: 8px; }
.form-note { margin: 0 0 18px; color: var(--color-muted); font-size: 1rem; }
.visit .enquiry { align-self: start; }
.alt .enquiry { background: var(--color-surface); }
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: 1rem; margin-bottom: 6px; }
.field .opt { font-weight: 400; color: var(--color-muted); }
.field input, .field select, .field textarea { width: 100%; min-height: 48px; padding: 10px 14px; font: 400 var(--text-body)/1.4 var(--font-text);
  color: var(--color-ink); background: var(--color-surface); border: 1.5px solid var(--color-muted); border-radius: var(--radius); }
.field textarea { resize: vertical; }
.field input[aria-invalid="true"] { border-color: var(--color-error); }
.err { color: var(--color-error); font-size: 1rem; margin: 6px 0 0; }
.enquiry.sending input, .enquiry.sending select, .enquiry.sending textarea { border-color: color-mix(in srgb, var(--color-muted) 50%, transparent); color: var(--color-muted); }
.form-status { margin: 14px 0 0; font-size: 1rem; }

/* Footer (§4) */
.site-footer { background: var(--color-brand); color: var(--color-on-brand); padding: 48px 0 calc(48px + env(safe-area-inset-bottom)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .site-footer { background: var(--color-surface-2); color: var(--color-ink); } }
[data-theme="dark"] .site-footer { background: var(--color-surface-2); color: var(--color-ink); }
.footer-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; }
.footer-logo { height: 34px; width: auto; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 0 8px; }
.site-footer a { color: inherit; }
.footer-nav a, .footer-phone { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; text-decoration: none; font-size: 1rem; }
.footer-nav a:hover, .footer-phone:hover { text-decoration: underline; }
.footer-nav a:active, .footer-phone:active { opacity: .8; }
.social { display: flex; gap: 8px; }
.social a { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid currentColor; }
.social svg { width: 20px; height: 20px; fill: currentColor; }
.copy { margin: 0; font-size: 0.9375rem; }
.site-footer :focus-visible { outline-color: currentColor; }
.bar-spacer { display: none; }

/* Bottom contact bar (§4 v3): phones only, sections 5 and 7 */
.contact-bar { position: fixed; z-index: 15; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; align-items: center;
  min-height: calc(var(--bar-h) + env(safe-area-inset-bottom)); padding: 8px max(12px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: var(--color-surface); border-top: 1px solid var(--color-muted); }
.contact-bar .btn { min-height: 48px; padding: 0 14px; flex: 1 1 auto; font-size: 0.9375rem; }
.contact-bar .bar-order { flex: 2 1 auto; }
.contact-bar[data-mode="insta"] .bar-email { display: none; }
.contact-bar[data-mode="visit"] .bar-order { display: none; }
@media (min-width: 768px) { .contact-bar { display: none !important; } }

/* Reveal start states: only after JS adds html.js, and only with motion allowed (SC-09, A11Y-03) */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal-hero, .js .reveal-card { opacity: 0; transform: translateY(16px); }
}

/* Phones and small tablets */
@media (max-width: 767px) {
  .wrap { padding: 0 max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left)); }
  section { padding: 64px 0; }
  .nav { display: none; }
  .menu-btn { display: inline-flex; align-items: center; }
  /* phones: copy and buttons first, then a room band (spec §9 for B: band ≤ 40 % of the viewport) */
  .hero-rooms { grid-template-columns: 1fr; min-height: 0; }
  .hero-rooms .hero-copy { padding: 32px 20px 32px; }
  .hero-room { height: 40vh; }
  .cards, .split { grid-template-columns: 1fr; }
  .track { grid-template-columns: 1fr 1fr; }
  .carousel.is-live .slide { flex-basis: 78%; }
  .enquiry { padding: 24px 20px; }
  .bar-spacer { display: block; height: calc(var(--bar-h) + env(safe-area-inset-bottom)); }
  html { scroll-padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom)); }
  .footer-row { flex-direction: column; align-items: flex-start; }
}
