/* ==========================================================================
   DEM 地理教育平台 — Portal
   Editorial design system: minimal / spatial / academic / contemporary.
   Chapter numbering, hairline order, typography-first. No decoration that
   does not carry information.
   --------------------------------------------------------------------------
   01. Tokens            04. Hero               08. Explore (04)
   02. Base + utilities  05. Chapters 01–02     09. Connect (05) + Footer
   03. Header            06. Platform (03)      10. Hometown ring
                                                11. Motion + Responsive
   ========================================================================== */

/* 01. Tokens ------------------------------------------------------------- */

:root {
    /* Color — black / white / gray only */
    --bg-white: #FFFFFF;
    --bg-paper: #F7F7F5;
    --bg-ink: #111111;

    --ink: #111111;
    --ink-2: #222222;
    --muted: #777777;
    --faint: #999999;
    --inverse: #F5F5F3;
    --inverse-muted: rgba(245, 245, 243, 0.56);

    --line: rgba(0, 0, 0, 0.10);
    --line-strong: rgba(0, 0, 0, 0.16);
    --line-inverse: rgba(255, 255, 255, 0.16);
    --line-inverse-strong: rgba(255, 255, 255, 0.30);

    /* single restrained accent — hometown ring only */
    --accent: #2E5D49;
    --accent-soft: rgba(46, 93, 73, 0.16);

    /* Typography */
    --font-sans: "Inter", "Helvetica Neue", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
    --font-mono: ui-monospace, "SFMono-Regular", "Menlo", "Consolas", monospace;

    --t-index: 11px;                                   /* chapter index / meta */
    --t-meta: 12px;                                    /* auxiliary latin */
    --t-body: 15px;
    --t-lede: clamp(16px, 1.25vw, 19px);
    --t-row-title: clamp(19px, 1.6vw, 24px);
    --t-chapter: clamp(46px, 6.4vw, 106px);            /* section display */
    --t-hero: clamp(72px, 11.5vw, 196px);              /* brand display */

    /* Grid */
    --shell-max: 1680px;
    --gutter: clamp(20px, 6vw, 104px);
    --gap: clamp(16px, 1.6vw, 28px);

    /* Rhythm */
    --chapter-pad: clamp(96px, 13vw, 224px);
    --header-h: 64px;

    /* Motion */
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --d-reveal: 650ms;
    --d-clip: 750ms;
    --d-hover: 700ms;
}

/* 02. Base + utilities ---------------------------------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: var(--t-body);
    line-height: 1.7;
    color: var(--ink);
    background: var(--bg-white);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
p,
ol,
ul,
figure {
    margin: 0;
    padding: 0;
}

ol,
ul {
    list-style: none;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

img,
svg,
video {
    display: block;
    max-width: 100%;
}

::selection {
    background: var(--ink);
    color: var(--bg-white);
}

:focus-visible {
    outline: 1px solid currentColor;
    outline-offset: 4px;
}

.shell {
    max-width: var(--shell-max);
    margin: 0 auto;
    padding-inline: var(--gutter);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    padding: 10px 18px;
    font-size: var(--t-meta);
    background: var(--ink);
    color: var(--inverse);
    transform: translateY(-260%);
    transition: transform 200ms var(--ease);
}

.skip-link:focus {
    transform: none;
}

/* chapter index — tiny mono rule, unified position logic */
.chapter-index {
    display: flex;
    align-items: center;
    gap: 16px;
    font-family: var(--font-mono);
    font-size: var(--t-index);
    letter-spacing: 0.16em;
    color: var(--muted);
    white-space: nowrap;
}

.chapter-index::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

/* typography link with expanding underline + arrow */
.link-arrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink);
}

.link-arrow .link-arrow__label {
    position: relative;
}

.link-arrow .link-arrow__label::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 100%;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 600ms var(--ease);
}

.link-arrow svg {
    transition: transform 600ms var(--ease);
}

.link-arrow:hover .link-arrow__label::after {
    transform: scaleX(1);
}

.link-arrow:hover svg {
    transform: translate(3px, -3px);
}

/* 03. Header --------------------------------------------------------------- */

.nav {
    position: fixed;
    inset: 0 0 auto;
    z-index: 100;
    transition:
        background-color 400ms var(--ease),
        border-color 400ms var(--ease),
        color 400ms var(--ease);
    border-bottom: 1px solid transparent;
}

.nav__inner {
    max-width: var(--shell-max);
    margin: 0 auto;
    padding-inline: var(--gutter);
    height: var(--header-h);
    display: flex;
    align-items: center;
    gap: clamp(24px, 4vw, 64px);
}

.nav__brand {
    display: flex;
    align-items: baseline;
    gap: 12px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.nav__brand-sub {
    font-size: var(--t-meta);
    font-weight: 400;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    opacity: 0.55;
}

.nav__menu {
    display: flex;
    align-items: center;
    gap: clamp(18px, 2.4vw, 40px);
    margin-left: auto;
}

.nav__link {
    position: relative;
    font-size: 13px;
    letter-spacing: 0.06em;
    padding-block: 6px;
    opacity: 0.72;
    transition: opacity 300ms var(--ease);
}

.nav__link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 500ms var(--ease);
}

