/* Akua site — page layout on top of the design system (tokens.css + akua.css).
   Only what the design system does not already cover: the film layers, the workspace dialog,
   the phone menu position, the toast slot and a few language tweaks. */

html { background: var(--ground); color-scheme: dark; }
body { margin: 0; min-height: 100svh; background: var(--ground); }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.skip-link { position: fixed; left: 16px; top: -120px; z-index: 100; padding: 10px 14px; background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); font: 500 13px/20px var(--font-bar); letter-spacing: .16em; text-transform: uppercase; }
.skip-link:focus { top: 16px; }

/* ---------- the film: one poster + one video per scene, crossfaded ---------- */
.ak-scene { overflow: hidden; background: var(--ground); }
.film { position: absolute; inset: 0; opacity: 0; transition: opacity 800ms ease; }
.film.is-active,
html:not(.film-ready)[data-theme="night"] .film[data-scene="night"],
html:not(.film-ready)[data-theme="dusk"] .film[data-scene="dusk"],
html:not(.film-ready)[data-theme="day"] .film[data-scene="day"] { opacity: 1; }
.film__poster, .film__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; }
.film__video { opacity: 0; transition: opacity 300ms ease; }
.film.is-playing .film__video { opacity: 1; }
@media (max-width: 760px) {
  .film__poster, .film__video { object-position: 74% 50%; }
}

/* ---------- phone menu ---------- */
.menu-sheet { position: absolute; z-index: 20; top: 64px; left: var(--space-6); right: var(--space-6); }
@media (min-width: 761px) { .menu-sheet { display: none !important; } }

/* ---------- workspace dialog (About / Work / Blog) ----------
   Keep one viewport-constrained frame across pages and feed states; only the reading area scrolls. */
.workspace { position: fixed; inset: 0; z-index: 40; display: grid; grid-template-rows: minmax(0, 1fr); place-items: start center; padding: max(24px, env(safe-area-inset-top, 0px)) max(24px, 4vw) max(24px, env(safe-area-inset-bottom, 0px)); }
.workspace__veil { position: absolute; inset: 0; background: var(--scrim); }
.workspace .ak-workspace { position: relative; width: min(1120px, 100%); height: min(780px, 100%); min-height: 0; }
body.ws-open { overflow: hidden; }
.ak-title:focus { outline: none; }
.ws-intro { margin-bottom: var(--space-6); }
.ws-article > .ak-link { margin-top: var(--space-4); }
.draft-note { margin-top: var(--space-4); font: 400 12px/18px var(--font-mono); letter-spacing: .02em; color: var(--ink-faint); }

