/* 852.md: the studio's entrance, set like a gallery. Plain walls, large
   type and room to breathe; colour comes from the work, each piece shown in
   its own product's field. Editorial motion is smooth and eased; the pixel
   pieces (the seal, the cards) keep their stepped, whole-pixel motion as the
   studio's signature. Values come from /brand/tokens.css. */

:root {
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --rule: color-mix(in srgb, var(--text) 14%, transparent);
  /* Product fields: each exhibit keeps its own product's colours in both themes */
  --sake-field: #120f26;
  --sake-panel: #221c3d;
  --sake-accent: #ff7eb3;
  --events-field: #0d0b1f;
  --events-accent: #ffa04d;
  --field-text: #f6efe2;
  --field-text-2: #c4bada;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

/* One language at a time: every pair carries lang="zh-HK" and lang="en", and
   the other one hides. Without the script both show. */
html[data-lang="zh"] [lang="en"]:not([data-both]),
html[data-lang="en"] [lang="zh-HK"]:not([data-both]) { display: none !important; }
html[data-lang="en"] { --font-display: 'Plus Jakarta Sans', 'Noto Sans TC', sans-serif; }
html[data-lang="en"] h1, html[data-lang="en"] h2, html[data-lang="en"] h3 { font-weight: 800; letter-spacing: -0.02em; }

body {
  margin: 0;
  padding-inline: 16px;
  background-color: var(--page);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
}

.wrap { max-width: 74rem; margin-inline: auto; }
p { margin: 0; }
a { color: var(--accent); }
:focus-visible { outline: 3px dashed var(--accent); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 900; margin: 0; text-wrap: balance; }
.px { font-family: var(--font-pixel); font-weight: 400; -webkit-font-smoothing: none; }
.label { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-2); }
/* The brand name keeps its own case: 852 Made, never 852 MADE */
.label.name { text-transform: none; letter-spacing: 0.04em; }

/* ── Header ───────────────────────────────────────── */

.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 1.75rem; border-bottom: 1px solid var(--rule); }
/* The wordmark is the same in both languages: Plus Jakarta Sans 800, as in the footer */
.mark { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; font-size: 1.2rem; letter-spacing: -0.02em; }
.mark img { image-rendering: pixelated; }
.top nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.75rem; font-weight: 700; font-size: 0.95rem; }
.top nav a { color: var(--text); text-decoration: none; background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 2px no-repeat; transition: background-size 320ms var(--ease); padding-bottom: 2px; }
.top nav a:hover { background-size: 100% 2px; }
.lang-switch { display: inline-flex; border: 1.5px solid var(--text); border-radius: 999px; overflow: hidden; }
.lang-switch button { font: inherit; font-size: 0.85rem; font-weight: 800; min-width: 2.6rem; padding: 0.3rem 0.7rem; color: var(--text); background: transparent; border: 0; cursor: pointer; transition: background 200ms var(--ease), color 200ms var(--ease); }
.lang-switch button[aria-pressed="true"] { background: var(--text); color: var(--page); }

/* ── Hero ─────────────────────────────────────────── */

.hero { display: grid; grid-template-columns: 1fr auto; gap: 3rem; align-items: end; padding-block: clamp(4rem, 10vw, 8rem) clamp(3rem, 7vw, 5.5rem); }
.hero h1 { font-size: clamp(3rem, 9vw, 7.25rem); line-height: 1.02; letter-spacing: -0.01em; }
.hero h1 .line { display: block; overflow: hidden; padding-bottom: 0.06em; }
.hero h1 .inner { display: block; }
.hero .lead { margin-top: 2rem; max-width: 36em; font-size: 1.2rem; color: var(--text-2); }
.seal { width: 160px; height: 160px; shape-rendering: crispEdges; margin-bottom: 0.75rem; }
.seal .g { fill: var(--seal); }
.seal .c { fill: var(--seal-carve); }

.tags { list-style: none; margin: 2.25rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.75rem 1.75rem; }
.tags li { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 700; }
.tags img, .services img { display: block; image-rendering: pixelated; flex: none; }

/* ── Sections ─────────────────────────────────────── */

.section { display: grid; gap: 2.5rem; padding-block: clamp(4rem, 8vw, 6.5rem); border-top: 1px solid var(--rule); }
.section-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 1rem 3rem; align-items: end; }
.section-head h2 { font-size: clamp(2rem, 4.5vw, 3.25rem); line-height: 1.1; }
.section-head p { color: var(--text-2); max-width: 34em; }

/* ── Exhibits: each work in its own product's colours ── */