.nav__link:hover {
    opacity: 1;
}

.nav__link:hover::after,
.nav__link.is-active::after {
    transform: scaleX(1);
}

.nav__cta {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.nav__cta svg {
    transition: transform 500ms var(--ease);
}

.nav__cta:hover svg {
    transform: translateX(4px);
}

.nav__toggle {
    display: none;
    margin-left: auto;
    width: 40px;
    height: 40px;
    position: relative;
    z-index: 120;                      /* stay above the mobile menu overlay */
}

.nav__toggle-line {
    position: absolute;
    left: 8px;
    right: 8px;
    height: 1px;
    background: currentColor;
    transition: transform 400ms var(--ease);
}

.nav__toggle-line:nth-child(1) { top: 16px; }
.nav__toggle-line:nth-child(2) { top: 24px; }

.nav-open .nav__toggle-line:nth-child(1) { transform: translateY(4px) rotate(45deg); }
.nav-open .nav__toggle-line:nth-child(2) { transform: translateY(-4px) rotate(-45deg); }

/* themes — dark over hero, light after scroll */
.nav[data-header-theme="dark"] {
    color: var(--inverse);
}

.nav[data-header-theme="light"] {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom-color: var(--line);
}

/* 04. Hero — brand statement ------------------------------------------------ */

.hero {
    position: relative;
    min-height: 100svh;
    display: flex;
    align-items: flex-end;
    background: var(--bg-ink);
    color: var(--inverse);
    overflow: hidden;
}

.hero__media {
    position: absolute;
    inset: 0;
}

.hero__poster {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 1;
    transition: opacity 800ms var(--ease);
}

.hero.has-video .hero__poster {
    opacity: 0;
}

.hero__video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1400ms var(--ease);
}

.hero__video.is-active {
    opacity: 1;
}

.hero__veil {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to bottom, rgba(8, 8, 8, 0.42), rgba(8, 8, 8, 0.12) 38%, rgba(8, 8, 8, 0.62) 100%);
}

.hero__inner {
    position: relative;
    width: 100%;
    max-width: var(--shell-max);
    margin: 0 auto;
    padding: calc(var(--header-h) + 40px) var(--gutter) clamp(56px, 8vh, 104px);
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--gap);
    align-items: end;
}

.hero__meta {
    grid-column: 1 / 5;
    grid-row: 1;
    align-self: end;
    font-family: var(--font-mono);
    font-size: var(--t-meta);
    letter-spacing: 0.18em;
    line-height: 2.1;
    text-transform: uppercase;
    color: var(--inverse-muted);
}

.hero__title {
    grid-column: 1 / 13;
    grid-row: 2;
    font-size: var(--t-hero);
    font-weight: 600;
    line-height: 1.02;
    letter-spacing: -0.015em;
    margin-top: clamp(48px, 9vh, 120px);
}

.hero__title .hero__title-zh {
    display: block;
    font-weight: 500;
}

.hero__scroll {
    grid-column: 11 / 13;
    grid-row: 1;
    justify-self: end;
    align-self: end;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: var(--t-index);
    letter-spacing: 0.22em;
    color: var(--inverse-muted);
    transition: color 400ms var(--ease);
}

.hero__scroll svg {
    animation: hero-scroll-hint 2.8s var(--ease) infinite;
}

.hero__scroll:hover {
    color: var(--inverse);
}

@keyframes hero-scroll-hint {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(6px);
    }
}

/* hero intro sequence */
.hero .reveal-line-inner {
    transform: none;
    transition: none;
}

.hero [data-hero-deferred] {
    opacity: 1;
    transform: none;
    transition: none;
}

/* 05. Chapters 01–02 — project features -------------------------------------- */

.chapter {
    padding-block: var(--chapter-pad);
    border-top: 1px solid var(--line);
}

.chapter--paper {
    background: var(--bg-paper);
}

.chapter__head {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--gap);
    margin-bottom: clamp(56px, 7vw, 128px);
}

.chapter__head .chapter-index {
    grid-column: 1 / 6;
    grid-row: 1;
    align-self: start;
}

.chapter__title {
    grid-column: 1 / 10;
    grid-row: 2;
    font-size: var(--t-chapter);
    font-weight: 500;
    line-height: 1.06;
    letter-spacing: -0.01em;
}

.chapter__aside {
    grid-column: 10 / 13;
    grid-row: 2;
    align-self: end;
    display: grid;
    gap: 28px;
    justify-items: start;
}

.chapter__aside p {
    font-size: var(--t-lede);
    line-height: 1.8;
    color: var(--muted);
}

/* mirrored composition for the second chapter */
.chapter--flip .chapter__head .chapter-index {
    grid-column: 8 / 13;
    flex-direction: row-reverse;
}

.chapter--flip .chapter__head .chapter-index::after {
    transform: scaleX(-1);
}

.chapter--flip .chapter__title {
    grid-column: 4 / 13;
}

