/* The portfolio lives in HTML; the garden remains a separate, playable scene. */
.specimen-card {
  background: none;
  backdrop-filter: none;
  text-shadow: 0 1px 2px #09070de6, 0 0 6px #09070da8;
}
.specimen-meta, .specimen-footer { color: #e0d4e4; }
.specimen-card.playing .signal i { transform: scaleY(var(--signal-strength, 1)); transition: height .1s, transform .08s; }
/* The footer belongs to the garden: seasons on the left, controls on the right.
   The other pages have nothing to put in it, so it is not shown there. */
body[data-page="garden"] .garden-footer { display: grid; grid-template-columns: 1fr auto; }
body:not([data-page="garden"]) .garden-footer { display: none; }
/* Without WebGL only the fallback message is left of the garden. Navigation
   toggles the hidden attribute on these, so the state has to win here. */
body[data-garden-state="unavailable"] :is(.intro, .specimen-card, .garden-footer) { display: none; }
body[data-page="garden"] .controls { grid-area: 1 / 2; justify-self: end; }
.season-preview { grid-area: 1 / 1; display: flex; align-items: center; transition: opacity .8s; }
.study-label, .study-caption {
  position: absolute; width: 1px; height: 1px; margin: 0; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.study-switch { display: flex; align-items: center; gap: clamp(12px, 1.4vw, 20px); }
.study-switch button {
  position: relative; min-height: 32px; padding: 6px 0 8px; border: 0;
  background: transparent; color: #b9adc3; font-size: 12px; white-space: nowrap;
}
.study-switch button[aria-pressed="true"] { color: var(--acid); }
.study-switch button:not([aria-pressed="true"]):hover { color: var(--paper); }
.study-switch button:focus-visible { outline-offset: 2px; }
.keyboard-hint, .touch-hint {
  background: none;
  text-shadow: 0 1px 2px #09070de6, 0 0 6px #09070da8;
}
/* The instructions have done their job once a flower has been clicked or tapped. */
body[data-flower-picked] .hint-line { opacity: 0; }
body[data-page="garden"] .vignette {
  --specimen-corner: radial-gradient(ellipse clamp(475px, 49vw, 930px) clamp(310px, 49vh, 560px) at right top, #09070dc4, #09070d70 56%, transparent);
  --instruction-shade: radial-gradient(ellipse 65% clamp(175px, 24vh, 280px) at center bottom, #09070d85, #09070d59 57%, transparent);
}
body[data-season="winter"] .vignette { --winter-haze: linear-gradient(#09070d94, transparent 155px); }
body:is([data-page="garden"], [data-season="winter"]) .vignette::after {
  content: '';
  position: absolute; inset: 0;
  background: var(--specimen-corner, none), var(--instruction-shade, none), var(--winter-haze, none);
}
.skip-link {
  position: fixed; left: 24px; top: -80px; z-index: 100;
  padding: 12px 18px; background: var(--acid); color: #09070d; font-size: 12px;
}
.skip-link:focus { top: 16px; }
.identity { min-width: 0; max-width: 34vw; }
.name-part { white-space: nowrap; }
/* The name, the navigation and the language links share one centre line. */
.site-header { align-items: center; }
.header-right { flex-shrink: 0; padding-top: 0; }
.page-nav {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 28px; pointer-events: auto;
}
.page-nav a { position: relative; padding: 6px 0; font-size: 12px; color: #bcb1c7; transition: color .2s; }
.page-nav a:hover, .page-nav a[aria-current="page"] { color: var(--acid); }
/* Underlines hug the word, however large the tap target is. */
.page-nav a[aria-current="page"], .language-switch a[aria-current="true"], .study-switch button[aria-pressed="true"] {
  text-decoration-line: underline; text-decoration-thickness: 1px;
  text-decoration-color: var(--acid); text-underline-offset: 9px;
}
/* On touch screens the small text links get a 44px-tall touch area that does
   not move anything. */
@media (pointer: coarse) {
  :is(.page-nav a, .language-switch a, .project-links a, .contact-links a)::before { content: ""; position: absolute; inset: -8px -6px; }
  .project-links a::before, .contact-links a::before { inset-block: -12px; }
}
.sound-toggle:hover { border-color: #d2fb8366; color: var(--acid); }
.language-switch { display: flex; align-items: center; gap: 18px; font-size: 12px; line-height: 1; }
.language-switch[hidden] { display: none; }
.language-switch a { position: relative; display: grid; place-items: center; min-height: 32px; color: #bcb1c7; white-space: nowrap; transition: color .2s; }
.language-switch a:hover, .language-switch a[aria-current="true"] { color: var(--acid); }
:is(.language-switch, .name) [lang="zh-Hans"] { font-family: "Noto Sans CJK SC", "Microsoft YaHei", "PingFang SC", sans-serif; }
:is(.language-switch, .name) [lang="ja"] { font-family: "Noto Sans CJK JP", "Yu Gothic", "Hiragino Sans", sans-serif; }
html:lang(zh-Hans) {
  --local-sans: "Noto Sans CJK SC", "Microsoft YaHei", "PingFang SC", sans-serif;
  --local-serif: "Noto Serif CJK SC", "Songti SC", SimSun, serif;
}
html:lang(ja) {
  --local-sans: "Noto Sans CJK JP", "Yu Gothic", "Hiragino Sans", sans-serif;
  --local-serif: "Noto Serif CJK JP", "Yu Mincho", "Hiragino Mincho ProN", serif;
}
html:is(:lang(zh-Hans), :lang(ja)) { font-family: ShareTech, var(--local-sans); }
html:is(:lang(zh-Hans), :lang(ja)) :is(.portfolio-view h2, .project-title, .about-copy .large-copy) {
  font-family: 'Instrument Serif', Georgia, var(--local-serif);
  letter-spacing: 0;
}
/* The garden title stays in English in every language, so it keeps the default type. */
html:is(:lang(zh-Hans), :lang(ja)) .portfolio-view h2 {
  font-size: clamp(52px, 6.2vw, 92px);
  line-height: 1.12;
}
html:is(:lang(zh-Hans), :lang(ja)) :is(h2, .large-copy) em { font-style: normal; }
.about-view .view-heading { container-type: inline-size; }
html:is(:lang(zh-Hans), :lang(ja)) #about-title { font-size: min(clamp(41px, 4.4vw, 76px), 16cqi); }
/* Where a language gives the name a reading, it sits above the name as furigana. */
#about-title ruby:has(rt:empty) { display: none; }
#about-title rt { font-size: .3em; letter-spacing: .12em; color: var(--muted); }
#about-title:has(rt:not(:empty)) em { display: inline-block; margin-top: .2em; }
.content-shade {
  position: fixed; inset: 0; pointer-events: none; opacity: 0;
  background: linear-gradient(90deg, #09070df5 0%, #09070de8 50%, #09070d7a 100%);
  transition: opacity .35s;
}
#scene { transition: opacity .4s, filter .4s; }
body:not([data-page="garden"]) .content-shade { opacity: 1; }
body:not([data-page="garden"]) #scene { opacity: .6; filter: blur(4px); }
body:not([data-page="garden"]) .flower-cursor { display: none; }
.portfolio-view {
  position: fixed; top: 151px; left: 5.8vw; right: 5.8vw; bottom: 40px;
  overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding-right: 14px;
  scrollbar-width: thin; scrollbar-color: #7e658b55 transparent;
}
.view-grid {
  display: grid; grid-template-columns: minmax(225px, .8fr) minmax(0, 1.35fr);
  gap: 7vw; align-items: start; padding-bottom: 10px;
}
.work-view { top: 137px; }
.work-view .view-grid { padding-bottom: 4px; }
.view-heading { position: sticky; top: 0; }
.portfolio-view .eyebrow { margin-bottom: 25px; line-height: 1.6; }
.portfolio-view:not([hidden]) { animation: view-in .4s ease-out both; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }
.portfolio-view h2 {
  margin: 0; font-family: var(--serif); font-weight: normal;
  font-size: clamp(64px, 7.4vw, 116px); line-height: .92; letter-spacing: -.03em;
}
.portfolio-view [tabindex="-1"]:focus { outline: none; }
.portfolio-view h2 em { color: var(--lilac); font-weight: normal; }
.view-intro { max-width: 285px; margin: 27px 0 0; font-size: 13px; line-height: 1.9; color: var(--muted); }
.project-list { border-top: 1px solid var(--line); }
.project { border-bottom: 1px solid var(--line); }
.project summary { display: flex; align-items: center; gap: 17px; padding: 11px 0; list-style: none; cursor: pointer; }
.project summary::-webkit-details-marker { display: none; }
.project summary:focus-visible { outline: 1px solid var(--acid); outline-offset: -1px; }
.project-index { font-size: 11px; color: #8f7f9b; width: 24px; flex-shrink: 0; }
.project-heading { display: flex; flex-direction: column; gap: 4px; }
.project-title {
  font-family: var(--serif); font-size: 29px;
  letter-spacing: -.01em; line-height: 1.08; transition: color .2s;
}
.project-kind { font-size: 11px; letter-spacing: .06em; color: #9788a2; }
.project-mark { margin-left: auto; padding: 0 3px; font-family: Arial, sans-serif; font-size: 22px; font-weight: 200; color: #b7a6c5; }
.project[open] .project-title, .project summary:hover .project-title { color: var(--lilac); }
.project[open] .project-mark { transform: rotate(45deg); color: var(--lilac); }
.project-description { margin: -2px 24px 17px 39px; }
.project-description p { font-size: 13px; line-height: 1.85; color: #c0b4c8; margin: 0 0 14px; }
.project-links { display: flex; flex-wrap: wrap; gap: 14px 25px; }
.project-links a { position: relative; font-size: 12px; color: #dbd4e1; }
.project-links a > [aria-hidden="true"] { color: var(--lilac); margin-left: 8px; }
.project-links a:hover > [aria-hidden="true"] { color: inherit; }
.project-links a:hover { color: var(--acid); }
.work-preview { display: none; }
.project-preview { margin: 0 0 19px; min-width: 0; }
.project-preview-link {
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  aspect-ratio: 16 / 10; background: #120e19; border: 1px solid #c6b2db4d;
  box-shadow: 0 30px 70px -36px #000, 0 44px 90px -52px #c6b2db80;
  transition: border-color .2s;
}
.project-preview-link:hover { border-color: #d2fb8373; }
.project-preview-link:focus-visible { outline-offset: 4px; }
.project-preview img { display: block; width: 100%; height: 100%; object-fit: contain; }
@media (min-width: 901px) {
  .work-view { inset-inline: 3.2vw; }
  .work-view .view-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(24px, 4vw, 72px); }
  .work-view h2 { font-size: clamp(64px, 5.4vw, 90px); }
  .work-view .view-intro { margin-top: 20px; max-width: 300px; }
  .work-view.has-work-preview .work-preview { display: block; margin-top: 27px; }
  .work-preview .project-preview { margin-bottom: 0; }
  .work-preview .project-preview-link { width: 100%; max-height: max(175px, calc(100dvh - 304px)); }
  .work-view.has-work-preview .project-description > .project-preview { display: none; }
  .work-view .project summary { padding: 13px 0; }
  .work-view .project-description { margin-bottom: 23px; }
}
@media (min-width: 901px) and (max-height: 850px) {
  .work-view .eyebrow { margin-bottom: 18px; }
  .work-view h2 { font-size: 65px; }
  .work-view .view-intro { margin-top: 15px; font-size: 12px; line-height: 1.7; }
  .work-view.has-work-preview .work-preview { margin-top: 20px; }
}
/* The portrait takes the height the view has left under the heading (the view
   is 100vh - 191px with a 5vh foot; above it sit the eyebrow, two title lines,
   and the gaps), so heading and photo fit without scrolling on short windows. */
.about-portrait {
  --title-size: clamp(64px, 7.4vw, 116px);
  --room: calc(95vh - 286px - 1.84 * var(--title-size));
  width: clamp(160px, calc(4 / 3 * var(--room)), 420px); max-width: 100%; margin: 30px 0 0;
  border: 1px solid #c6b2db4d; background: #120e19;
  box-shadow: 0 30px 70px -36px #000, 0 44px 90px -52px #c6b2db80;
}
.about-portrait img { display: block; width: 100%; height: auto; }
/* Short desktop windows trade some title size for a larger portrait, as Work does. */
@media (min-width: 901px) and (max-height: 850px) {
  .about-view h2 { font-size: clamp(64px, 5.7vw, 84px); }
  .about-portrait { --title-size: clamp(64px, 5.7vw, 84px); margin-top: 26px; }
}
/* The copy sits level with the middle of the heading and photo, and its
   measure and type keep growing with the window on wide screens. */
.about-copy { align-self: center; max-width: clamp(610px, 38vw, 780px); }
/* On desktop the heading's parts sit straight on the grid, so the first line of
   the copy shares a baseline with the first line of the title. Narrower
   two-column windows keep the copy centred beside the heading. */
@media (min-width: 901px) {
  .about-view .view-grid { grid-template-rows: auto auto 1fr; row-gap: 0; }
  .about-view .view-heading { display: contents; }
  .about-view .view-heading > * { grid-column: 1; }
  .about-view h2, .about-copy { align-self: first baseline; }
  .about-copy { grid-area: 2 / 2 / span 2; }
}
.about-copy .large-copy {
  margin: -6px 0 24px; font-family: var(--serif);
  font-size: clamp(30px, 2.75vw, 58px); line-height: 1.26; letter-spacing: -.01em; color: #e4dce9;
}
.large-copy em { color: var(--lilac); font-weight: normal; }
.about-copy p:not(.large-copy) { font-size: clamp(13px, .78vw, 16px); line-height: 1.95; color: #b8aabd; margin: 0 0 16px; }
.resume-link { display: flex; justify-content: space-between; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 19px 0; margin-top: 29px; font-size: clamp(13px, .78vw, 16px); }
.resume-link span:last-child { color: var(--lilac); }
.resume-link:hover span:last-child { color: inherit; }
.resume-link:hover, .contact-links a:hover { color: var(--acid); }
/* Sit About and Contact in the middle of the view rather than against its top edge. */
.about-view, .contact-view { display: flex; flex-direction: column; padding-bottom: 5vh; }
.about-view > .view-grid { width: 100%; margin-block: auto; }
.contact-view { align-items: flex-start; }
.contact-view > :first-child { margin-top: auto; }
.contact-view > :last-child { margin-bottom: auto; }
.contact-view h2 { font-size: clamp(92px, 10.4vw, 168px); }
.email-link {
  display: inline-flex; align-items: center; gap: 28px; font-family: var(--serif);
  font-size: clamp(30px, 4vw, 58px); line-height: 1.2; letter-spacing: -.01em;
  border-bottom: 1px solid #c6afcf66; margin-top: 32px; padding-bottom: 10px;
}
.email-link span { color: var(--lilac); font-family: ShareTech, monospace; font-size: .5em; }
.email-link:hover span { color: inherit; }
.email-link:hover { color: var(--acid); }
.contact-links { display: flex; gap: 32px; margin-top: 34px; font-size: 12px; color: #b9a9c2; }
.contact-links a { position: relative; }
.contact-links [aria-hidden="true"] { margin-left: 7px; color: var(--lilac); }
.contact-links a:hover [aria-hidden="true"] { color: inherit; }

@media (max-width: 1180px) {
  .view-grid { gap: 5vw; grid-template-columns: minmax(210px, .8fr) minmax(0, 1.35fr); }
  .project-title { font-size: 27px; }
}
@media (max-width: 800px) and (min-width: 601px) {
  .page-nav { gap: 18px; left: 54%; }
  .portfolio-view { left: 5%; right: 4%; top: 139px; }
  .view-grid { grid-template-columns: minmax(175px, .7fr) minmax(0, 1.3fr); gap: 30px; }
  .portfolio-view h2 { font-size: clamp(48px, 8vw, 64px); }
  .project-title { font-size: 24px; }
  .project summary { gap: 10px; }
  .project-description { margin-left: 32px; }
  .view-intro { font-size: 12px; }
}
@media (max-width: 760px) {
  body[data-page="garden"] .garden-footer {
    grid-template-columns: 1fr auto; align-content: center; min-height: max(var(--footer-h), 92px); row-gap: 4px;
  }
  body[data-page="garden"] .controls { grid-area: 2 / 2; }
  .season-preview { grid-area: 1 / 1 / 2 / -1; }
  .study-switch { width: 100%; justify-content: space-between; gap: 0; }
  .study-switch button:first-child { white-space: normal; text-align: left; }
  .study-switch button:last-child { text-align: right; }
}
@media (max-width: 600px) {
  body[data-page="garden"] .vignette {
    --specimen-corner: radial-gradient(ellipse 90% clamp(315px, 45vh, 440px) at left top, #09070db8, #09070d66 58%, transparent);
  }
  /* One quiet row of controls sits over a slim row of seasons: sound keeps its
     label on the left, pause and replant are plain icons on the right. Nothing
     is boxed, and each control keeps a 44 px touch target. */
  body[data-page="garden"] { --footer-h: 88px; }
  body[data-page="garden"] .garden-footer {
    grid-template-columns: minmax(0, 1fr);
    min-height: var(--footer-h);
    row-gap: 0;
    padding: 2px 0 max(8px, env(safe-area-inset-bottom));
  }
  body[data-page="garden"] .controls {
    grid-area: 1 / 1;
    display: flex; align-items: center; gap: 2px;
    justify-self: stretch;
  }
  .sound-toggle svg { flex-shrink: 0; }
  body[data-page="garden"] .controls :is(.sound-toggle, .text-button) {
    position: static; min-width: 0; min-height: 44px; padding: 0;
    border: 0; background: none; backdrop-filter: none;
    font-size: 12px; line-height: 1.2;
  }
  body[data-page="garden"] .sound-toggle {
    margin-right: auto; justify-content: flex-start; gap: 8px;
    color: var(--paper); text-align: left; white-space: normal;
  }
  body[data-page="garden"] .sound-toggle[aria-pressed="true"] { color: var(--acid); }
  /* The pause label stays for screen readers; sighted visitors get pause bars,
     or a play triangle while the garden is held still. */
  body[data-page="garden"] #motion-toggle {
    order: 1; display: inline-flex; align-items: center; justify-content: center;
    width: 44px; font-size: 0;
  }
  #motion-toggle::before {
    content: ""; box-sizing: border-box; width: 9px; height: 11px;
    border-inline: 2.5px solid currentColor;
  }
  #motion-toggle[aria-pressed="true"]::before {
    width: 0; height: 0; border: 0;
    border-block: 6px solid transparent; border-left: 10px solid currentColor;
  }
  body[data-page="garden"] #motion-toggle[aria-pressed="true"] { color: var(--paper); }
  /* The replant glyph sits flush with the right edge; its touch target runs
     into the page margin. */
  body[data-page="garden"] #reseed {
    order: 2; position: relative; display: grid; place-items: center;
    width: 44px; margin-right: -17px; font-size: 17px;
  }
  #reseed [aria-hidden="true"] { margin: 0; }
  #reseed [data-i18n] {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
  }
  .season-preview { grid-area: 2 / 1; }
  .study-switch button { min-height: 30px; padding: 4px 0 6px; }
  .now-flower { display: none; }
  body[data-season="winter"] .vignette { --winter-haze: linear-gradient(#09070d94, transparent 215px); }
  .identity { max-width: 58%; }
  .language-switch { gap: 14px; }
  body[data-study="chrysanthemum"] .specimen-name { font-size: 18px; }
  .site-header { top: 18px; }
  .page-nav { top: 46px; left: 0; right: 0; transform: none; justify-content: space-between; }
  .page-nav a { padding: 6px 0 9px; min-width: 44px; }
  .page-nav a:last-child { text-align: right; }
  /* Phones open straight onto the garden: the title stays for screen readers
     only, and the shade that backed it is dropped. */
  .intro {
    width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
  }
  body[data-page="garden"] .vignette::before { content: none; }
  .specimen-card { top: 104px; left: 23px; right: auto; }
  .portfolio-view { top: 120px; left: 23px; right: 18px; bottom: max(22px, env(safe-area-inset-bottom)); padding-right: 5px; }
  .view-grid { display: block; }
  .about-view > .view-grid { margin-block: 0; }
  .view-heading { position: static; }
  .portfolio-view .eyebrow { margin-bottom: 17px; letter-spacing: .06em; }
  .portfolio-view h2 { font-size: 68px; }
  .view-intro { margin: 18px 0 27px; max-width: 300px; line-height: 1.8; }
  .project-title { font-size: 26px; }
  .project summary { gap: 10px; padding: 18px 0; }
  .project-index { width: 20px; }
  .project-kind { letter-spacing: .025em; }
  .project-description { margin-left: 28px; margin-right: 8px; }
  .project-links a { padding: 5px 0; }
  .about-copy { padding-top: 3px; }
  #about-title { margin-bottom: 22px; }
  .about-portrait { width: 100%; margin: 0 0 28px; }
  .about-copy .large-copy { font-size: 29px; margin-top: 0; }
  .contact-view h2 { font-size: 78px; }
  .email-link { font-size: 33px; gap: 14px; margin-top: 24px; }
  .contact-links { margin-top: 28px; }
  html:is(:lang(zh-Hans), :lang(ja)) .portfolio-view h2 { font-size: 48px; }
  html:is(:lang(zh-Hans), :lang(ja)) #about-title { font-size: clamp(36px, 11vw, 48px); }
}
@media (max-width: 360px) {
  .name { font-size: 12px; letter-spacing: .02em; line-height: 1.15; }
  .portfolio-view h2 { font-size: 62px; }
  .project-title { font-size: 24px; }
  .contact-view h2 { font-size: 68px; }
  .email-link { font-size: 29px; gap: 10px; }
}
@media (max-height: 600px) and (min-width: 601px) {
  .portfolio-view { top: 110px; bottom: 28px; }
  .portfolio-view h2 { font-size: min(66px, 8vw); }
  .contact-view h2 { font-size: 98px; }
}
@media (prefers-reduced-motion: reduce) {
  #scene, .content-shade, .page-nav a, .project-title { transition: none; }
}

html:is(:lang(zh-Hans), :lang(ja)) :is(.view-intro, .about-copy p:not(.large-copy), .project-description p) { font-size: 14px; }
html:is(:lang(zh-Hans), :lang(ja)) .project-kind { font-size: 12px; }
html:is(:lang(zh-Hans), :lang(ja)) .about-copy p:not(.large-copy) { font-size: clamp(14px, .78vw, 16px); }
html:is(:lang(zh-Hans), :lang(ja)) .about-copy .large-copy { line-height: 1.4; }

@media (max-width: 600px) and (max-height: 700px) {
  .page-nav { top: 40px; }
  .specimen-card { top: 96px; }
  .portfolio-view { top: 112px; }
}