/* ---------- experience: compact split rows and native section links ---------- */
.experience { container-type: inline-size; --experience-section-gap: calc(var(--space-4) + var(--space-1)); }
.experience .ws-intro { margin-top: var(--space-2); margin-bottom: 0; }
.experience .draft-note { margin-top: var(--space-2); }
.experience-content { display: grid; grid-template-columns: minmax(0, 1fr) 144px; gap: calc(var(--space-6) + var(--space-1)); align-items: start; margin-top: var(--experience-section-gap); }
.experience-sections { grid-column: 1; grid-row: 1; min-width: 0; }
.experience-section + .experience-section { margin-top: var(--experience-section-gap); }
.experience-section__heading { display: flex; align-items: center; gap: var(--space-4); padding-bottom: var(--space-2); scroll-margin-top: var(--space-4); font: 500 16px/24px var(--font-sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink); }
.experience-section__heading::after { content: ''; flex: 1; min-width: var(--space-6); height: 1px; background: var(--line-strong); }
.experience-section__heading:lang(zh-Hant) { letter-spacing: .04em; text-transform: none; }
.experience-list { margin: 0; padding: 0; list-style: none; }
.experience-entry { display: grid; grid-template-columns: minmax(190px, .82fr) minmax(0, 1.45fr); column-gap: var(--space-6); align-items: start; padding: var(--space-4) 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.experience-entry:last-child { border-bottom: 0; }
.experience-entry__metadata { grid-column: 1; grid-row: 1 / span 2; min-width: 0; }
.experience-entry__details { grid-column: 2; min-width: 0; }
.experience-entry__period { margin-bottom: var(--space-1); font: 400 12px/18px var(--font-mono); letter-spacing: .02em; text-transform: uppercase; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.experience-entry__title { font: 500 21px/30px var(--font-sans); color: var(--ink); }
.experience-entry__organization { margin-top: 2px; font: 400 15px/24px var(--font-sans); color: var(--ink-muted); }
.experience-entry__description { margin-top: 0; }
.experience-entry__description > * { margin: 0; }
.experience-entry__description > * + * { margin-top: var(--space-2); }
.experience-entry__description ul, .experience-entry__description ol { margin-block: var(--space-2); padding-left: 1.4em; }
.experience-entry__description ul { list-style: disc; }
.experience-entry__description ol { list-style: decimal; }
.experience-entry__description li + li { margin-top: var(--space-1); }
.experience-entry__description a { color: var(--accent); text-decoration: underline; text-underline-offset: .2em; }
.experience-entry__description code { font-family: var(--font-mono); font-size: .9em; }
.experience-entry__description pre { max-width: 100%; overflow-x: auto; padding: var(--space-3); background: var(--ground); }
.experience-entry__description blockquote { padding-left: var(--space-3); border-left: 2px solid var(--line-strong); }
.experience-entry__description img { max-width: 100%; height: auto; }
.experience-entry__description table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.experience-entry__description th, .experience-entry__description td { padding: var(--space-2); border: 1px solid var(--line); }
.experience-entry__description :is(h1, h2, h3, h4, h5, h6) { font: 500 18px/26px var(--font-sans); }
.experience-entry__description > :first-child { margin-top: 0; }
.experience-entry__description > :last-child { margin-bottom: 0; }
.experience-entry__link { grid-column: 2; justify-self: start; margin-top: var(--space-2); }
.experience-entry--empty { display: block; }
.experience-entry--empty > p { margin: 0; color: var(--ink-muted); }
.experience-index { grid-column: 2; grid-row: 1; position: sticky; top: 0; }
.experience-index__heading { margin-bottom: var(--space-2); font: 400 12px/20px var(--font-sans); color: var(--ink-faint); }
.experience-index__links { margin: 0; padding: 0; list-style: none; }
.experience-index a { display: flex; align-items: center; gap: var(--space-2); min-height: var(--hit); font: 400 15px/24px var(--font-sans); color: var(--ink-muted); }
.experience-index a::before { content: ''; flex: 0 0 var(--space-1); height: var(--space-1); background: transparent; }
.experience-index a[aria-current="location"] { color: var(--accent); }
.experience-index a[aria-current="location"]::before { background: var(--accent); }
.experience-index a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: .2em; }
@container (max-width: 780px) {
  .experience-content { grid-template-columns: minmax(0, 1fr); gap: var(--space-6); }
  .experience-index { grid-column: 1; grid-row: 1; position: static; padding-bottom: var(--space-2); border-bottom: 1px solid var(--line); }
  .experience-index__heading { display: none; }
  .experience-index__links { display: flex; flex-wrap: wrap; column-gap: var(--space-4); }
  .experience-sections { grid-column: 1; grid-row: 2; }
}
@container (max-width: 560px) {
  .experience-entry { grid-template-columns: minmax(0, 1fr); row-gap: var(--space-3); }
  .experience-entry__metadata, .experience-entry__details, .experience-entry__link { grid-column: 1; grid-row: auto; }
  .experience-entry__link { margin-top: 0; }
}

.about { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: var(--space-12); align-items: start; }
.about .ak-spec { margin-top: var(--space-6); }
.about .ak-link { margin-top: var(--space-3); }
.portrait { margin: 4px 0 0; }
.portrait__frame { height: 300px; background: var(--ground) url("../assets/scenes/overlook-night.jpg") 75% 75% / 400% auto no-repeat; box-shadow: inset 0 0 0 1px var(--line-strong); }
[data-theme="dusk"] .portrait__frame { background-image: url("../assets/scenes/overlook-sunset.jpg"); }
[data-theme="day"] .portrait__frame { background-image: url("../assets/scenes/overlook-day.jpg"); }
.portrait figcaption { margin-top: var(--space-3); }

@media (max-width: 760px) {
  .workspace { padding: max(8px, env(safe-area-inset-top, 0px)) max(8px, env(safe-area-inset-right, 0px)) max(8px, env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
  .about { grid-template-columns: minmax(0, 1fr); gap: var(--space-8); }
  .portrait__frame { height: 220px; }
}

/* ---------- toast ---------- */
.toast-slot { position: fixed; left: 0; right: 0; bottom: max(24px, env(safe-area-inset-bottom, 0px)); z-index: 60; display: flex; justify-content: center; padding: 0 16px; pointer-events: none; }
.toast-slot .ak-toast { opacity: 0; transform: translateY(6px); transition: opacity 140ms ease, transform 140ms ease; }
.toast-slot .ak-toast.is-visible { opacity: 1; transform: none; }

.noscript { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 70; margin: 0; padding: 12px 16px; background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); font: 400 15px/24px var(--font-sans); }

/* ---------- Traditional Chinese ---------- */
html[lang="zh-Hant"] .ak-lead, html[lang="zh-Hant"] .ak-body { line-height: 1.85; }
html[lang="zh-Hant"] .ak-chip, html[lang="zh-Hant"] .ak-topbar__nav, html[lang="zh-Hant"] .ak-scene-btn, html[lang="zh-Hant"] .ak-tabs, html[lang="zh-Hant"] .ak-sheet__nav a { letter-spacing: .06em; }
html[lang="zh-Hant"] .ak-seg button, html[lang="zh-Hant"] .ak-entry__action, html[lang="zh-Hant"] .ak-link, html[lang="zh-Hant"] .ak-back { font-size: 13px; letter-spacing: .06em; }
/* The role chip grows with the screen, like the rest of the hero. */
html[lang="zh-Hant"] .ak-chip--solid { font-size: calc(13 * var(--hud-px)); letter-spacing: .06em; }

@media (prefers-reduced-motion: reduce) {
  .film, .film__video, .toast-slot .ak-toast { transition: none; }
}