.chapter--flip .chapter__aside {
    grid-column: 1 / 4;
}

/* figure */
.chapter__figure-wrap {
    position: relative;
}

.chapter__figure-wrap > a {
    display: block;
}

.chapter__figure {
    position: relative;
    overflow: hidden;
    border-radius: 0;
    background: var(--bg-white);
    border: 1px solid var(--line);
    aspect-ratio: 16 / 8.4;
    transition: transform 900ms var(--ease);
}

.chapter__figure-wrap > a:hover .chapter__figure {
    transform: scale(1.012);
}

.chapter__figure-inner {
    position: absolute;
    inset: -40px;                      /* bleed room for parallax */
    display: flex;
    align-items: center;
    justify-content: center;
    will-change: transform;
}

.chapter__cta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    margin-top: 28px;
}

.chapter__coords {
    font-family: var(--font-mono);
    font-size: var(--t-index);
    letter-spacing: 0.16em;
    color: var(--faint);
    text-transform: uppercase;
}

/* hometown figure — contour drawing */
.figure-contour {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    color: rgba(0, 0, 0, 0.32);
}

.figure-contour path {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
}

.is-visible .figure-contour path {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 2000ms var(--ease);
}

.is-visible .figure-contour path:nth-child(1) { transition-delay: 100ms; }
.is-visible .figure-contour path:nth-child(2) { transition-delay: 250ms; }
.is-visible .figure-contour path:nth-child(3) { transition-delay: 400ms; }
.is-visible .figure-contour path:nth-child(4) { transition-delay: 550ms; }
.is-visible .figure-contour path:nth-child(5) { transition-delay: 700ms; }
.is-visible .figure-contour path:nth-child(6) { transition-delay: 850ms; }

.figure-scale {
    position: absolute;
    left: 28px;
    bottom: 24px;
    display: grid;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    color: var(--faint);
    text-transform: uppercase;
}

.figure-scale::before {
    content: "";
    width: 88px;
    height: 1px;
    background: rgba(0, 0, 0, 0.28);
}

.figure-coord {
    position: absolute;
    right: 28px;
    top: 24px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    color: var(--faint);
}

/* aurora figure — spatial interface, no glow */
.figure-interface {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(rgba(0, 0, 0, 0.13) 1px, transparent 1.5px) 0 0 / 28px 28px,
        var(--bg-white);
}

.figure-interface__frame {
    position: absolute;
    inset: clamp(24px, 4vw, 64px);
    border: 1px solid var(--line-strong);
}

.figure-interface__frame::before,
.figure-interface__frame::after {
    content: "";
    position: absolute;
    background: var(--line-strong);
}

.figure-interface__frame::before {
    left: 62%;
    top: -1px;
    bottom: -1px;
    width: 1px;
}

.figure-interface__frame::after {
    top: 38%;
    left: -1px;
    right: -1px;
    height: 1px;
}

.figure-interface__node {
    position: absolute;
    left: 62%;
    top: 38%;
    width: 7px;
    height: 7px;
    border: 1px solid var(--ink);
    background: var(--bg-white);
    transform: rotate(45deg) translate(-50%, -50%);
}

.figure-interface__node::after {
    content: "";
    position: absolute;
    inset: -13px;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
}

.figure-interface__label {
    position: absolute;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
}

.figure-interface__label--head {
    left: clamp(24px, 4vw, 64px);
    top: clamp(24px, 4vw, 64px);
    transform: translateY(-190%);
}

.figure-interface__label--node {
    left: 62%;
    top: 38%;
    transform: translate(18px, 14px);
}

.figure-interface__label--foot {
    right: clamp(24px, 4vw, 64px);
    bottom: clamp(24px, 4vw, 64px);
    transform: translateY(190%);
}

/* 06. Platform — 03, sticky index + capability rows --------------------------- */

.platform {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--gap);
    align-items: start;
}

.platform__head {
    grid-column: 1 / 6;
    position: sticky;
    top: calc(var(--header-h) + 48px);
}

.platform__head .chapter-index {
    margin-bottom: clamp(40px, 5vw, 88px);
}

.platform__title {
    font-size: clamp(38px, 4.6vw, 78px);
    font-weight: 500;
    line-height: 1.16;
    letter-spacing: -0.01em;
}

.platform__lede {
    margin-top: 32px;
    max-width: 34ch;
    font-size: var(--t-lede);
    line-height: 1.85;
    color: var(--muted);
}

.platform__list {
    grid-column: 7 / 13;
}

.platform__item {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 20px;
    padding-block: clamp(24px, 2.6vw, 40px);
    border-top: 1px solid var(--line);
    transition: transform 600ms var(--ease);
}

.platform__item:last-child {
    border-bottom: 1px solid var(--line);
}

.platform__item:hover {
    transform: translateX(8px);
}

.platform__num {
    font-family: var(--font-mono);
    font-size: var(--t-index);
    letter-spacing: 0.16em;
    color: var(--faint);
    padding-top: 6px;
}

