/* FateMMO: Awaken (/awaken) in motion: the living Crossroads hero and the attract-mode battle reel.
   Two tempos. Drift: sine loops of 1.8 to 8 s that never move a thing more than about 1.5% of its size. Strike: a
   wind-up, a blow of 90 ms or less, a 70 ms hit-stop on contact and a settle (the reel's timeline lives in
   public/js/awaken-motion.js). Reduced motion keeps every layer still, with each glow resting lit at its middle value,
   and the reel shows its final frame, which is also what the markup draws without scripts. */
/* The site's motion tokens (fate-tokens.css) lead; the fallbacks are the same values for pages loaded without them. */
.awaken-page {
    --aw-ease-thread: var(--fate-ease-thread, cubic-bezier(.2, .8, .2, 1));
    --aw-ease-snap: var(--fate-ease-snap, cubic-bezier(.2, .9, .3, 1.25));
    --aw-ease-drift: var(--fate-ease-drift, cubic-bezier(.45, .05, .55, .95));
    --aw-pop: var(--fate-dur-pop, 360ms);
    --aw-reveal: var(--fate-dur-reveal, 600ms);
    --aw-battle-window: #070b1c;
    --aw-battle-border: #f3ecdc;
    --aw-battle-ink: #fbf7ee;
}

/* ---- Hero: the Crossroads plate, cropped like object-fit: cover so every layer keeps the plate's coordinates ---- */
.awaken-hero {
    display: grid;
    gap: clamp(1.25rem, 3vw, 2rem);
}

.aw-scene {
    position: relative;
    aspect-ratio: 12 / 5;
    overflow: hidden;
    container-type: size;
    isolation: isolate;
    border: 2px solid var(--aw-frame);
    border-radius: 14px;
    background: #060a16;
    box-shadow: 0 0 0 4px var(--aw-night), 0 26px 60px rgba(0, 0, 0, .45);
}

/* The stage is the plate at its own 1672:941 shape, scaled to cover the scene; --aw-fx and --aw-fy pick the crop. */
.aw-stage {
    --sw: max(100cqw, 177.68cqh);
    --sh: calc(var(--sw) * .5628);
    position: absolute;
    z-index: 0;
    left: calc((100cqw - var(--sw)) * var(--aw-fx, .5));
    top: calc((100cqh - var(--sh)) * var(--aw-fy, .5));
    width: var(--sw);
    height: var(--sh);
}

.aw-plate {
    display: block;
    width: 100%;
    height: 100%;
}

.aw-scene::before,
.aw-scene::after {
    content: "";
    position: absolute;
    z-index: 1;
    left: 0;
    right: 0;
    pointer-events: none;
}
.aw-scene::before {
    top: 0;
    height: 18%;
    background: linear-gradient(180deg, rgba(4, 7, 16, .6), transparent);
}
.aw-scene::after {
    bottom: 0;
    height: 34%;
    background: linear-gradient(180deg, transparent, rgba(4, 7, 16, .78));
}

/* The painted lantern, the campfire and the Hollow Oak's door breathe on one 1.8 s loop, out of step. */
.aw-glow,
.aw-flies {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.aw-light {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: var(--w);
    aspect-ratio: var(--r, 1);
    border-radius: 50%;
    background: radial-gradient(closest-side, var(--c) 0%, var(--c2) 45%, transparent 100%);
    mix-blend-mode: screen;
    opacity: .78;
    translate: -50% -50%;
    animation: aw-breathe 1.8s var(--aw-ease-drift) var(--d, 0s) infinite;
}
.aw-light-lantern { --x: 32.5%; --y: 58.2%; --w: 7%; --c: rgba(255, 214, 140, .8); --c2: rgba(255, 160, 70, .28); }
.aw-light-fire { --x: 35.9%; --y: 65.6%; --w: 12%; --r: 1.7; --c: rgba(255, 176, 86, .75); --c2: rgba(255, 120, 40, .24); --d: -.7s; }
.aw-light-door { --x: 81.8%; --y: 55%; --w: 6.5%; --r: .5; --c: rgba(255, 210, 120, .72); --c2: rgba(255, 168, 60, .22); --d: -1.2s; }

/* The Unbound stands on the road by the lantern: moonlit on his far side, rim-lit gold on the lantern side. */
.aw-unbound {
    position: absolute;
    left: 19.2%;
    bottom: 26.3%;
    width: 11.6%;
}
.aw-unbound::before {
    content: "";
    position: absolute;
    left: 6%;
    right: 6%;
    bottom: -1.6%;
    height: 5%;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(0, 0, 0, .65), transparent);
}
.aw-breath {
    position: relative;
    transform-origin: 50% 100%;
    animation: aw-breath 2.6s var(--aw-ease-drift) infinite;
}
.aw-breath img {
    display: block;
    width: 100%;
    height: auto;
    filter: brightness(.86) saturate(.86) drop-shadow(1.5px 0 0 rgba(255, 198, 116, .8)) drop-shadow(5px 0 3px rgba(255, 160, 70, .26));
}
.aw-breath::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(96deg, #3a4a86 0%, #8890b4 48%, #ffe2b8 92%);
    mix-blend-mode: multiply;
    -webkit-mask: url("/assets/world/actors/unbound-hero-v2.webp") center / 100% 100% no-repeat;
    mask: url("/assets/world/actors/unbound-hero-v2.webp") center / 100% 100% no-repeat;
    pointer-events: none;
}

