/* /v5/security: cipher-field hero, scroll manifesto, defense-in-depth rings, marquee (driven by v5-security.js).
   Rules of the page: nothing is shown and then replaced while loading — the canvas and the rings are hidden until
   their first frame is drawn, then shown once; reduced motion gets every final state with no movement. */

/* ---- Hero ---- */
.cipher-hero { position: relative; min-height: 100vh; min-height: 100svh; min-height: calc(var(--svh-lock, 1svh) * 100); display: grid; place-items: center; overflow: hidden; background: var(--ink); }
.cipher-hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; transition: opacity 1.2s ease; }
.js .cipher-hero:not(.is-ready) canvas { opacity: 0; }
.cipher-veil { position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(ellipse 46% 42% at 50% 52%, rgba(10,14,26,0.92) 0%, rgba(10,14,26,0.7) 45%, transparent 80%),
                linear-gradient(180deg, rgba(10,14,26,0.6), transparent 22%, transparent 78%, var(--ink)); }
.cipher-copy { position: relative; text-align: center; display: grid; justify-items: center; padding-top: 4rem; pointer-events: none; }
.cipher-copy h1 { font-size: clamp(2.6rem, 7.2vw, 6.6rem); line-height: 1.08; margin: 1.4rem 0 1.4rem; }
.cipher-copy h1 em { font-style: normal; color: var(--gold); text-shadow: 0 0 40px rgba(235,162,78,0.35); }
.cipher-copy p { color: var(--on-dark-2); font-size: clamp(1rem, 1.5vw, 1.18rem); }
.cipher-hint { margin-top: 2.6rem; color: rgba(185,204,245,0.6); font-size: 0.7rem; }
@media (hover: none) { .cipher-hint { display: none; } }