.platform__item h3 {
    font-size: var(--t-row-title);
    font-weight: 500;
    letter-spacing: 0.01em;
}

.platform__item h3 .en {
    margin-left: 14px;
    font-family: var(--font-mono);
    font-size: var(--t-meta);
    font-weight: 400;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--faint);
}

.platform__item p {
    margin-top: 10px;
    font-size: var(--t-body);
    color: var(--muted);
    max-width: 46ch;
}

/* 08. Explore — 04, typographic index ------------------------------------------- */

.explore__head {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--gap);
    margin-bottom: clamp(48px, 6vw, 104px);
}

.explore__head .chapter-index {
    grid-column: 1 / 6;
    grid-row: 1;
    align-self: start;
}

.explore__title {
    grid-column: 1 / 9;
    grid-row: 2;
    font-size: var(--t-chapter);
    font-weight: 500;
    line-height: 1.08;
    letter-spacing: -0.01em;
}

.explore__lede {
    grid-column: 10 / 13;
    grid-row: 2;
    align-self: end;
    font-size: var(--t-lede);
    line-height: 1.85;
    color: var(--muted);
}

.explore__item {
    border-top: 1px solid var(--line);
}

.explore__item:last-child {
    border-bottom: 1px solid var(--line);
}

.explore__item a {
    display: grid;
    grid-template-columns: 64px 1fr auto auto;
    align-items: baseline;
    gap: clamp(16px, 2vw, 32px);
    padding-block: clamp(26px, 3vw, 44px);
    transition: padding-left 600ms var(--ease);
}

.explore__item a:hover {
    padding-left: 14px;
}

.explore__num {
    font-family: var(--font-mono);
    font-size: var(--t-index);
    letter-spacing: 0.16em;
    color: var(--faint);
}

.explore__name {
    font-size: clamp(26px, 3.2vw, 52px);
    font-weight: 500;
    line-height: 1.15;
}

.explore__en {
    font-family: var(--font-mono);
    font-size: var(--t-meta);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--faint);
    justify-self: end;
    text-align: right;
}

.explore__arrow {
    justify-self: end;
    color: var(--ink);
    transition: transform 600ms var(--ease);
}

.explore__item a:hover .explore__arrow {
    transform: translate(4px, -4px);
}

/* 10. Connect — 06, and footer. One continuous dark ending ----------------------- */

.connect {
    background: var(--bg-ink);
    color: var(--inverse);
    padding-block: var(--chapter-pad) clamp(64px, 8vw, 128px);
}

.connect__head {
    margin-bottom: clamp(48px, 6vw, 104px);
}

.connect__head .chapter-index {
    color: var(--inverse-muted);
    margin-bottom: clamp(40px, 5vw, 80px);
}

.connect__head .chapter-index::after {
    background: var(--line-inverse);
}

.connect__title {
    font-size: var(--t-chapter);
    font-weight: 500;
    line-height: 1.12;
    letter-spacing: -0.01em;
    max-width: 22ch;
}

.connect__title em {
    font-style: normal;
    color: var(--inverse-muted);
}

.connect__copy {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--gap);
    align-items: end;
}

.connect__copy > p {
    grid-column: 1 / 6;
    font-size: var(--t-lede);
    line-height: 1.85;
    color: var(--inverse-muted);
}

.connect__actions {
    grid-column: 8 / 13;
    display: flex;
    flex-wrap: wrap;
    gap: clamp(24px, 3vw, 48px);
    justify-content: flex-end;
}

.connect__actions .link-arrow {
    color: var(--inverse);
}

.footer {
    background: var(--bg-ink);
    color: var(--inverse);
    border-top: 1px solid var(--line-inverse);
}

.footer__top {
    max-width: var(--shell-max);
    margin: 0 auto;
    padding: clamp(48px, 6vw, 96px) var(--gutter);
    display: grid;
    grid-template-columns: 4fr 2fr 2fr 2fr;
    gap: var(--gap);
}

.footer__brand-mark {
    font-size: clamp(40px, 4.4vw, 72px);
    font-weight: 600;
    letter-spacing: 0.08em;
    line-height: 1;
    display: inline-block;
}

.footer__brand-sub {
    margin-top: 20px;
    font-size: var(--t-body);
    line-height: 1.8;
    color: var(--inverse-muted);
}

.footer__col-title {
    font-family: var(--font-mono);
    font-size: var(--t-index);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--inverse-muted);
    margin-bottom: 20px;
}

.footer__nav li {
    padding-block: 6px;
}

.footer__nav a,
.footer__nav span {
    font-size: var(--t-body);
    color: var(--inverse-muted);
    transition: color 300ms var(--ease);
}

.footer__nav a:hover {
    color: var(--inverse);
}

.footer__bottom {
    max-width: var(--shell-max);
    margin: 0 auto;
    padding: 24px var(--gutter) 32px;
    border-top: 1px solid var(--line-inverse);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px 32px;
    font-family: var(--font-mono);
    font-size: var(--t-index);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--inverse-muted);
}

.footer__top-link {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: color 300ms var(--ease);
}

.footer__top-link:hover {
    color: var(--inverse);
}