/* Fireflies: phones keep the first twelve, which gather around the camp. */
.aw-flies i {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #fff1b8;
    box-shadow: 0 0 5px 2px rgba(255, 210, 110, .55);
    opacity: 0;
    animation: aw-fly var(--t) var(--aw-ease-drift) var(--d) infinite, aw-blink var(--t) var(--aw-ease-drift) var(--d) infinite;
}

/* The Celestial Dragon crosses the moon once per visit (added by the script): a silhouette rim-lit from the moon. */
.aw-dragon {
    position: absolute;
    left: 42.3%;
    top: 5.2%;
    width: 10%;
    opacity: 0;
    pointer-events: none;
}
.aw-dragon img {
    display: block;
    width: 100%;
    height: auto;
}
.aw-dragon-shade,
.aw-dragon-dim {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.aw-dragon-shade {
    left: 30.3%;
    top: 60%;
    width: 34%;
    aspect-ratio: 3;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(2, 4, 14, .7), rgba(2, 4, 14, .3) 55%, transparent);
    mix-blend-mode: multiply;
}
.aw-dragon-dim {
    inset: 0;
    background: rgba(4, 7, 20, .2);
}

.aw-scene .awaken-crumbs {
    position: absolute;
    z-index: 2;
    top: .75rem;
    left: 1rem;
    right: 1rem;
    color: rgba(233, 228, 214, .82);
    text-shadow: 0 1px 6px #000;
}

/* The title sits on the plate's lower edge; a gold thread draws beneath it and ties off in a four-point knot. */
.aw-title {
    position: absolute;
    z-index: 2;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    padding: 0 1rem clamp(.8rem, 4.5cqh, 1.6rem);
    pointer-events: none;
}
.aw-title-lockup {
    display: inline-grid;
}
.public-wrapper .awaken-page .aw-title h1 {
    margin: 0;
    color: #f8edd3;
    font-size: clamp(1.95rem, 8.4cqw, 3.7rem);
    line-height: 1.04;
    letter-spacing: .02em;
    text-align: center;
    text-shadow: 0 2px 0 rgba(0, 0, 0, .55), 0 0 18px rgba(2, 4, 12, .9), 0 0 42px rgba(2, 4, 12, .75);
}
.aw-thread {
    display: flex;
    align-items: center;
    width: 0;
    min-width: 100%;
    margin-top: .2rem;
}
.aw-thread-line {
    flex: 1;
    height: 8px;
    overflow: visible;
}
.aw-thread-line path {
    fill: none;
    stroke: #e8c46b;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-dasharray: 1;
    stroke-dashoffset: 0;
    filter: drop-shadow(0 0 3px rgba(242, 200, 121, .75));
    animation: aw-thread-draw var(--aw-reveal) var(--aw-ease-thread) .35s backwards;
}
.aw-thread-knot {
    flex: none;
    width: clamp(15px, 1.8cqw, 22px);
    height: clamp(15px, 1.8cqw, 22px);
    margin-left: -3px;
    fill: #fff0b8;
    filter: drop-shadow(0 0 5px rgba(242, 200, 121, .9));
    animation: aw-knot-pop var(--aw-pop) var(--aw-ease-snap) .95s backwards;
}

/* ---- Under the hero: the start menu and copy beside the attract reel ---- */
.awaken-hero-body {
    display: grid;
    grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr);
    gap: clamp(1.5rem, 4vw, 3rem);
    align-items: start;
}

