/*
 * Flex Education: late-90s RPG menus, rebuilt for now.
 *
 * Every panel is a .win: a gradient "window" with a bevelled silver frame.
 * The four corner colours are custom properties (--w-tl … --w-br) that the
 * Config window lets people remix, and ::before blends them bilinearly.
 */

:root {
    --w-tl: rgb(0, 88, 184);
    --w-tr: rgb(0, 40, 128);
    --w-bl: rgb(0, 32, 112);
    --w-br: rgb(0, 0, 48);

    --void: #05061a;
    --ink: #f4f5fb;
    --muted: #b9c0e0;
    --cyan: #74d8ff;
    --mako: #a8ff8f;
    --mako-deep: #2fd16a;
    --pink: #ff8fb4;
    --gold: #ffd76a;
    --frame-hi: #eef0f8;
    --frame-mid: #b8bccf;
    --frame-lo: #6d7190;

    --pixel: "Pixelify Sans", ui-monospace, monospace;
    --display: "Jersey 10", "Pixelify Sans", ui-monospace, monospace;
    --shadow-text: 2px 2px 0 rgba(0, 0, 20, .7);
    --radius: 9px;
    --side: 240px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font: 400 18px/1.55 var(--pixel);
    background-color: var(--void);
    background-image:
        radial-gradient(1200px 700px at 15% -10%, rgba(40, 70, 220, .28), transparent 60%),
        radial-gradient(900px 600px at 110% 110%, rgba(47, 209, 106, .12), transparent 60%),
        linear-gradient(rgba(110, 130, 255, .07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(110, 130, 255, .07) 1px, transparent 1px);
    background-size: auto, auto, 64px 64px, 64px 64px;
    background-attachment: fixed;
    -webkit-font-smoothing: none;
    /* Pixelify's "fi" ligature draws as a single odd glyph. */
    font-variant-ligatures: none;
    font-feature-settings: "liga" 0, "clig" 0;
    overflow-x: hidden;
}
input, button { font-variant-ligatures: none; font-feature-settings: "liga" 0, "clig" 0; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--cyan); text-underline-offset: 4px; text-decoration-thickness: 2px; }
a:hover { color: var(--mako); }
:focus-visible { outline: 2px dashed var(--gold); outline-offset: 4px; }
::selection { background: var(--mako); color: var(--void); }

h1, h2, h3 { font-family: var(--pixel); font-weight: 600; line-height: 1.12; margin: 0 0 .5em; text-shadow: var(--shadow-text); }
h1 { font-size: clamp(2rem, 4.4vw, 3.2rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); }
h3 { font-size: 1.1rem; font-weight: 500; }
p { margin: 0 0 1em; text-shadow: var(--shadow-text); }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -9999px; z-index: 50; }
.skip:focus { left: 16px; top: 16px; padding: 8px 14px; background: var(--ink); color: var(--void); }
.muted { color: var(--muted); }
.eyebrow { font-size: .78rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--cyan); margin-bottom: .9em; }
.lead { font-size: 1.12rem; color: #e3e7f7; max-width: 38em; }
.label { color: var(--cyan); font-weight: 600; }
.value { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── Background layers ───────────────────────────────────────────── */

.lifestream {
    position: fixed; inset: 0; z-index: -1;
    width: 100vw; height: 100vh;
    image-rendering: pixelated;
    pointer-events: none;
}
.crt {
    position: fixed; inset: 0; z-index: 40; pointer-events: none;
    background:
        repeating-linear-gradient(to bottom, rgba(0, 0, 0, .16) 0 1px, transparent 1px 3px),
        radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 10, .45) 100%);
    mix-blend-mode: multiply;
}
.no-crt .crt { display: none; }

/* ── Windows ─────────────────────────────────────────────────────── */