/* 11. Motion system ---------------------------------------------------------------- */

/* text reveal: lines rise from behind a mask */
.reveal-line {
    display: block;
    overflow: hidden;
}

.reveal-line-inner {
    display: block;
    transform: none;
    transition: none;
}

.is-visible .reveal-line-inner,
.reveal-line.is-visible .reveal-line-inner {
    transform: translateY(0);
}

/* standard reveal: quiet rise */
.portal-ready [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
}

.portal-ready [data-reveal].is-visible {
    opacity: 1;
    transform: none;
}

[data-reveal-delay="1"] { transition-delay: 60ms; }
[data-reveal-delay="2"] { transition-delay: 120ms; }
[data-reveal-delay="3"] { transition-delay: 180ms; }

/* clip reveal: figures wipe open.
   NOTE: the attribute lives on the unclipped wrapper — a fully clipped
   target reports zero intersection, so the observer must watch the wrap. */
.portal-ready [data-reveal-kind="clip"] .chapter__figure {
    clip-path: none;
    transition: none;
}

.portal-ready [data-reveal-kind="clip"].is-visible .chapter__figure {
    clip-path: inset(0 0 0 0);
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .reveal-line-inner,
    [data-reveal],
    [data-reveal-kind="clip"] .chapter__figure,
    .hero [data-hero-deferred] {
        opacity: 1 !important;
        transform: none !important;
        clip-path: none !important;
    }

    .figure-contour path {
        stroke-dashoffset: 0 !important;
    }
}

/* 12. Responsive -------------------------------------------------------------------- */

@media (max-width: 1080px) {
    .chapter__head .chapter-index,
    .chapter--flip .chapter__head .chapter-index {
        grid-column: 1 / 13;
        flex-direction: row;
    }

    .chapter--flip .chapter__head .chapter-index::after {
        transform: none;
    }

    .chapter__title,
    .chapter--flip .chapter__title {
        grid-column: 1 / 13;
        grid-row: 2;
    }

    .chapter__aside,
    .chapter--flip .chapter__aside {
        grid-column: 1 / 10;
        grid-row: 3;
    }

    .platform__head {
        grid-column: 1 / 13;
        position: static;
    }

    .platform__list {
        grid-column: 1 / 13;
        margin-top: clamp(40px, 6vw, 72px);
    }

    .connect__copy > p {
        grid-column: 1 / 13;
    }

    .connect__actions {
        grid-column: 1 / 13;
        justify-content: flex-start;
    }
}

@media (max-width: 960px) {
    .nav__menu {
        position: fixed;
        inset: 0;
        z-index: 90;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        gap: 8px;
        padding: var(--gutter);
        background: var(--bg-ink);
        color: var(--inverse);
        opacity: 0;
        pointer-events: none;
        transition: opacity 400ms var(--ease);
    }

    .nav-open .nav__menu {
        opacity: 1;
        pointer-events: auto;
    }

    .nav__menu li {
        width: 100%;
        border-top: 1px solid var(--line-inverse);
    }

    .nav__link,
    .nav__cta {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        padding-block: 18px;
        font-size: 20px;
        letter-spacing: 0.04em;
        opacity: 1;
    }

    .nav__link::after {
        display: none;
    }

    .nav[data-header-theme],
    .nav-open .nav[data-header-theme] {
        color: var(--inverse);
    }

    .nav__toggle {
        display: block;
    }

    .nav__brand-sub {
        display: none;
    }
}

@media (max-width: 820px) {
    :root {
        --chapter-pad: clamp(72px, 18vw, 120px);
    }

    .hero__inner {
        display: block;
    }

    .hero__meta {
        display: none;
    }

    .hero__title {
        margin-top: 0;
        font-size: clamp(48px, 13.5vw, 92px);
    }

    .hero__scroll {
        display: inline-flex;
        margin-top: 40px;
    }

    .chapter__figure {
        aspect-ratio: 4 / 3.4;
    }

    .explore__item a {
        grid-template-columns: 44px 1fr auto;
    }

    .explore__en {
        display: none;
    }

    .footer__top {
        grid-template-columns: 1fr 1fr;
    }

    .footer__brand {
        grid-column: 1 / 3;
    }
}

@media (max-width: 560px) {
    .footer__top {
        grid-template-columns: 1fr;
    }

    .footer__brand {
        grid-column: auto;
    }

    .chapter__cta-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
}

/* 13. Hometown ring — 01, left portrait work + right rotating ring ---------- */

.chapter--ring {
    /* The rotating wheel's square bounds must not widen the mobile page. */
    overflow: clip;
}

.ring-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: clamp(40px, 5vw, 88px);
}

.ring-head .chapter-index {
    flex: 1;
}

.ring-layout {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(0, 1.3fr);
    gap: clamp(36px, 4.5vw, 80px);
    align-items: center;
}

/* left — selected work */
.ring-work__changing {
    position: relative;
    width: min(100%, 520px);
    margin-inline: auto;
    opacity: 1;
    transition: opacity 240ms ease;
    will-change: opacity;
}