/* ---- Attract reel: a silent battle loop in the game's window style, built from the game's art ---- */
.aw-reel {
    margin: 0;
}
.aw-reel-frame {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    container-type: size;
    isolation: isolate;
    border: 2px solid var(--aw-frame);
    border-radius: 12px;
    background: #04060d;
    box-shadow: 0 0 0 4px var(--aw-night), 0 20px 44px rgba(0, 0, 0, .4);
}
.aw-reel-screen {
    position: absolute;
    inset: 0;
    overflow: hidden;
    color: var(--aw-battle-ink);
}
/* The plate covers the frame with the road at 78% of its height, so both fighters stand on it. */
.aw-reel-plate {
    --pw: max(118cqw, 186cqh);
    position: absolute;
    left: calc(50cqw - var(--pw) * .5);
    top: calc(78cqh - var(--pw) * .4221);
    width: var(--pw);
    max-width: none;
    height: auto;
    filter: brightness(.8) saturate(.92);
}
.aw-reel-hero,
.aw-reel-foe {
    position: absolute;
    transform-origin: 50% 100%;
}
.aw-reel-hero {
    left: 9cqw;
    bottom: 20cqh;
    width: 16cqw;
}
.aw-reel-foe {
    left: 55cqw;
    bottom: 19cqh;
    width: 37cqw;
    opacity: 0;
}
.aw-reel-breath,
.aw-reel-sway {
    transform-origin: 50% 100%;
}
.aw-reel-breath {
    animation: aw-breath 2.6s var(--aw-ease-drift) infinite;
}
.aw-reel-sway {
    filter: drop-shadow(0 10px 12px rgba(0, 0, 0, .55));
    animation: aw-sway 1.9s var(--aw-ease-drift) infinite;
}
.aw-reel-breath img,
.aw-reel-sway img {
    display: block;
    width: 100%;
    height: auto;
}
.aw-reel-breath img {
    filter: drop-shadow(0 10px 12px rgba(0, 0, 0, .6));
}
.aw-reel-burst {
    position: absolute;
    left: 33%;
    top: 40%;
    width: 46%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, .95), rgba(255, 236, 190, .45) 38%, transparent 70%);
    mix-blend-mode: screen;
    opacity: 0;
    transform: translate(-50%, -50%) scale(.3);
    pointer-events: none;
}
.aw-reel-pop {
    position: absolute;
    left: 30%;
    top: -12%;
    opacity: 0;
    transform: translate(-50%, 0%) scale(.7);
    color: #fff;
    font: 900 clamp(18px, 5.6cqw, 40px)/1 Inter, system-ui, sans-serif;
    text-shadow: 0 3px 0 #1a0a0a, 0 0 10px rgba(0, 0, 0, .8);
}

/* The game's battle window: navy, a 2 px parchment border, a 10 px radius and a dark ring. */
.aw-reel-window {
    position: absolute;
    border: 2px solid var(--aw-battle-border);
    border-radius: 10px;
    background: var(--aw-battle-window);
    box-shadow: 0 0 0 2px #0b1020, 0 14px 32px rgba(0, 0, 0, .55), inset 0 0 18px rgba(80, 100, 190, .12);
}
.aw-reel-message,
.aw-reel-commands {
    left: 3.5cqw;
    right: 3.5cqw;
    bottom: 3.5cqh;
    height: 17cqh;
    opacity: 0;
    transform: translateY(8%);
}
.aw-reel-message {
    display: grid;
    align-items: center;
    padding: 0 4cqw;
}
.aw-reel .aw-reel-message p {
    grid-area: 1 / 1;
    margin: 0;
    max-width: none;
    font: 600 clamp(10px, 2.6cqw, 17px)/1.4 Inter, system-ui, sans-serif;
    letter-spacing: .01em;
}
.aw-reel .aw-reel-message [data-reel="line-near"] {
    opacity: 0;
}
.aw-reel-commands {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-content: center;
    gap: 0 1cqw;
    padding: 0 2cqw;
    font: 700 clamp(9px, 2.3cqw, 15px)/1 Inter, system-ui, sans-serif;
    letter-spacing: .02em;
}
.aw-reel-commands span {
    position: relative;
    padding: 1.3cqh 0 1.3cqh 3.4cqw;
    border-radius: 6px;
}
.aw-reel-commands .is-current::before {
    content: "\25B6";
    position: absolute;
    left: .9cqw;
    top: 50%;
    color: #f6d58a;
    font-size: .78em;
    transform: translateY(-50%);
    animation: aw-cursor .9s var(--aw-ease-drift) infinite alternate;
}
.aw-reel-commands .aw-reel-auto {
    color: #bff5cf;
}
.aw-reel-victory {
    left: 50%;
    top: 42%;
    width: min(66cqw, 380px);
    padding: 3.4cqh 4cqw 3.8cqh;
    text-align: center;
    transform: translate(-50%, -50%);
}
.aw-reel-victory strong {
    display: block;
    margin-bottom: 1.4cqh;
    color: #ffd98a;
    font: 700 clamp(15px, 4.4cqw, 28px)/1.1 Cinzel, Georgia, serif;
    letter-spacing: .04em;
    text-shadow: 0 0 18px rgba(255, 200, 90, .35);
}
.aw-reel .aw-reel-victory p {
    margin: .8cqh 0 0;
    max-width: none;
    font: 600 clamp(10px, 2.4cqw, 15px)/1.45 Inter, system-ui, sans-serif;
}
.aw-reel-victory b {
    color: #ffd98a;
    font-variant-numeric: tabular-nums;
}
.aw-reel-fade {
    position: absolute;
    inset: 0;
    background: #04060d;
    opacity: 0;
    pointer-events: none;
}