.exhibit { position: relative; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); border-radius: 10px; overflow: hidden; color: var(--field-text); }
.exhibit .field { position: absolute; inset: 0; z-index: 0; }
.exhibit > :not(.field) { position: relative; z-index: 1; }
.exhibit.sake .field { background: radial-gradient(120% 90% at 20% 30%, var(--sake-panel), var(--sake-field) 70%); }
.exhibit.events .field { background: var(--events-field); }
.exhibit .art { display: grid; place-items: center; min-height: 26rem; padding: 3rem 2rem; overflow: hidden; }
.exhibit .copy { display: grid; gap: 1rem; align-content: center; padding: clamp(2rem, 4vw, 3.5rem); }
.exhibit .label { color: var(--field-text-2); }
.exhibit h3 { font-size: clamp(1.75rem, 3.2vw, 2.5rem); line-height: 1.15; }
.exhibit .when { color: var(--field-text-2); font-size: 0.95rem; }
.exhibit.sake { --hi: var(--sake-accent); }
.exhibit.events { --hi: var(--events-accent); }
.story { display: grid; gap: 0.9rem; margin: 0.25rem 0 0; }
.story dt { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--hi); margin-bottom: 0.2rem; }
.story dd { margin: 0; color: var(--field-text); }
.features { list-style: none; margin: 0.5rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.features li { font-weight: 700; font-size: 0.92rem; padding: 0.35rem 0.85rem; border: 1.5px solid rgba(246, 239, 226, 0.35); border-radius: 999px; color: var(--field-text); }
.visit {
  justify-self: start; display: inline-flex; align-items: center; gap: 0.6rem; margin-top: 0.5rem;
  font-weight: 800; text-decoration: none; color: var(--events-field); background: var(--hi);
  border-radius: 999px; padding: 0.7rem 1.3rem;
  transition: transform 240ms var(--ease), box-shadow 240ms var(--ease);
}
.visit::after { content: '→'; transition: transform 240ms var(--ease); }
.visit:hover { transform: translateY(-2px); box-shadow: 0 8px 0 -3px rgba(0, 0, 0, 0.35); }
.visit:hover::after { transform: translateX(4px); }

/* SAKE EPIC cards: fanned at rest, dealt from a stack in pixel steps */
.fan { position: relative; width: 340px; max-width: 100%; height: 300px; }
.fan img {
  position: absolute; top: 0; width: 170px; height: auto; border-radius: 9px;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.7);
  transition: transform calc(var(--beat) * 3) steps(3, end);
}
.fan img:nth-child(1) { left: 0; transform: translateY(28px); --to-centre: 85px; }
.fan img:nth-child(2) { left: 85px; transform: translateY(14px); z-index: 1; --to-centre: 0px; }
.fan img:nth-child(3) { left: 170px; z-index: 2; --to-centre: -85px; }
.fan.stacked img { transform: translate(var(--to-centre), 14px); }
@media (hover: hover) {
  .exhibit.sake:hover .fan img:nth-child(1) { transform: translate(-14px, 28px); }
  .exhibit.sake:hover .fan img:nth-child(3) { transform: translate(14px, 0); }
}

/* 852.events: its harbour, at night */
.harbour { width: 100%; max-width: 40rem; height: auto; image-rendering: pixelated; border-radius: 6px; transition: transform 900ms var(--ease); }
.exhibit.events:hover .harbour { transform: scale(1.03); }

.works { display: grid; gap: 2rem; }

/* ── Services ─────────────────────────────────────── */

.services { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--rule); }
.services li { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1.25rem; padding: 2rem 2rem 2rem 0; border-bottom: 1px solid var(--rule); }
.services li:nth-child(odd) { border-right: 1px solid var(--rule); }
.services li:nth-child(even) { padding-left: 2rem; }
.services img { grid-row: span 2; }
.services h3 { font-size: 1.3rem; }
.services p { color: var(--text-2); }

/* ── Process ──────────────────────────────────────── */

.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2rem; counter-reset: step; }
.steps li { display: grid; gap: 0.5rem; align-content: start; padding-top: 1.25rem; border-top: 3px solid var(--text); }
.steps li::before { counter-increment: step; content: '0' counter(step); font-family: var(--font-pixel); font-size: 24px; -webkit-font-smoothing: none; color: var(--accent); }
.steps h3 { font-size: 1.25rem; }
.steps p { font-size: 0.95rem; color: var(--text-2); }

/* ── Contact: plain and direct; the footer seal is the page's sign-off ── */

.contact { grid-template-columns: minmax(0, 1fr); }
.contact-copy { display: grid; gap: 1.1rem; }
.contact h2 { font-size: clamp(2rem, 5vw, 3.6rem); line-height: 1.1; max-width: 16em; }
.contact-copy > p { color: var(--text-2); max-width: 34em; font-size: 1.1rem; }
.mail-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; margin-top: 0.75rem; }
.mail {
  font-family: var(--font-body); font-weight: 800; font-size: clamp(1.4rem, 3.6vw, 2.4rem); letter-spacing: -0.02em;
  color: var(--text); text-decoration: none;
  background: linear-gradient(var(--accent), var(--accent)) 0 100% / 100% 3px no-repeat;
  transition: background-size 320ms var(--ease), color 320ms var(--ease);
}
.mail:hover, .mail:focus-visible { color: var(--on-accent); background-size: 100% 100%; }
.copy-mail { font: inherit; font-weight: 800; font-size: 0.95rem; padding: 0.55rem 1.1rem; color: var(--text); background: transparent; border: 1.5px solid var(--text); border-radius: 999px; cursor: pointer; transition: background 200ms var(--ease), color 200ms var(--ease); }
.copy-mail:hover { background: var(--text); color: var(--page); }