.ring-work__changing.is-switching {
    opacity: 0;
}

.ring-work__top {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 22px;
}

.ring-work__index {
    flex: 0 0 2ch;
    font-size: clamp(40px, 3.4vw, 54px);
    font-weight: 600;
    line-height: 0.94;
    letter-spacing: -0.04em;
    color: var(--accent);
}

.ring-work__head {
    min-width: 0;
    overflow-wrap: anywhere;
}

.ring-work__title {
    font-size: clamp(19px, 1.6vw, 24px);
    font-weight: 500;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.ring-work__location {
    margin-top: 7px;
    font-family: var(--font-mono);
    font-size: var(--t-meta);
    letter-spacing: 0.12em;
    color: var(--muted);
}

.ring-work__photo {
    position: relative;
    aspect-ratio: 3 / 4.45;
    overflow: hidden;
    background: transparent;
}

.ring-work__photo img,
.ring-poster {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.ring-work__corner {
    position: absolute;
    width: 18px;
    height: 18px;
    pointer-events: none;
    z-index: 3;
}

.ring-work__photo.has-image .ring-work__corner {
    display: none;
}

.ring-work__corner--a {
    left: 0;
    top: 0;
    border-left: 1px solid var(--accent);
    border-top: 1px solid var(--accent);
}

.ring-work__corner--b {
    right: 0;
    bottom: 0;
    border-right: 1px solid var(--accent);
    border-bottom: 1px solid var(--accent);
}

/* typographic placeholder until a real photo path is provided */
.ring-poster {
    background: linear-gradient(165deg, #EDEBE4, #E2E0D8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ring-poster__city {
    writing-mode: vertical-rl;
    font-size: clamp(44px, 3.6vw, 64px);
    font-weight: 500;
    letter-spacing: 0.32em;
    color: rgba(17, 17, 17, 0.78);
}

.ring-poster__index {
    position: absolute;
    left: 16px;
    top: 14px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.16em;
    color: var(--muted);
}

.ring-poster__label {
    position: absolute;
    left: 16px;
    bottom: 14px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.16em;
    color: var(--muted);
    text-transform: uppercase;
}

.ring-work__desc {
    overflow-wrap: anywhere;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    font-size: 13px;
    line-height: 1.85;
    color: #50504B;
    min-height: 84px;
}

/* right — the ring */
.ring-stage {
    --ring-radius: 220px;
    position: relative;
    width: min(100%, 710px);
    aspect-ratio: 1;
    margin-inline: auto;
}

.ring-stage__circles {
    position: absolute;
    inset: 4%;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
}

.ring-stage__circles::before {
    content: "";
    position: absolute;
    inset: 7%;
    border: 1px dashed rgba(0, 0, 0, 0.08);
    border-radius: 50%;
}

.ring-stage__circles::after {
    content: "";
    position: absolute;
    inset: 27%;
    border: 1px solid rgba(0, 0, 0, 0.07);
    border-radius: 50%;
}

.ring-stage__pointer {
    position: absolute;
    left: -1%;
    top: 50%;
    width: 22%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent));
    z-index: 8;
}

.ring-stage__pointer::after {
    content: "";
    position: absolute;
    right: -6px;
    top: -5.5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bg-paper);
    border: 2px solid var(--accent);
}

.ring-wheel {
    position: absolute;
    inset: 4%;
    border-radius: 50%;
    transition: transform 1100ms cubic-bezier(0.65, 0.04, 0.2, 1);
    will-change: transform;
}

.ring-node {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 150px;
    height: 56px;
    margin-left: -75px;
    margin-top: -28px;
    transform:
        rotate(var(--angle))
        translateX(var(--ring-radius))
        rotate(calc(-1 * var(--angle)));
}

.ring-node__inner {
    transition: transform 1100ms cubic-bezier(0.65, 0.04, 0.2, 1);
    will-change: transform;
}

.ring-node button {
    width: 100%;
    min-height: 52px;
    padding: 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    color: #9A9A94;
    transition: color 300ms var(--ease);
}

.ring-node button:hover {
    color: var(--ink);
}

.ring-node__dot {
    flex: none;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    border: 1px solid currentColor;
    transition: background-color 300ms var(--ease), border-color 300ms var(--ease);
}

.ring-node__city {
    font-size: 15px;
    letter-spacing: 0.02em;
    white-space: nowrap;
    transition: font-size 300ms var(--ease), font-weight 300ms var(--ease);
}

.ring-node__province {
    display: block;
    margin-top: 3px;
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.1em;
    color: var(--faint);
}

.ring-node.is-active button {
    color: var(--ink);
}

.ring-node.is-active .ring-node__dot {
    background: var(--accent);
    border-color: var(--accent);
}

.ring-node.is-active .ring-node__city {
    font-size: 18px;
    font-weight: 600;
}

/* centre — fixed chapter title */
.ring-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 36%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--accent);
    color: #F4F4F0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow:
        0 0 0 10px var(--bg-paper),
        0 0 0 11px var(--accent-soft);
    text-decoration: none;
    cursor: pointer;
    transition:
        transform 300ms var(--ease),
        box-shadow 300ms var(--ease),
        filter 300ms var(--ease);
}