/* ---- Manifesto ---- */
.manifesto { padding: clamp(6rem, 14vw, 11rem) 0; }
/* lead states the fact quietly; the two-line punchline lights up as it scrolls by and lands on the gold word */
.manifesto .container { display: grid; justify-items: center; text-align: center; }
.mf-lead { margin-top: 2rem; max-width: 34rem; text-wrap: balance; color: var(--on-dark-2); font-size: clamp(1.1rem, 1.8vw, 1.4rem); line-height: 1.7; }
.mf-text { margin: 1.6rem auto 0; font-family: var(--serif); font-weight: 900; font-size: clamp(2.6rem, 6.4vw, 5.6rem); line-height: 1.3; }
.mf-c { color: rgba(245,247,251,0.14); transition: color 0.25s linear, text-shadow 0.6s ease; }
.mf-c.on { color: #fff; }
.mf-c.mf-em.on { color: var(--gold); text-shadow: 0 0 40px rgba(235,162,78,0.45); }
.no-js-motion .mf-c, html:not(.js) .mf-c { color: #fff; }
.no-js-motion .mf-c.mf-em, html:not(.js) .mf-c.mf-em { color: var(--gold); }
.mf-sub { margin: 2.4rem auto 0; max-width: 34rem; text-align: center; color: var(--on-dark-2); line-height: 1.9; font-size: 1.05rem; }

/* ---- Defense in depth ---- */
.depth { position: relative; height: 520vh; height: 520svh; height: calc(var(--svh-lock, 1svh) * 520); }
.depth-sticky { position: sticky; top: 0; height: 100vh; height: 100svh; height: calc(var(--svh-lock, 1svh) * 100); display: grid; align-items: center; overflow: hidden; }
.depth-grid { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: clamp(2rem, 5vw, 5rem); align-items: center; }
.depth-copy h2 { font-family: var(--serif); font-weight: 900; font-size: clamp(2rem, 4vw, 3.6rem); line-height: 1.18; margin: 1.2rem 0 2rem; }
.depth-copy h2 em { font-style: normal; color: var(--gold); }
.depth-steps { list-style: none; margin: 0; padding: 0; display: grid; }
.depth-step { grid-area: 1 / 1; transition: opacity 0.3s ease; }
/* The step change has to be noticed: the old step leaves upward, the new one rises in from below, the number,
   title and text arriving one after another. Upcoming steps wait below, past ones above (is-past, v5-security.js). */
.depth-step > * { transition: transform 0.35s cubic-bezier(0.4, 0, 1, 1), filter 0.35s ease; }
.js .depth-step { opacity: 0; pointer-events: none; }
.js .depth-step > * { transform: translateY(44px); filter: blur(6px); }
.js .depth-step.is-past > * { transform: translateY(-44px); }
.js .depth-step.is-on { opacity: 1; transition: opacity 0.4s ease 0.12s; }
.js .depth-step.is-on > * { transform: none; filter: none; transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1), filter 0.5s ease; }
.js .depth-step.is-on > .ds-n { transition-delay: 0.12s; }
.js .depth-step.is-on > h3 { transition-delay: 0.2s; }
.js .depth-step.is-on > p { transition-delay: 0.28s; }
html:not(.js) .depth-steps { gap: 1.4rem; }
html:not(.js) .depth-step { grid-area: auto; }
.ds-n { display: block; font-family: var(--serif); font-weight: 900; font-size: clamp(3rem, 5.5vw, 4.6rem); line-height: 1; letter-spacing: 0.02em;
    color: transparent; -webkit-text-stroke: 1.5px var(--gold); text-shadow: 0 0 28px rgba(235,162,78,0.35); }
.depth-step h3 { font-family: var(--serif); font-size: clamp(1.5rem, 2.4vw, 2.1rem); margin: 0.5rem 0 0.6rem; color: #fff; }
.depth-step p { color: var(--on-dark-2); line-height: 1.8; max-width: 26rem; }

.depth-stage { position: relative; justify-self: center; width: min(600px, 100%); }
.depth-svg { display: block; width: 100%; height: auto; overflow: visible; }
.js .depth:not(.is-ready) .depth-svg { visibility: hidden; }
.ring { transform-origin: 300px 300px; }
.ring-track { fill: none; stroke: rgba(130,160,230,0.10); stroke-width: 1; }
.ring-draw { fill: none; stroke: var(--gold); stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: calc(1 - var(--d, 0)); opacity: 0.45;
    transform: rotate(-90deg); transform-origin: 300px 300px; transition: opacity 0.4s ease, stroke-width 0.4s ease; }
.ring.is-on .ring-draw { opacity: 1; stroke-width: 2.4; filter: drop-shadow(0 0 6px rgba(235,162,78,0.7)); }
.ring-path { fill: none; }
.ring-label { font-size: 9.5px; letter-spacing: 0.22em; fill: rgba(185,204,245,0.35); transition: fill 0.4s ease; font-family: var(--mono); }
.ring.is-done .ring-label { fill: rgba(235,162,78,0.55); }
.ring.is-on .ring-label { fill: var(--gold); }
/* finished rings drift slowly, alternating direction */
.ring.is-done { animation: ring-spin calc(60s + var(--k) * 8s) linear infinite; }
.ring.is-done:nth-child(even) { animation-direction: reverse; }
@keyframes ring-spin { to { transform: rotate(360deg); } }
.core-disc { fill: #0D1426; stroke: rgba(235,162,78,0.6); stroke-width: 1.5; }
.core-lock { fill: none; stroke: var(--gold); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.core-text { fill: #fff; font-size: 13px; text-anchor: middle; letter-spacing: 0.15em; font-weight: 700; }
.depth.is-complete .core-disc { stroke: var(--gold); filter: drop-shadow(0 0 14px rgba(235,162,78,0.8)); }
.depth-count { position: absolute; right: 0; bottom: 0; color: var(--on-dark-2); font-size: 0.8rem; }
.depth-count b { color: var(--gold); font-weight: 500; }

/* ---- Marquee ---- */
.sec-marquee { overflow: hidden; padding: clamp(2rem, 5vw, 4rem) 0; border-top: 1px solid var(--line-dark); border-bottom: 1px solid var(--line-dark); margin-bottom: clamp(4rem, 9vw, 7rem); }
.sm-track { display: flex; width: max-content; animation: sm-run 40s linear infinite; }
.sm-group { display: flex; }
/* solid sans, white and gold alternating (an outlined serif let the strokes cross over each other) */
.sm-item { display: inline-flex; align-items: center; gap: 0.5em; padding: 0 0.9em; white-space: nowrap; font-family: 'Noto Sans TC', system-ui, sans-serif; font-weight: 900; font-size: clamp(2rem, 5vw, 4.4rem); letter-spacing: 0.02em; color: #fff; }
.sm-item:nth-child(even) { color: var(--gold); }
.sm-dot { color: var(--gold); width: 0.42em; height: 0.42em; flex: none; }
@keyframes sm-run { to { transform: translateX(-50%); } }

/* ---- Ownership ---- */
.own-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1px solid var(--line-dark-2); }
.own { padding: 2rem 1.6rem 0 0; border-right: 1px solid var(--line-dark); }
.own + .own { padding-left: 1.6rem; }
.own:last-child { border-right: 0; }
.own-n { display: block; font-family: var(--serif); font-weight: 900; font-size: 3.4rem; line-height: 1; color: transparent; -webkit-text-stroke: 1px rgba(235,162,78,0.55); margin-bottom: 1.2rem; }
.own h3 { font-family: var(--serif); font-size: 1.35rem; margin-bottom: 0.6rem; color: #fff; }
.own p { color: var(--on-dark-2); line-height: 1.8; }
.sec-cta5 .hero-cta { justify-content: center; }

@media (max-width: 900px) {
    .depth { height: 480vh; height: 480svh; height: calc(var(--svh-lock, 1svh) * 480); }
    .depth-grid { grid-template-columns: 1fr; gap: 1rem; }
    .depth-stage { order: -1; width: min(78vw, 46svh); width: min(78vw, calc(var(--svh-lock, 1svh) * 46)); }
    .depth-copy h2 { font-size: 1.6rem; margin: 0.8rem 0 1rem; }
    .depth-copy h2 br { display: none; }
    .ds-n { font-size: 2.4rem; }
    .depth-step h3 { font-size: 1.35rem; }
    .depth-step p { font-size: 0.95rem; }
    .own-grid { grid-template-columns: 1fr; }
    .own, .own + .own { padding: 1.6rem 0; border-right: 0; border-bottom: 1px solid var(--line-dark); }
}
@media (prefers-reduced-motion: reduce) {
    .sm-track, .ring.is-done { animation: none; }
    .depth-step, .depth-step > *, .ring-draw, .mf-c { transition: none !important; }
    .js .depth-step > * { transform: none; filter: none; }
}