.win {
    position: relative;
    isolation: isolate;
    padding: 28px 32px;
    border-radius: var(--radius);
    background: linear-gradient(to right, var(--w-tl), var(--w-tr));
    border: 3px solid;
    border-color: var(--frame-hi) var(--frame-mid) var(--frame-lo) var(--frame-hi);
    box-shadow:
        inset 0 0 0 1px rgba(0, 0, 20, .55),
        0 0 0 1px rgba(0, 0, 0, .6),
        0 18px 40px -18px rgba(0, 0, 0, .8);
}
/* Bottom edge colours, faded in from the top: a four-corner blend. */
.win::before {
    content: "";
    position: absolute; inset: 0; z-index: -1;
    border-radius: inherit;
    background: linear-gradient(to right, var(--w-bl), var(--w-br));
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000);
    mask-image: linear-gradient(to bottom, transparent, #000);
}
/* The modern bit: a soft glass sheen across the top. */
.win::after {
    content: "";
    position: absolute; inset: 0; z-index: -1;
    border-radius: inherit;
    background: linear-gradient(170deg, rgba(255, 255, 255, .1), transparent 38%);
    pointer-events: none;
}

/* Windows open from a line across their middle, in a few chunky steps. */
.js .reveal { clip-path: inset(49% 0 49% 0 round var(--radius)); }
.js .reveal.is-open { animation: win-open .26s steps(6, end) forwards; }
@keyframes win-open {
    from { clip-path: inset(49% 0 49% 0 round var(--radius)); }
    to { clip-path: inset(0 0 0 0 round var(--radius)); }
}
.js .reveal.is-done { clip-path: none; animation: none; }

.dialogue {
    position: relative;
    padding: 18px 22px 20px;
    border-radius: 7px;
    background: linear-gradient(180deg, rgba(0, 8, 40, .55), rgba(0, 0, 20, .6));
    border: 2px solid rgba(238, 240, 248, .55);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, .06);
}
.dialogue p:last-of-type { margin-bottom: 0; }
.speaker { color: var(--cyan); font-weight: 600; margin-bottom: .35em; }
.dialogue-next {
    position: absolute; right: 16px; bottom: 10px;
    width: 12px; height: 8px;
    background: var(--ink);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    animation: nudge 1s steps(2) infinite;
}
@keyframes nudge { 50% { transform: translateY(3px); } }

/* ── Shell ───────────────────────────────────────────────────────── */

.shell {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--side);
    grid-template-areas: "top side" "main side" "foot foot";
    gap: 20px 24px;
}
.topbar { grid-area: top; display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; }
.stage { grid-area: main; display: grid; gap: 24px; min-width: 0; }
.side { grid-area: side; position: sticky; top: 24px; align-self: start; display: grid; gap: 14px; z-index: 20; }
.footer { grid-area: foot; }

.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 1.2rem; text-shadow: var(--shadow-text); }
.brand:hover { color: var(--ink); }
.brand img { display: block; flex: none; }

.menu-toggle { display: none; }

/* Command menu */
.command { padding: 18px 16px 18px 46px; }
.command ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.command-system { margin-top: 18px !important; }
.command a, .command button {
    display: block; width: 100%;
    padding: 3px 0;
    font: 500 1.15rem/1.4 var(--pixel);
    color: var(--ink); text-decoration: none; text-align: left; text-shadow: var(--shadow-text);
    background: none; border: 0; cursor: pointer;
}
.command a:hover, .command button:hover { color: #fff; }
.command a[aria-current="page"] { color: var(--gold); }
.command :focus-visible { outline: none; }

.status-box { padding: 14px 18px; display: grid; gap: 2px; }
.status-box p { display: flex; justify-content: space-between; margin: 0; font-size: 1.05rem; }
.status-box .value { color: var(--ink); }
.status-box .pop { position: absolute; right: 18px; bottom: 34px; color: var(--mako); font-weight: 600; animation: pop .9s ease-out forwards; }
@keyframes pop { to { transform: translateY(-22px); opacity: 0; } }

.location { padding: 12px 18px; font-size: 1.05rem; font-weight: 500; }
.location span { display: inline-block; }
.location .swap { animation: flicker .3s steps(3); }
@keyframes flicker { 0% { opacity: 0; } 50% { opacity: 1; } 75% { opacity: .2; } 100% { opacity: 1; } }

/* The pointing hand */
.hand {
    position: fixed; left: 0; top: 0; z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: transform .09s ease-out, opacity .12s;
    filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, .55));
}
.hand.on { opacity: 1; }
.hand svg { display: block; animation: point .7s steps(2) infinite; }
@keyframes point { 50% { transform: translateX(-4px); } }