.ring-center:hover {
    transform: translate(-50%, -50%) scale(1.025);
    filter: brightness(1.06);
    box-shadow:
        0 0 0 10px var(--bg-paper),
        0 0 0 11px var(--accent-soft),
        0 14px 34px rgba(31, 91, 66, 0.2);
}

.ring-center:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 7px;
}

.ring-center small {
    display: block;
    font-size: 9px;
    letter-spacing: 0.2em;
    opacity: 0.62;
    margin-bottom: 10px;
}

.ring-center strong {
    display: block;
    font-size: clamp(17px, 1.8vw, 25px);
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0.06em;
}

.ring-center__sub {
    display: block;
    margin-top: 10px;
    font-size: 9px;
    letter-spacing: 0.14em;
    opacity: 0.62;
}

/* reading label + controls */
.ring-reading {
    position: absolute;
    right: 3%;
    top: 12%;
    z-index: 9;
    text-align: left;
}

.ring-reading .mono {
    display: block;
    font-size: 10px;
    letter-spacing: 0.16em;
    color: var(--muted);
    padding-bottom: 10px;
    margin-bottom: 8px;
    border-bottom: 1px solid transparent;
    position: relative;
}

.ring-reading .mono::before {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 28px;
    height: 1px;
    background: var(--accent);
}

.ring-reading strong {
    display: block;
    font-size: 17px;
    font-weight: 500;
}

.ring-controls {
    position: absolute;
    right: 2%;
    bottom: 1%;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 20;
}

.ring-controls button {
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--bg-paper);
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    transition: border-color 300ms var(--ease), color 300ms var(--ease);
}

.ring-controls button:hover {
    border-color: var(--line-strong);
}

.ring-controls__play {
    width: auto;
    padding: 0 16px;
    border-radius: 100px;
    font-size: 10px;
    letter-spacing: 0.14em;
}

/* responsive */
@media (max-width: 1080px) {
    .ring-layout {
        gap: clamp(32px, 5vw, 64px);
    }

    .ring-stage {
        width: min(100%, 540px);
    }
}

@media (max-width: 960px) {
    .ring-layout {
        grid-template-columns: 1fr;
        gap: 48px;
    }

    .ring-stage {
        width: min(92vw, 580px);
    }

    .ring-reading {
        display: none;
    }
}