/* The whole reel is the link; its visible name is the badge, so it can never pass for the live game. */
.aw-reel-link {
    position: absolute;
    z-index: 3;
    inset: 0;
    border-radius: 10px;
}
.awaken-page .aw-reel-link:focus-visible {
    outline-offset: -5px;
}
.aw-reel-badge {
    position: absolute;
    top: .6rem;
    right: .6rem;
    padding: .3rem .72rem;
    border: 2px solid var(--aw-battle-border);
    border-radius: 999px;
    background: var(--aw-battle-window);
    box-shadow: 0 0 0 2px #0b1020;
    color: var(--aw-battle-ink);
    font: 700 .76rem/1.2 Inter, system-ui, sans-serif;
    letter-spacing: .04em;
    white-space: nowrap;
}
.aw-reel-link:hover .aw-reel-badge,
.aw-reel-link:focus-visible .aw-reel-badge {
    border-color: #f6d58a;
    color: #f6d58a;
}
.aw-reel figcaption {
    margin-top: .55rem;
    color: var(--aw-muted);
    font-size: .86rem;
    line-height: 1.45;
}

@keyframes aw-breathe {
    0%, 100% { opacity: .56; scale: 1; }
    50% { opacity: 1; scale: 1.015; }
}
@keyframes aw-breath {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(1.014); }
}
@keyframes aw-sway {
    0%, 100% { transform: scale(1, 1); }
    50% { transform: scale(1.006, 1.012); }
}
@keyframes aw-fly {
    0%, 100% { translate: 0 0; }
    25% { translate: 7px -10px; }
    50% { translate: -3px -18px; }
    75% { translate: -9px -7px; }
}
@keyframes aw-blink {
    0%, 100% { opacity: 0; }
    30% { opacity: .9; }
    55% { opacity: .25; }
    75% { opacity: .85; }
}
@keyframes aw-thread-draw {
    from { stroke-dashoffset: 1; }
}
@keyframes aw-knot-pop {
    from { opacity: 0; transform: scale(0) rotate(-45deg); }
}
@keyframes aw-cursor {
    from { transform: translate(0, -50%); }
    to { transform: translate(2px, -50%); }
}

@media (min-width: 901px) {
    .aw-scene { --aw-fy: .23; }
    .aw-title { justify-content: flex-end; padding-right: 4cqw; }
}
@media (max-width: 900px) {
    .aw-scene { aspect-ratio: 16 / 9; }
    .awaken-hero-body { grid-template-columns: minmax(0, 1fr); }
}
/* Phones: a taller reel, with both fighters scaled 1.2x so the dash (220% of the hero's width) still lands on contact. */
@media (max-width: 640px) {
    .aw-reel-frame { aspect-ratio: 4 / 3; }
    .aw-reel-hero { left: .8cqw; width: 19.2cqw; }
    .aw-reel-foe { left: 54cqw; width: 44.4cqw; }
    .aw-flies i:nth-child(n + 13) { display: none; }
}
/* Phones: the scene runs edge to edge and centres on the Unbound, the lantern and the moon. */
@media (max-width: 520px) {
    .aw-scene {
        --aw-fx: .142;
        aspect-ratio: 5 / 6;
        margin-inline: -1rem;
        border-width: 0 0 2px;
        border-radius: 0;
        box-shadow: none;
    }
}

/* Browsers without container units (before 2023) get a plain cover crop of the plate. */
@supports not (width: 1cqw) {
    .aw-stage { inset: 0; width: auto; height: auto; }
    .aw-plate { object-fit: cover; }
    .aw-reel-plate { inset: 0; width: 100%; height: 100%; object-fit: cover; }
}

/* The ambience toggle's pause stills the hero's loops the way reduced motion does. */
.awaken-hero.is-still .aw-light,
.awaken-hero.is-still .aw-breath {
    animation: none;
}
.awaken-hero.is-still .aw-flies {
    display: none;
}
@media (prefers-reduced-motion: reduce) {
    .aw-light,
    .aw-breath,
    .aw-reel-breath,
    .aw-reel-sway,
    .aw-reel-commands .is-current::before,
    .aw-thread-line path,
    .aw-thread-knot {
        animation: none;
    }
    .aw-flies {
        display: none;
    }
}