/* ── Buttons ─────────────────────────────────────────────────────── */

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 12px 22px;
    font: 600 1rem/1.2 var(--pixel);
    color: var(--ink); text-decoration: none; text-shadow: var(--shadow-text);
    background: linear-gradient(180deg, #2c5bd6, #0b2172);
    border: 3px solid; border-color: var(--frame-hi) var(--frame-mid) var(--frame-lo) var(--frame-hi);
    border-radius: 7px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .6), 0 6px 0 -2px rgba(0, 0, 0, .45);
    cursor: pointer;
    transition: transform .08s steps(2), filter .15s;
}
.btn:hover { color: #fff; filter: brightness(1.18); }
.btn:active { transform: translateY(2px); }
.btn-go { background: linear-gradient(180deg, #c8ffb6, var(--mako) 45%, #5fd86a); color: #061226; text-shadow: none; }
.btn-go:hover { color: #061226; }
.cmd-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 26px; }

/* ── Hero ────────────────────────────────────────────────────────── */

.hero { container-type: inline-size; display: grid; gap: 24px; }
.mega {
    margin: 0 0 4px;
    font: 400 14cqi/0.9 var(--display); /* "Expert mobility" takes about 80% of the column */
    text-transform: uppercase;
    letter-spacing: .01em;
    color: var(--mako);
    text-shadow: .045em .045em 0 rgba(0, 10, 60, .85), 0 0 .5em rgba(168, 255, 143, .18);
}
/* Fixed-height rows that never wrap, so the scrambling intro (and the web
   font arriving) cannot change the headline's height and nudge the page. */
.mega-row { display: flex; flex-wrap: nowrap; align-items: baseline; gap: 0 .28em; height: .9em; white-space: nowrap; }
.mega-row > span { display: inline-block; flex: none; }
.mega-tag {
    margin: 10px 0 0;
    font: 500 .85rem/1.3 var(--pixel);
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--cyan);
    text-shadow: var(--shadow-text);
}
.mega-accent { color: #fff; text-shadow: .045em .045em 0 rgba(0, 10, 60, .85), 0 0 .6em rgba(116, 216, 255, .5); }

.hero-grid { display: grid; grid-template-columns: 1fr 1.05fr; gap: 24px; align-items: stretch; }
.hero-copy { display: flex; flex-direction: column; justify-content: center; }
.hero-copy .lead { margin-bottom: 0; }

.party { display: grid; gap: 18px; align-content: start; }
.member { display: grid; grid-template-columns: 92px 1fr; gap: 6px 18px; align-items: start; }
.portrait { position: relative; width: 92px; aspect-ratio: 1; border: 2px solid rgba(238, 240, 248, .7); border-radius: 4px; overflow: hidden; background: #fffcf8; }
.portrait img, .app-icon img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.portrait-pixel { image-rendering: pixelated; }
.portrait-hd { opacity: 0; transition: opacity .35s steps(5); }
.party:hover .portrait-hd, .app-head:hover .portrait-hd { opacity: 1; }
.member-name { font-size: 1.25rem; font-weight: 600; margin: 0 0 4px; }
.stat { display: flex; justify-content: space-between; gap: 12px; margin: 0; font-size: 1.05rem; max-width: 200px; }
.stat-line { padding-bottom: 2px; border-bottom: 2px solid; border-image: linear-gradient(90deg, transparent, #4b8dff 30%) 1; }
.stat-mp { border-image: linear-gradient(90deg, transparent, #44e08a 30%) 1; }
.meters { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: center; margin-top: 10px; }
.meters p { margin: 0; font-size: .95rem; }
.meter {
    display: block; height: 10px;
    background: #3a3d52;
    border: 2px solid; border-color: #9ca0b8 #e2e4ee #e2e4ee #9ca0b8;
    border-radius: 2px;
    overflow: hidden;
}
.meter-fill { display: block; height: 100%; width: calc(var(--v) * 100%); background: linear-gradient(180deg, #ffd0de, var(--pink) 50%, #c95b80); }
.meter-fill-alt { background: linear-gradient(180deg, #d6fff0, #5ce0b0 50%, #24936a); }
.js .meter-fill { width: 0; transition: width 1.1s steps(22) .25s; }
.js .is-open .meter-fill, .js .is-done .meter-fill { width: calc(var(--v) * 100%); }

[data-type].typing::after {
    content: "";
    display: inline-block; width: .5em; height: 1em;
    margin-left: 2px; vertical-align: -.12em;
    background: var(--ink);
    animation: blink .6s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.scroll-hint {
    justify-self: center;
    display: inline-flex; flex-direction: column; align-items: center; gap: 6px;
    color: var(--muted); text-decoration: none; font-size: .8rem; letter-spacing: .2em; text-transform: uppercase;
}
.scroll-hand { transform: rotate(90deg) scale(1.4); margin: 10px 0 6px; filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, .55)); }
.scroll-hand svg { animation: point .7s steps(2) infinite; }

/* ── Sections ────────────────────────────────────────────────────── */

.section { padding: 40px 44px; }
.two-col { display: grid; grid-template-columns: .75fr 1.25fr; gap: 40px; }
.prose { max-width: 44em; color: #e3e7f7; }
.prose strong { color: #fff; }

.app-head { display: flex; gap: 28px; align-items: flex-start; }
.app-icon { position: relative; flex: none; width: 104px; aspect-ratio: 1; border-radius: 22px; overflow: hidden; border: 3px solid var(--frame-hi); box-shadow: 0 0 0 1px #000, 0 0 30px rgba(168, 255, 143, .25); background: #fffcf8; }
.app-head .lead { margin-bottom: 0; }
.blink-dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; background: var(--mako); box-shadow: 0 0 8px var(--mako); animation: blink 1s steps(2) infinite; vertical-align: 1px; }

/* The party: one status card each. A row per person when there's room, like the old menu screen. */
.party-section { display: grid; gap: 24px; }
.party-grid { display: grid; gap: 20px; container-type: inline-size; }
.member-card {
    display: grid; gap: 14px 18px; align-items: start;
    grid-template-columns: 96px minmax(0, 1fr);
    grid-template-areas: "portrait vitals" "meters meters" "sheet sheet";
    padding: 22px 22px 20px;
}
.member-portrait {
    grid-area: portrait;
    position: relative; width: 96px; aspect-ratio: 1;
    border: 2px solid rgba(238, 240, 248, .7); border-radius: 4px;
    background: radial-gradient(circle at 50% 40%, rgba(168, 255, 143, .35), transparent 70%), #0a0d33;
    overflow: hidden;
}
.member-portrait img { position: absolute; inset: 0; width: 100%; height: 100%; }
.member-portrait .pump { opacity: 0; }
/* Now and then each of us flexes harder; hovering holds the pose. */
.js .member-portrait .pump { animation: pump 3.3s steps(1) var(--pump-delay, 0s) infinite; }
@keyframes pump { 0%, 82% { opacity: 0; } 83%, 100% { opacity: 1; } }
.member-card:hover .pump, .member-card:focus-within .pump { opacity: 1; animation: none; }
.member-vitals { grid-area: vitals; }
.member-vitals .stat { max-width: none; }
.member-name { margin: 0; font-size: 1.2rem; font-weight: 600; }
.member-class { margin: 0 0 6px; color: var(--gold); font-size: .85rem; letter-spacing: .06em; }
.member-meters { grid-area: meters; margin-top: 0; }
.member-sheet { grid-area: sheet; display: grid; gap: 8px; }
.member-stats { margin: 0; display: grid; gap: 2px; }
.member-stats div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border-bottom: 1px dashed rgba(238, 240, 248, .16); }
.member-stats dt { color: var(--cyan); }
.member-stats dd { margin: 0; font-weight: 600; text-align: right; text-shadow: var(--shadow-text); }
.member-extra { display: flex; justify-content: space-between; gap: 12px; margin: 0; font-size: .95rem; }
.member-extra span:last-child { text-align: right; }
.label-gold { color: var(--gold); }

@container (min-width: 700px) {
    .member-card {
        grid-template-columns: 144px minmax(0, 1fr) minmax(0, 1.15fr);
        grid-template-areas: "portrait vitals sheet" "portrait meters sheet";
        gap: 12px 28px;
        padding: 24px 28px;
    }
    .member-portrait { width: 144px; }
}

/* Materia (features) */
.materia-help { display: none; }
.js .materia-help { display: flex; gap: 18px; align-items: center; min-height: 104px; margin-bottom: 22px; }
.materia-help .orb { width: 44px; height: 44px; flex: none; }
.materia-help p:last-child { margin: 0; }

.materia-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 22px; }
.materia-item {
    position: relative;
    display: grid; grid-template-columns: 28px 1fr auto; gap: 4px 12px; align-items: center;
    padding: 10px 12px 10px 14px;
    border-radius: 5px;
    outline: none;
    cursor: default;
    transition: background .12s;
}
.materia-item h3 { margin: 0; font-size: 1.05rem; }
.materia-item p { grid-column: 2 / -1; margin: 2px 0 6px; color: var(--muted); font-size: .95rem; }
.js .materia-item p { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.materia-item:hover, .materia-item.is-active { background: rgba(255, 255, 255, .08); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
.materia-item.is-active h3 { color: #fff; }

.stars { display: inline-flex; gap: 3px; }
.stars span { width: 8px; height: 8px; border: 1px solid rgba(255, 215, 106, .55); }
.stars .on { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 6px rgba(255, 215, 106, .6); }

.orb {
    --o1: #c8ff9a; --o2: #33c246; --o3: #0b4416;
    position: relative;
    display: inline-block; width: 24px; height: 24px; border-radius: 50%;
    background: radial-gradient(circle at 34% 30%, #fff 0 9%, var(--o1) 24%, var(--o2) 58%, var(--o3) 100%);
    box-shadow: 0 0 12px var(--o2), inset -2px -3px 5px rgba(0, 0, 0, .35);
    overflow: hidden;
}
.orb::after {
    content: "";
    position: absolute; inset: -40%;
    background: conic-gradient(from 0deg, transparent 0 70%, rgba(255, 255, 255, .55) 80%, transparent 90%);
    animation: spin 3.2s linear infinite;
    mix-blend-mode: overlay;
}
@keyframes spin { to { transform: rotate(1turn); } }
.orb-yellow { --o1: #fff6a0; --o2: #e3b500; --o3: #5c4100; }
.orb-blue { --o1: #b4ecff; --o2: #2d8cff; --o3: #0a2a78; }
.orb-purple { --o1: #ecc2ff; --o2: #9b3dff; --o3: #36096a; }
.orb-red { --o1: #ffc0b0; --o2: #ff3d2e; --o3: #650909; }
.orb-pink { --o1: #ffd0e8; --o2: #ff4fa5; --o3: #66093a; }

.note { margin: 24px 0 0; color: var(--muted); }

/* Save point (mailing list) */
.save { display: grid; grid-template-columns: 160px 1fr; gap: 36px; align-items: center; overflow: hidden; }
.save-crystal { position: relative; height: 200px; display: grid; place-items: center; }
.crystal {
    width: 64px; height: 110px;
    clip-path: polygon(50% 0, 100% 38%, 50% 100%, 0 38%);
    background: linear-gradient(115deg, #eaffff 0 18%, #74d8ff 30%, #2f63ff 58%, #a8ff8f 100%);
    animation: hover 2.4s ease-in-out infinite, shimmer 4s steps(8) infinite;
}
.save-crystal::before {
    content: "";
    position: absolute; left: 50%; top: 50%;
    width: 150px; height: 150px; margin: -75px 0 0 -75px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(116, 216, 255, .45), transparent 65%);
    animation: ring 2.4s ease-in-out infinite;
}
.crystal-ring {
    position: absolute; bottom: 16px; left: 50%;
    width: 120px; height: 26px; margin-left: -60px;
    border-radius: 50%;
    border: 3px solid rgba(116, 216, 255, .7);
    box-shadow: 0 0 22px rgba(116, 216, 255, .55), inset 0 0 14px rgba(116, 216, 255, .45);
    animation: ring 2.4s ease-in-out infinite;
}
@keyframes hover { 50% { transform: translateY(-12px); } }
@keyframes shimmer { 50% { filter: brightness(1.35) hue-rotate(40deg); } }
@keyframes ring { 50% { transform: scale(.82); opacity: .6; } }

.save-body .lead { margin-bottom: 22px; }
.name-entry { display: flex; gap: 12px; max-width: 560px; }
.name-entry input {
    flex: 1; min-width: 0;
    padding: 12px 16px;
    font: 500 1.1rem/1.2 var(--pixel);
    color: var(--ink);
    background: rgba(0, 0, 24, .65);
    border: 2px solid; border-color: var(--frame-lo) var(--frame-hi) var(--frame-hi) var(--frame-lo);
    border-radius: 6px;
    caret-color: var(--mako);
}
.name-entry input::placeholder { color: #7f87ad; }
.name-entry input:focus { outline: 2px dashed var(--gold); outline-offset: 3px; }
.name-entry input[aria-invalid="true"] { border-color: #ff8f8f; }
.save-status { min-height: 1.6em; margin: 12px 0 4px; font-weight: 500; }
.save-status .ok { color: var(--mako); }
.save-status .err { color: #ffb0b0; }
.save-consent { font-size: .88rem; max-width: 40em; margin: 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.save.is-saved .crystal { animation: hover 2.4s ease-in-out infinite, saved 1s steps(6); }
@keyframes saved { 50% { filter: brightness(2.6); } }

/* Contact call to action */
.cta { display: flex; align-items: center; justify-content: space-between; gap: 28px; flex-wrap: wrap; }
.cta-dialogue { flex: 1 1 360px; }
.cta-dialogue h2 { margin-bottom: .2em; }

/* ── Inner pages ─────────────────────────────────────────────────── */

.page-head { padding: 36px 44px; }
.page-head h1 { font-family: var(--display); font-weight: 400; font-size: clamp(3.2rem, 9vw, 6.5rem); line-height: .9; text-transform: uppercase; color: var(--mako); text-shadow: .05em .05em 0 rgba(0, 10, 60, .85); }
.page-head p:last-child { margin-bottom: 0; }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.contact-email { font-size: 1.25rem; font-weight: 600; word-break: break-all; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 10px 24px; margin: 0; }
.details dt { color: var(--cyan); }
.details dd { margin: 0; font-weight: 500; text-shadow: var(--shadow-text); }
.legal h2 { font-size: 1.35rem; margin-top: 1.8em; color: var(--gold); }
.legal h2:first-child { margin-top: 0; }
.legal ul { padding-left: 1.2em; }
.legal li { margin-bottom: .5em; text-shadow: var(--shadow-text); }

/* ── Footer ──────────────────────────────────────────────────────── */

.footer { padding: 32px 36px 24px; font-size: .95rem; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.3fr; gap: 28px; }
.footer .muted { margin: 12px 0 0; }
.footer-h { font-size: .74rem; letter-spacing: .16em; text-transform: uppercase; color: var(--cyan); margin-bottom: 12px; }
.footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.footer-links a { color: var(--ink); text-decoration: none; text-shadow: var(--shadow-text); }
.footer-links a:hover { color: var(--mako); text-decoration: underline; }
.footer-legal { margin: 28px 0 0; padding-top: 18px; border-top: 2px solid rgba(238, 240, 248, .18); color: var(--muted); font-size: .85rem; }

/* ── Limit gauge (scroll progress) ───────────────────────────────── */

.limit {
    position: fixed; right: 20px; bottom: 20px; z-index: 30;
    display: flex; align-items: center; gap: 10px;
    padding: 8px 14px;
    font-size: .8rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
}
.limit-label { color: var(--cyan); text-shadow: var(--shadow-text); }
.limit-track { width: 120px; height: 10px; background: #2c2f44; border: 2px solid; border-color: #9ca0b8 #e2e4ee #e2e4ee #9ca0b8; border-radius: 2px; overflow: hidden; }
.limit-fill { display: block; height: 100%; width: 0; background: linear-gradient(180deg, #ffe3ec, var(--pink) 50%, #c0456e); }
.limit-break { display: none; color: var(--gold); text-shadow: var(--shadow-text); }
.limit.is-full .limit-fill { background: linear-gradient(90deg, #ff5f8f, var(--gold), var(--mako), var(--cyan), #b07bff, #ff5f8f); background-size: 200% 100%; animation: rainbow .8s steps(8) infinite; }
.limit.is-full .limit-break { display: inline; animation: blink .5s steps(2) infinite; }
@keyframes rainbow { to { background-position: 200% 0; } }
html:not(.js) .limit { display: none; }

/* ── Config window ───────────────────────────────────────────────── */

.config {
    position: fixed; /* .win sets relative, which would pin the modal to the top of the page */
    inset: 0;
    width: min(460px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    margin: auto;
    padding: 28px 32px 28px 52px;
    color: var(--ink);
    overflow: auto;
}
.config::backdrop { background: rgba(2, 3, 16, .7); backdrop-filter: blur(3px); }
.config[open] { animation: win-open .26s steps(6, end); }
.config h2 { font-size: 1.6rem; }
.config fieldset { border: 0; margin: 0 0 20px; padding: 0; }
.config legend { padding: 0; margin-bottom: 12px; color: var(--cyan); font-weight: 600; }
.corner-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; width: 160px; padding: 6px; border: 2px solid var(--frame-mid); border-radius: 6px; margin-bottom: 18px; }
.corner { position: relative; display: block; cursor: pointer; }
.corner input { position: absolute; opacity: 0; }
.corner-swatch { display: block; height: 42px; border-radius: 3px; border: 2px solid rgba(255, 255, 255, .25); }
.corner input:checked + .corner-swatch { border-color: var(--gold); box-shadow: 0 0 0 2px #000, 0 0 12px rgba(255, 215, 106, .6); }
.corner input:focus-visible + .corner-swatch { outline: 2px dashed var(--gold); outline-offset: 2px; }
.sliders { display: grid; gap: 10px; }
.slider { display: grid; grid-template-columns: 22px 1fr 40px; align-items: center; gap: 12px; font-weight: 600; }
.slider output { text-align: right; font-variant-numeric: tabular-nums; }
.slider input { -webkit-appearance: none; appearance: none; width: 100%; height: 12px; border-radius: 2px; border: 2px solid var(--frame-mid); background: linear-gradient(90deg, #000, var(--track, #f00)); }
.slider-r input { --track: #ff2a2a; }
.slider-g input { --track: #2aff5a; }
.slider-b input { --track: #3a6bff; }
.slider input::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 22px; border-radius: 2px; background: var(--ink); border: 2px solid #000; box-shadow: 2px 2px 0 rgba(0, 0, 0, .5); cursor: pointer; }
.slider input::-moz-range-thumb { width: 12px; height: 20px; border-radius: 2px; background: var(--ink); border: 2px solid #000; cursor: pointer; }
.toggles { display: grid; gap: 4px; margin-bottom: 24px; }
.toggle { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; }
.toggle-ui::before { content: "OFF"; color: var(--muted); font-weight: 600; }
.toggle input:checked + .toggle-ui::before { content: "ON"; color: var(--mako); }
.toggle input:focus-visible + .toggle-ui { outline: 2px dashed var(--gold); outline-offset: 4px; }
.config-actions { display: flex; justify-content: flex-end; gap: 12px; }

/* ── Smaller screens ─────────────────────────────────────────────── */

@media (max-width: 1080px) {
    .hero-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
    html { scroll-padding-top: 120px; } /* clear the sticky top bar when jumping to a section */
    .shell { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main" "foot"; padding: 16px; gap: 16px; }
    .topbar { position: sticky; top: 12px; z-index: 25; }
    .js .menu-toggle {
        display: inline-flex; align-items: center; gap: 10px;
        padding: 8px 12px;
        font: 600 1rem var(--pixel); color: var(--ink); text-shadow: var(--shadow-text);
        background: rgba(0, 0, 30, .35); border: 2px solid rgba(238, 240, 248, .55); border-radius: 6px;
        cursor: pointer;
    }
    .menu-toggle-bars { width: 16px; height: 12px; background: linear-gradient(var(--ink) 0 2px, transparent 2px 5px, var(--ink) 5px 7px, transparent 7px 10px, var(--ink) 10px 12px); }
    .js .side { position: fixed; top: 112px; right: 16px; width: min(260px, calc(100vw - 32px)); display: none; }
    .js.menu-open .side { display: grid; animation: win-open .22s steps(5, end); }
    html:not(.js) .side { position: static; grid-area: auto; }
    .two-col, .contact-grid { grid-template-columns: 1fr; gap: 16px; }
    .section, .page-head { padding: 28px 24px; }
    .save { grid-template-columns: 1fr; gap: 0; }
    .save-crystal { height: 150px; }
}

@media (max-width: 640px) {
    body { font-size: 17px; }
    .win { padding: 22px 20px; }
    .section, .page-head { padding: 26px 20px; }
    .materia-list { grid-template-columns: 1fr; }
    .app-head { flex-direction: column; gap: 18px; }
    .name-entry { flex-direction: column; }
    .footer-grid { grid-template-columns: 1fr; }
    .member { grid-template-columns: 72px 1fr; }
    .portrait { width: 72px; }
    .details { grid-template-columns: 1fr; gap: 2px; }
    .details dd { margin-bottom: 10px; }
    .limit { right: 12px; bottom: 12px; padding: 6px 10px; }
    .limit-track { width: 70px; }
}

/* ── Motion preferences, page transitions and print ──────────────── */

@view-transition { navigation: auto; }
::view-transition-old(root) { animation: swirl-out .42s ease-in both; }
::view-transition-new(root) { animation: fade-in .32s .12s ease-out both; }
@keyframes swirl-out { to { transform: rotate(10deg) scale(1.5); filter: blur(8px) brightness(2.4); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; filter: brightness(2); } }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .js .reveal { clip-path: none; }
    .js .meter-fill { width: calc(var(--v) * 100%); }
    ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}
.no-motion .lifestream { display: none; }

@media print {
    body { background: #fff; color: #000; }
    .lifestream, .crt, .side, .limit, .hand, .menu-toggle, .scroll-hint { display: none !important; }
    .win { background: none; border: 1px solid #999; box-shadow: none; color: #000; }
    .win::before, .win::after { display: none; }
    .js .reveal { clip-path: none; }
    p, h1, h2, h3, li, dd { text-shadow: none; color: #000; }
    .shell { display: block; }
}