@media (max-width: 620px) {
    .ring-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .ring-work__changing {
        width: min(100%, 320px);
    }

    .ring-stage {
        width: min(100%, 430px);
    }

    .ring-node {
        width: 108px;
        height: 48px;
        margin-left: -54px;
        margin-top: -24px;
    }

    .ring-node__city {
        font-size: 12px;
    }

    .ring-node.is-active .ring-node__city {
        font-size: 14px;
    }

    .ring-node__province {
        display: none;
    }

    .ring-controls {
        right: 50%;
        transform: translateX(50%);
        bottom: -9%;
    }

    .ring-center strong {
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ring-wheel,
    .ring-node__inner,
    .ring-work__changing,
    .ring-center {
        transition: none !important;
    }
}

/* 14. Aurora — 02, pinned crystal scroll story -------------------------------- */

.aurora-scene {
    position: relative;
    height: 180vh;
    border-top: 1px solid var(--line);
    background: var(--bg-paper);
}

.aurora-sticky {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    background:
        radial-gradient(circle at 72% 50%, rgba(126, 245, 224, 0.09), transparent 22%),
        radial-gradient(circle at 84% 30%, rgba(134, 167, 255, 0.09), transparent 24%),
        radial-gradient(circle at 62% 74%, rgba(196, 167, 255, 0.05), transparent 26%),
        var(--bg-paper);
}

.aurora-halo {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.aurora-ghost {
    position: absolute;
    right: -2vw;
    bottom: -3vw;
    font-size: clamp(120px, 16vw, 280px);
    font-weight: 600;
    line-height: 0.8;
    letter-spacing: -0.06em;
    color: rgba(0, 0, 0, 0.025);
    pointer-events: none;
    user-select: none;
}

.aurora-copy {
    position: absolute;
    z-index: 10;
    left: var(--gutter);
    top: 50%;
    transform: translateY(-50%);
    width: min(38vw, 560px);
}

.aurora-eyebrow {
    font-family: var(--font-mono);
    font-size: var(--t-meta);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 26px;
}

.aurora-brand {
    margin: 0;
    font-size: clamp(40px, 4.4vw, 72px);
    font-weight: 500;
    line-height: 1.05;
    letter-spacing: -0.01em;
}

.aurora-headline {
    margin: 18px 0 0;
    font-size: clamp(30px, 3.6vw, 58px);
    font-weight: 500;
    line-height: 1.14;
    letter-spacing: -0.01em;
}

.aurora-desc {
    max-width: 42ch;
    margin: 26px 0 0;
    font-size: var(--t-lede);
    line-height: 1.8;
    color: var(--muted);
}

.aurora-enter {
    margin-top: 36px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 13px 20px;
    border: 1px solid rgba(0, 0, 0, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.42);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-family: var(--font-mono);
    font-size: var(--t-index);
    letter-spacing: 0.16em;
    color: var(--ink);
    transition: background-color 400ms var(--ease), border-color 400ms var(--ease);
}

.aurora-enter:hover {
    background: rgba(255, 255, 255, 0.72);
    border-color: rgba(0, 0, 0, 0.3);
}

.aurora-enter svg {
    transition: transform 500ms var(--ease);
}

.aurora-enter:hover svg {
    transform: translate(3px, -3px);
}

/* stage + labels */
.aurora-stage {
    position: absolute;
    z-index: 5;
    left: 39%;
    right: 0;
    top: 8%;
    bottom: 9%;
}

.aurora-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.aurora-label {
    position: absolute;
    z-index: 12;
    transform: translate(-50%, -50%) scale(0.85);
    padding: 8px 12px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    white-space: nowrap;
    color: rgba(17, 17, 17, 0.78);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(11px);
    -webkit-backdrop-filter: blur(11px);
    opacity: 0;
    pointer-events: auto;
    transition: opacity 350ms var(--ease), transform 350ms var(--ease), border-color 300ms var(--ease);
}

.aurora-label:hover {
    border-color: rgba(0, 0, 0, 0.32);
}

.aurora-label.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* phase / status / progress */
.aurora-status {
    position: absolute;
    z-index: 20;
    top: calc(var(--header-h) + 22px);
    right: var(--gutter);
    font-size: 11px;
    letter-spacing: 0.16em;
    color: var(--muted);
}

.aurora-phase {
    position: absolute;
    z-index: 20;
    left: var(--gutter);
    bottom: 26px;
    font-size: 11px;
    letter-spacing: 0.16em;
    color: var(--muted);
}

.aurora-hint {
    position: absolute;
    z-index: 20;
    right: var(--gutter);
    bottom: 26px;
    font-size: 10px;
    letter-spacing: 0.14em;
    color: var(--faint);
}

.aurora-progress {
    position: absolute;
    z-index: 20;
    left: var(--gutter);
    right: var(--gutter);
    bottom: 14px;
    height: 1px;
    background: rgba(0, 0, 0, 0.1);
}

.aurora-progress i {
    display: block;
    width: 0%;
    height: 100%;
    background: var(--ink);
}

/* responsive */
@media (max-width: 1080px) {
    .aurora-scene {
        height: 180vh;
    }

    .aurora-copy {
        width: min(46vw, 460px);
    }

    .aurora-stage {
        left: 44%;
    }
}

@media (max-width: 960px) {
    .aurora-scene {
        height: 160vh;
    }

    .aurora-sticky {
        height: 100svh;
    }

    .aurora-copy {
        left: 22px;
        right: 22px;
        top: calc(var(--header-h) + 26px);
        transform: none;
        width: auto;
    }

    .aurora-brand {
        font-size: clamp(34px, 9vw, 46px);
    }

    .aurora-headline {
        font-size: clamp(26px, 7.4vw, 38px);
    }

    .aurora-desc {
        max-width: 34ch;
        margin-top: 18px;
        font-size: 14px;
    }

    .aurora-enter {
        margin-top: 22px;
    }

    .aurora-stage {
        left: 0;
        right: 0;
        top: 340px;
        bottom: 64px;
    }

    .aurora-label {
        font-size: 9px;
        padding: 6px 9px;
    }

    .aurora-hint {
        display: none;
    }

    .aurora-ghost {
        font-size: 26vw;
    }
}

@media (max-width: 620px) {
    .aurora-stage {
        top: 325px;
    }

    .aurora-status {
        right: 22px;
    }

    .aurora-phase {
        left: 22px;
    }

    .aurora-progress {
        left: 22px;
        right: 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .aurora-scene {
        height: auto;
    }

    .aurora-sticky {
        position: relative;
        height: 92vh;
        min-height: 640px;
    }

    .aurora-label {
        transition: none;
    }
}

/* contact email — revealed by the closing call to action */
.connect-contact__email {
    margin-top: 22px;
    max-width: 460px;
    display: grid;
    gap: 7px;
}

.connect-contact__email[hidden] {
    display: none;
}

.connect-contact__email p {
    margin: 0;
    font-size: 13px;
    color: var(--inverse-muted);
}

.connect-contact__email a {
    width: fit-content;
    font-family: var(--font-mono);
    font-size: 16px;
    color: var(--inverse);
    border-bottom: 1px solid var(--line-inverse-strong);
    padding-bottom: 2px;
    transition: border-color 250ms var(--ease);
}

.connect-contact__email a:hover {
    border-color: var(--inverse);
}

/* ring head description */
.ring-head__desc {
    margin: 0;
    font-size: var(--t-lede);
    color: var(--muted);
    max-width: 40ch;
}

@media (max-width: 620px) {
    .ring-head {
        flex-direction: column;
        align-items: flex-start;
    }
}