/* ── Footer ───────────────────────────────────────── */

.foot { display: grid; gap: 2rem; padding-block: 4rem 2rem; border-top: 1px solid var(--rule); }
/* The sign-off: the name, the line, and the seal stamped beside them */
.wordmark { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; padding-bottom: 1.75rem; border-bottom: 1px solid var(--rule); }
.wordmark .name { display: block; font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; font-size: clamp(2.6rem, 7vw, 5rem); line-height: 0.95; letter-spacing: -0.04em; color: var(--text); }
.foot-line { margin-top: 0.75rem; color: var(--text-2); }
/* Whole multiples of the 32-pixel seal: 64 on phones, 96 elsewhere */
.wordmark img { width: 96px; height: 96px; image-rendering: pixelated; flex: none; }
@media (max-width: 40rem) { .wordmark img { width: 64px; height: 64px; } }
.foot-base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; font-size: 0.9rem; color: var(--text-2); }
.foot-links { display: inline-flex; gap: 1.5rem; }
.foot-links a { color: var(--text-2); text-decoration: none; font-weight: 700; }
.foot-links a:hover { color: var(--accent); }

/* ── Motion ───────────────────────────────────────── */

@media (prefers-reduced-motion: no-preference) {
  /* The headline rises line by line; the seal then prints and stamps */
  .js .hero h1 .inner { transform: translateY(105%); animation: rise 900ms var(--ease) forwards; animation-delay: var(--d, 0ms); }
  .js .hero .lead, .js .tags { opacity: 0; animation: fade 900ms var(--ease) 420ms forwards; }
  .seal g { animation: print calc(var(--beat) / 4) steps(1, end) calc(560ms + var(--beat) * var(--r) * 0.15625) backwards; }
  .seal { animation: stamp calc(var(--beat) * 3) steps(1, end) calc(560ms + var(--beat) * 5) backwards; }
  /* Sections and exhibits enter as they scroll into view */
  .js .reveal { opacity: 0; transform: translateY(28px); transition: opacity 800ms var(--ease), transform 800ms var(--ease); transition-delay: var(--d, 0ms); }
  .js .reveal.in { opacity: 1; transform: none; }
  .js .exhibit .field { clip-path: inset(0 100% 0 0 round 10px); transition: clip-path 1000ms var(--ease); }
  .js .exhibit.in .field { clip-path: inset(0 0 0 0 round 10px); }
  .js .exhibit .copy, .js .exhibit .art { opacity: 0; transform: translateY(18px); transition: opacity 700ms var(--ease) 380ms, transform 700ms var(--ease) 380ms; }
  .js .exhibit.in .copy, .js .exhibit.in .art { opacity: 1; transform: none; }
  .js .wordmark img { opacity: 0; }
  .js .wordmark.in img { opacity: 1; animation: stamp calc(var(--beat) * 3) steps(1, end) 500ms backwards; }
}
@keyframes rise { to { transform: none; } }
@keyframes fade { to { opacity: 1; } }
@keyframes print { from { opacity: 0; } to { opacity: 1; } }
@keyframes stamp {
  0% { transform: translate(-6px, -6px); filter: drop-shadow(6px 6px 0 var(--shadow)); }
  33% { transform: translate(-3px, -3px); filter: drop-shadow(3px 3px 0 var(--shadow)); }
  66% { transform: translate(1px, 1px); filter: none; }
  100% { transform: none; filter: none; }
}

/* ── Narrow screens ───────────────────────────────── */

@media (max-width: 56rem) {
  .hero { grid-template-columns: 1fr; gap: 1.5rem; }
  .hero .seal { order: -1; width: 112px; height: 112px; }
  .section-head { grid-template-columns: 1fr; }
  .exhibit { grid-template-columns: 1fr; }
  .exhibit .art { min-height: 0; padding: 2.5rem 1.5rem 0; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 40rem) {
  /* Phones: the mark and the language switch share the first row, the links the second */
  .top { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "mark switch" "nav nav"; row-gap: 0.9rem; }
  .mark { grid-area: mark; }
  .lang-switch { grid-area: switch; }
  .top nav { grid-area: nav; justify-content: flex-start; gap: 0.25rem 1.5rem; }
}
@media (max-width: 36rem) {
  .services { grid-template-columns: 1fr; }
  .services li, .services li:nth-child(even) { padding: 1.5rem 0; border-right: 0; }
  .steps { grid-template-columns: 1fr; }
  .fan { width: 280px; height: 250px; }
  .fan img { width: 140px; }
  .fan img:nth-child(1) { --to-centre: 70px; }
  .fan img:nth-child(2) { left: 70px; }
  .fan img:nth-child(3) { left: 140px; --to-centre: -70px; }
}
