/* ==========================================================================
   Elmii — base: tokens, header, print vocabulary, footer, review console
   Confirmed: #cc38b0 / #ffa8ef / #ffcbf7, Arapey. Everything else = PROPOSAL.
   ========================================================================== */
:root {
  --magenta: #cc38b0;
  --pink: #ffa8ef;
  --blush: #ffcbf7;
  --magenta-ink: #bb30a0;   /* deeper brand magenta for small text / small text on it: 4.8:1 on paper, 5.2:1 with white */
  /* PROPOSAL neutrals */
  --paper: #fbf6f3;
  --paper-2: #f4ece8;
  --ink: #24121f;
  --plum: #2c1527;
  --ink-soft: rgba(36, 18, 31, .64);
  --rule: rgba(36, 18, 31, .8);
  --rule-faint: rgba(36, 18, 31, .12);

  /* Four faces in all — English: Arapey (brand) + Antonio; Chinese: Noto Serif TC + Noto Sans TC.
     Antonio is the TEMPORARY stand-in for both condensed brand faces (Aneto Skyline Compressed for titles,
     Cloud Condensed for information); they are listed first so they take over once their files are added.
     Brand fonts carry no CJK glyphs, so Chinese falls through to Noto TC (never the Light weight). */
  --f-display: "Aneto Skyline Compressed", "Aneto Skyline", "Antonio", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --f-info: "Cloud Condensed", "Antonio", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --f-edit: "Arapey", "Noto Serif TC", "PMingLiU", Georgia, serif;
  --f-head: "Arapey", "Noto Serif TC", "PMingLiU", Georgia, serif;
  --f-body: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;

  --ease-cut: cubic-bezier(.77, 0, .18, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --t-quick: 220ms; --t-mid: 520ms; --t-slow: 980ms;

  --gutter: 6.5vw;
  --nav-h: 56px;
    /* header floats over the page; nothing reserves room for it */
}

/* English pages: body copy is set in Arapey (Noto Sans TC would set ’ and “ full-width) */
html:lang(en) { --f-body: "Arapey", "Noto Sans TC", Georgia, serif; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* no fake italics: Chinese inside <em> stays upright (Arapey's real italic still applies to Latin) */
html { font-synthesis-style: none; font-synthesis-weight: none; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--f-edit); font-size: 17px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; overflow-x: clip;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
img, video { display: block; max-width: 100%; }
em { font-style: italic; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 200; background: var(--ink); color: var(--paper); padding: 8px 12px; font-family: var(--f-info); text-transform: uppercase; letter-spacing: .08em; }
.skip:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--magenta); outline-offset: 3px; }

/* ---------- print vocabulary ---------- */
/* catalogue label: Fig. numbers, colour codes, section eyebrows */
.cat { font-family: var(--f-info); font-size: 12px; font-weight: 400; letter-spacing: .1em; text-transform: uppercase; }

/* a film over its own poster frame: the still shows until the video plays (or when motion is reduced) */
.film { position: relative; overflow: hidden; background: #e9e1de; }
.film img, .film video { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; }
.film video { opacity: 0; transition: opacity 500ms linear; }
.film video.is-playing { opacity: 1; }

.kicker {
  margin: 0 0 14px; display: flex; align-items: center; gap: 12px;
  font-family: var(--f-info); font-size: 12px; font-weight: 500; letter-spacing: .18em; text-transform: uppercase;
}
.no-box {          /* catalogue number in a double-ruled box */
  display: inline-grid; place-items: center; min-width: 30px; height: 22px; padding: 0 6px;
  border: 1px solid currentColor; outline: 1px solid currentColor; outline-offset: 2px;
  color: var(--magenta-ink); font-weight: 600; letter-spacing: .08em;
}
.kicker-line { width: 44px; height: 1px; background: currentColor; transform-origin: left; }
.mask { display: inline-block; vertical-align: top; padding: 0 .14em .1em .06em; margin: 0 -.14em -.1em -.06em; }
/* masks only clip while something is rising through them; at rest the text is never cropped */
.is-intro .mask, .mask.is-masking { overflow: hidden; }
.rise { display: inline-block; }

.dbl {             /* double rule */
  border: 1px solid var(--ink); outline: 1px solid var(--ink); outline-offset: 4px;
}

/* ---------- announcement bar (scrolls away with the page; the visitor can close it) ---------- */
.marquee {
  position: relative; height: 30px; overflow: hidden; background: var(--magenta-ink); color: #fff;
  font-family: var(--f-info); font-size: 13px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase;
  display: flex; align-items: center;
}
.marquee-track { display: flex; white-space: nowrap; animation: marquee 38s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-run { display: flex; align-items: center; }
.marquee-run > span { padding: 0 22px; }
.spark { width: 9px; height: 9px; background: currentColor; display: inline-block; clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%); }
@keyframes marquee { to { transform: translateX(-50%); } }
.marquee-close { position: absolute; right: 0; top: 0; bottom: 0; width: 40px; appearance: none; border: 0; background: var(--magenta-ink); color: #fff; cursor: pointer; font-size: 18px; line-height: 1; }
.marquee-close:hover { color: var(--blush); }
.bar-closed { --bar-h: 0px; }
.bar-closed .marquee { display: none; }
.rm .marquee-track { animation: none; }

/* ---------- header ----------
   Hidden by default. On a mouse, hovering the top edge (or tabbing into it) slides it down;
   on touch it shows at the top of the page and when scrolling back up (main.js sets .is-shown). */
.site-head { --bar-off: 0px; position: fixed; top: var(--bar-off); left: 0; right: 0; z-index: 60; height: 14px; }
.site-head .nav { position: absolute; top: 0; left: 0; right: 0; transform: translateY(calc(-101% - var(--bar-off))); transition: transform 380ms var(--ease-out); }
.site-head:hover .nav, .site-head:focus-within .nav, .site-head.is-shown .nav { transform: none; }

.nav {
  height: var(--nav-h); display: grid; grid-template-columns: auto 1fr auto;
  border-bottom: 1px solid var(--ink); background: var(--paper);
  font-family: var(--f-info); font-size: 14px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase;
}
.nav a { text-decoration: none; }
.nav-logo { display: flex; align-items: center; gap: 10px; padding: 0 28px 0 var(--gutter); border-right: 1px solid var(--ink); }
/* the brand logo (media/logo, built by tools/make-logo.py) is a black-on-transparent shape used as a mask,
   so CSS sets its colour */
.logo-shape { display: block; background: var(--magenta); -webkit-mask: var(--logo) center / contain no-repeat; mask: var(--logo) center / contain no-repeat; }
.nav-wordmark { --logo: url("../media/logo/elmii-wordmark.png"); height: 26px; aspect-ratio: 1200 / 446; transition: background-color var(--t-quick) linear; }
.nav-logo:hover .nav-wordmark { background: var(--ink); }
.nav-links { list-style: none; margin: 0; padding: 0; display: flex; }
.nav-links li { border-right: 1px solid var(--ink); display: flex; }
.nav-links a, .nav-tools a, .nav-motion { display: flex; align-items: center; gap: 6px; padding: 0 22px; position: relative; }
.nav-links a::after, .nav-tools a::after {
  content: ""; position: absolute; left: 22px; right: 22px; bottom: 15px; height: 1px; background: var(--magenta);
  transform: scaleX(0); transform-origin: right; transition: transform var(--t-mid) var(--ease-cut);
}
.nav-links a:hover::after, .nav-tools a:hover::after { transform: scaleX(1); transform-origin: left; }
.nav-tools { display: flex; }
.nav-tools > * { border-left: 1px solid var(--ink); }
.nav-tools > :last-child { padding-right: var(--gutter); }
.nav-motion { appearance: none; background: none; border-top: 0; border-right: 0; border-bottom: 0; cursor: pointer; text-transform: uppercase; letter-spacing: .12em; font-weight: 500; }
.nav-motion-dot { width: 18px; height: 10px; border: 1px solid var(--ink); border-radius: 6px; position: relative; }
.nav-motion-dot::after { content: ""; position: absolute; top: 1px; left: 1px; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); transition: transform var(--t-mid) var(--ease-out), background-color var(--t-quick) linear; }
.nav-motion[aria-pressed="true"] .nav-motion-dot::after { transform: translateX(8px); background: var(--magenta); }
.nav-dm { color: var(--magenta-ink); font-weight: 600; }
.nav-lang { font-weight: 600; letter-spacing: .1em; }   /* 中文 / EN switch */

/* ---------- scenes (shared) ---------- */
.scene { position: relative; }
.scene.is-pinned { height: var(--scene-h, 260vh); }
.scene.is-pinned > .pin {
  position: sticky; top: 0; height: 100vh; height: 100svh; overflow: clip;
}
.scene + .scene { border-top: 1px solid var(--ink); }

/* ---------- footer: a one-line motto, the brand logo, social links ---------- */
.site-foot { border-top: 1px solid var(--rule-faint); background: var(--paper); padding: clamp(48px, 7vw, 96px) var(--gutter) 28px; text-align: center; }
.foot-say { margin: 0 0 clamp(18px, 2.4vw, 28px); font-family: var(--f-head); font-weight: 600; font-size: clamp(17px, 1.6vw, 22px); }
.foot-say em { font-family: var(--f-edit); font-weight: 400; color: var(--magenta-ink); }
.foot-logo { --logo: url("../media/logo/elmii-lockup.png"); width: clamp(200px, 30vw, 420px); aspect-ratio: 1600 / 735; margin: 0 auto; }
.foot-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px 24px; margin-top: clamp(36px, 5vw, 64px); text-align: left; padding-top: 16px; border-top: 1px solid var(--rule-faint);
  font-family: var(--f-info); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; }
.foot-social { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.foot-social a { text-decoration: none; }
.foot-social a:hover { color: var(--magenta-ink); }
.foot-legal { margin: 0; color: var(--ink-soft); }

/* ---------- review console (?review=1) ---------- */
.review {
  position: fixed; right: 14px; bottom: 14px; z-index: 70; width: 250px; padding: 12px;
  background: var(--paper); border: 1px solid var(--ink); outline: 1px solid var(--ink); outline-offset: 3px;
  font-family: var(--f-info); font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
}
.review-title { margin: 0 0 8px; color: var(--magenta-ink); }
.review-row { display: flex; margin-bottom: 8px; border: 1px solid var(--ink); }
.review-row button { flex: 1; appearance: none; background: none; border: 0; padding: 8px 6px; cursor: pointer; text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }
.review-row button + button { border-left: 1px solid var(--ink); }
.review-row button[aria-checked="true"], .review-row button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.review-row button:disabled { color: rgba(36, 18, 31, .35); cursor: default; }
.review-note { margin: 0; font-weight: 500; font-size: 11px; color: var(--ink-soft); line-height: 1.35; }
.audit-outline h1, .audit-outline h2, .audit-outline p, .audit-outline figcaption, .audit-outline li, .audit-outline a { outline: 1px dashed rgba(204, 56, 176, .7); }

/* cursor tag */
.cursor-tag { position: fixed; left: 0; top: 0; z-index: 90; pointer-events: none; font-family: var(--f-info); font-size: 11px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; opacity: 0; transition: opacity var(--t-quick) linear; }
.cursor-tag span { display: block; padding: 5px 9px 4px; background: var(--paper); border: 1px solid var(--ink); white-space: nowrap; }
.cursor-tag.is-on { opacity: 1; }
.cursor-tag.is-hot span { background: var(--magenta); color: #fff; border-color: var(--magenta-ink); }

/* ---------- responsive ---------- */
@media (max-width: 1099px) {
  :root { --gutter: 36px; }
  .nav-hide-md { display: none !important; }
}
@media (max-width: 760px) and (min-height: 501px), (max-width: 760px) and (orientation: portrait) {
  :root { --gutter: 16px; --nav-h: 50px; }
  body { font-size: 16px; }
  .nav { font-size: 12px; }
  .nav-wordmark { height: 22px; }
  .nav-logo { padding: 0 14px 0 16px; }
  .nav-links a, .nav-tools a, .nav-motion { padding: 0 10px; }
  .nav-links a::after, .nav-tools a::after { left: 10px; right: 10px; bottom: 13px; }
  .nav-tools > :last-child { padding-right: 16px; }
  .nav-hide-sm { display: none !important; }
  .nav-motion-label { display: none; }
  .review { left: 8px; right: 8px; width: auto; bottom: 8px; }
}

/* ---------- reduced motion ---------- */
.rm *, .rm *::before, .rm *::after { transition-duration: 1ms !important; transition-delay: 0ms !important; animation-duration: 1ms !important; }
.rm .scene.is-pinned { height: auto; }
.rm .scene.is-pinned > .pin { position: relative; height: auto; min-height: 100svh; overflow: visible; }

/* ---------- short landscape (phone held sideways) ---------- */
@media (orientation: landscape) and (max-height: 500px) {
  :root { --gutter: max(28px, 5vw); --nav-h: 44px; }
  .nav { font-size: 12px; }
  .nav-wordmark { height: 20px; }
  .nav-logo { padding: 0 16px 0 var(--gutter); }
  .nav-links a, .nav-tools a, .nav-motion { padding: 0 12px; }
  .nav-links a::after, .nav-tools a::after { left: 12px; right: 12px; bottom: 11px; }
  .nav-hide-md { display: none !important; }
}
@media (orientation: landscape) and (max-height: 500px) and (max-width: 760px) {
  body { font-size: 16px; }
  .nav-hide-sm { display: none !important; }
  .nav-motion-label { display: none; }
  .nav-links a, .nav-tools a, .nav-motion { padding: 0 10px; }
}

/* ---------- DM hint: shown after a "DM" button copies the enquiry (js/core/chrome.js) ---------- */
.dm-toast { position: fixed; left: 50%; bottom: 24px; z-index: 95; width: max-content; max-width: min(92vw, 520px); margin: 0; padding: 12px 18px;
  background: var(--ink); color: #fff; font-family: var(--f-body); font-size: 14px; line-height: 1.6;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none; transition: opacity var(--t-mid) linear, transform var(--t-mid) var(--ease-out); }
.dm-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
