/* ============================================================
   Neiri Chronicles — mobile-only layer
   Loaded only with media="(max-width: 760px)" from the layout.
   Desktop and tablet rules live in style.css.
   ============================================================ */

html,
body {
    overflow-x: hidden;
}

body {
    background:
        radial-gradient(520px 280px at 50% -90px, rgba(38,145,242,.18), transparent),
        var(--bg);
}

.container {
    width: min(100% - 28px, 520px);
}

/* ---------------- Header ---------------- */
.site-header {
    position: sticky;
    background: rgba(11,15,20,.94);
    box-shadow: 0 8px 28px rgba(0,0,0,.28);
}

body.has-hero .site-header {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    background:
        linear-gradient(180deg, rgba(11,15,20,.94), rgba(11,15,20,.78));
}

.header-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 34px 40px 34px auto;
    align-items: center;
    column-gap: 8px;
    padding: 7px 0;
}

.brand {
    min-width: 0;
    gap: 7px;
}

.brand-name {
    max-width: 168px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 17px;
    line-height: 1;
}

.lang-switcher {
    margin-left: 0;
}

.studio-mark {
    width: 32px;
    justify-self: center;
}

.mobile-menu-trigger {
    width: 34px;
    height: 34px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 0;
    border: 1px solid rgba(214,174,89,.34);
    border-radius: 9px;
    background: rgba(255,255,255,.035);
    color: var(--gold-soft);
    cursor: pointer;
}

.mobile-menu-trigger span {
    display: block;
    width: 15px;
    height: 2px;
    margin: 0;
    border-radius: 999px;
    background: currentColor;
    transition: transform .18s ease, opacity .18s ease;
}

.site-header.is-menu-open .mobile-menu-trigger span:nth-child(1) {
    transform: translateY(5px) rotate(45deg);
}

.site-header.is-menu-open .mobile-menu-trigger span:nth-child(2) {
    opacity: 0;
}

.site-header.is-menu-open .mobile-menu-trigger span:nth-child(3) {
    transform: translateY(-5px) rotate(-45deg);
}

.lang-trigger {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: rgba(255,255,255,.035);
}

.lang-trigger svg {
    width: 17px;
    height: 17px;
}

.lang-menu {
    right: -48px;
    min-width: 174px;
}

.lang-menu a {
    padding: 9px 10px;
    font-size: 12px;
}

.main-nav {
    position: absolute;
    left: 14px;
    right: 14px;
    top: calc(100% + 8px);
    z-index: 1100;
    display: none;
    gap: 6px;
    margin: 0;
    padding: 8px;
    border: 1px solid rgba(214,174,89,.24);
    border-radius: 10px;
    background: rgba(11,15,20,.97);
    box-shadow: 0 18px 42px rgba(0,0,0,.46);
    backdrop-filter: blur(10px);
}

.site-header.is-menu-open .main-nav {
    display: grid;
}

.main-nav a {
    min-height: 38px;
    display: flex;
    align-items: center;
    padding: 9px 11px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: rgba(233,240,243,.76);
    font-size: 14px;
    line-height: 1;
    background: transparent;
}

.main-nav a.active {
    color: var(--gold-soft);
    border-color: rgba(245,211,102,.34);
    background: rgba(245,211,102,.08);
}

.auth-actions {
    justify-self: end;
    gap: 5px;
}

.auth-actions .btn-sm {
    min-height: 34px;
    padding: 5px 9px;
    border-radius: 9px;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
}

.auth-actions .btn-ghost {
    border-color: rgba(255,255,255,.08);
    background: rgba(255,255,255,.025);
    color: rgba(233,240,243,.86);
}

.auth-actions .btn-primary {
    padding-left: 11px;
    padding-right: 11px;
    box-shadow: 0 5px 14px rgba(38,145,242,.28);
}

.user-chip {
    max-width: 86px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 6px 9px;
    font-size: 12px;
}

/* ---------------- Shared Type / Spacing ---------------- */
section.block {
    padding: 42px 0;
}

.intro-block {
    padding-top: 48px;
    padding-bottom: 52px;
    background-position: center top;
}

.intro-block::before {
    background:
        linear-gradient(180deg, rgba(0,0,0,.78), rgba(0,0,0,.38) 42%, rgba(0,0,0,.86)),
        linear-gradient(90deg, rgba(0,0,0,.64), transparent 32%, transparent 68%, rgba(0,0,0,.64));
}

.section-head {
    margin-bottom: 24px;
}

.section-head h2 {
    font-size: 28px;
    line-height: 1.1;
}

.section-head p {
    max-width: 34ch;
    margin-left: auto;
    margin-right: auto;
    font-size: 15px;
    line-height: 1.55;
}

.section-head .section-note {
    max-width: 36ch;
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.55;
}

.placeholder-band {
    padding: 26px 18px;
}

.intro-block .placeholder-band {
    background:
        linear-gradient(180deg, rgba(7, 13, 18, .9), rgba(4, 8, 12, .96)),
        repeating-linear-gradient(135deg, rgba(255,255,255,.025), rgba(255,255,255,.025) 12px, transparent 12px, transparent 24px);
}

.placeholder-band p {
    margin: 0;
    font-size: 15px;
    line-height: 1.65;
}

.newsletter-panel {
    padding: 24px 16px;
    border-radius: 8px;
}

.newsletter-block {
    scroll-margin-top: 104px;
}

.newsletter-copy {
    margin-bottom: 20px;
    font-size: 15px;
    line-height: 1.62;
}

.newsletter-form {
    grid-template-columns: 1fr;
    gap: 10px;
}

.newsletter-form input[type="email"],
.newsletter-form .btn,
.newsletter-discord {
    width: 100%;
}

.newsletter-note {
    margin: 12px auto 18px;
    font-size: 12px;
    line-height: 1.5;
}

.newsletter-dialog {
    padding: 18px;
    place-items: center;
    align-items: center;
}

.newsletter-dialog__panel {
    grid-template-columns: 96px minmax(0, 1fr);
    width: min(92vw, 390px);
    justify-self: center;
}

.newsletter-dialog__portrait {
    height: 138px;
    overflow: visible;
}

.newsletter-dialog__portrait img {
    width: 132px;
    height: 132px;
    object-fit: contain;
    object-position: center bottom;
}

.newsletter-dialog__content {
    margin-left: -8px;
}

.newsletter-dialog__name {
    margin-left: 16px;
    padding: 6px 14px 5px;
    border-radius: 7px 7px 0 0;
    font-size: 14px;
}

.newsletter-dialog__box {
    min-height: 112px;
    padding: 20px 16px 16px 18px;
    border-radius: 7px;
}

.newsletter-dialog__box p {
    margin-bottom: 16px;
    font-size: 21px;
    line-height: 1.2;
}

.newsletter-dialog__box .btn {
    width: 100%;
}

.btn {
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 9px;
    font-size: 14px;
}

/* ---------------- Cinematic Hero ---------------- */
.cinematic {
    height: 100vh;
    height: 100svh;
}

.cinematic .stage {
    height: 100vh;
    height: 100svh;
}

.cinematic .layer-bg {
    background-position: 56% top;
}

.cinematic .layer-title {
    left: 50%;
    top: 35%;
    width: min(66vw, 280px);
    --te: calc(2 * var(--portrait-p) - var(--portrait-p) * var(--portrait-p));
    transform:
        translate(-50%, -50%)
        translateX(calc(var(--te) * -22vw));
}

.cinematic .layer-portrait {
    right: -8vw;
    bottom: -3vh;
    width: min(64vw, 46vh);
}

.cinematic .hero-tagline {
    width: min(100% - 28px, 430px);
    z-index: 20;
    opacity: var(--portrait-p);
}

.cinematic .hero-tagline p {
    font-size: 28px;
    line-height: 1.14;
}

.cinematic .scroll-cue {
    bottom: 17px;
    font-size: 14px;
    letter-spacing: 1.6px;
    gap: 4px;
}

.cinematic .scroll-cue:focus {
    outline: none;
}

.cinematic .scroll-cue .scroll-pointer {
    width: 46px;
    height: 46px;
}

.cinematic .scroll-cue .scroll-label {
    min-width: 112px;
}

.cinematic .scroll-cue.is-docked {
    right: 14px;
    bottom: 14px;
    max-width: 120px;
    font-size: 12px;
    letter-spacing: 1.1px;
}

.cinematic .scroll-cue.is-docked .scroll-label,
.cinematic .scroll-cue.is-at-bottom .scroll-label {
    min-width: 0;
}

/* ---------------- Intro Teaser ---------------- */
.gameplay-teaser {
    min-height: 154px;
    margin: 0 0 18px;
    overflow: hidden;
}

.teaser-party,
.teaser-enemies {
    left: 50%;
    right: auto;
    gap: 0;
    justify-content: center;
}

.teaser-party {
    transform: translateX(calc(-50% - 96px));
}

.teaser-enemies {
    transform: translateX(calc(-50% + 96px));
}

.teaser-sprite {
    width: min(29vw, 112px);
    filter: drop-shadow(0 11px 9px rgba(0,0,0,.48));
}

.teaser-aelor {
    margin-left: -32px;
}

/* ---------------- Aelor Journey ---------------- */
.story-video-section {
    padding-top: 58px;
    padding-bottom: 66px;
}

.story-video-section .container {
    width: min(100%, 100vw);
}

.story-video-head {
    width: min(92vw, 520px);
    margin: 0 auto 22px;
}

.story-video-frame {
    width: min(92vw, 520px);
    margin: 0 auto;
    border-radius: 8px;
}

.teaser-goblin-stack {
    width: min(32vw, 124px);
}

.teaser-skeleton-mage {
    width: min(29vw, 112px);
    margin-left: -40px;
}

/* ---------------- World / Lore ---------------- */
.world-showcase {
    gap: 18px;
}

.world-map {
    width: calc(100vw - 28px);
    margin-left: 50%;
    transform: translateX(-50%);
    aspect-ratio: 4 / 3;
    border-radius: 8px;
}

.world-copy > p,
.lore-copy > p {
    font-size: 15px;
    line-height: 1.65;
}

.world-copy > p {
    max-width: 38ch;
}

.lore-detail-grid,
.lore-points {
    grid-template-columns: 1fr;
    gap: 10px;
}

.lore-points div {
    padding: 14px;
}

.lore-points strong {
    font-size: 15px;
}

.lore-points p {
    font-size: 13px;
    line-height: 1.55;
}

/* ---------------- Timeline ---------------- */
.timeline-wrap {
    margin: 0;
    padding: 4px 0 0;
    overflow: visible;
    scroll-snap-type: none;
}

.timeline-track {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    min-width: 0;
    padding: 0;
}

.timeline-track::before {
    left: 17px;
    right: auto;
    top: 20px;
    bottom: 22px;
    width: 3px;
    height: auto;
    background: linear-gradient(
        180deg,
        var(--gold-soft) 0 53%,
        rgba(255,255,255,.18) 53% 100%
    );
}

.timeline-step {
    grid-template-columns: 38px minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    column-gap: 12px;
    row-gap: 4px;
    min-height: 0;
    padding: 0 0 24px;
    text-align: left;
    scroll-snap-align: none;
}

.timeline-dot {
    grid-column: 1;
    grid-row: 1 / 4;
    justify-self: start;
    margin-top: 2px;
    margin-left: 8px;
}

.timeline-step.is-current .timeline-dot {
    margin-top: -2px;
    margin-left: 4px;
}

.timeline-time {
    grid-column: 2;
    margin-top: 0;
    font-size: 10px;
}

.timeline-step strong {
    grid-column: 2;
    font-size: 13px;
    line-height: 1.35;
}

.timeline-step small {
    grid-column: 2;
    justify-self: start;
    margin-top: 4px;
}

.timeline-note {
    max-width: 34ch;
    margin-top: 16px;
    font-size: 14px;
}

/* ---------------- Help Us ---------------- */
.page-head {
    padding: 34px 0 18px;
}

.page-head h1 {
    font-size: 32px;
    line-height: 1.1;
}

.page-head .muted {
    font-size: 15px;
    line-height: 1.5;
}

.help-panel {
    padding: 24px 16px;
    border-radius: 8px;
}

.help-lead {
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.62;
}

.help-grid {
    grid-template-columns: 1fr;
    gap: 12px;
}

.help-grid div {
    padding: 13px 14px;
}

.help-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 22px;
}

.help-actions .btn {
    width: 100%;
}

/* ---------------- Heroes ---------------- */
.char-grid,
.char-grid-preview {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.char-grid.is-focus-mode .char.is-selected:not([open]) {
    grid-column: 1 / 2;
}

.char {
    border-radius: 8px;
}

.char h3 {
    font-size: 11px;
    line-height: 1.15;
}

.char .char-body {
    padding: 8px 4px;
}

.char .cls {
    font-size: 9px;
}

.char-more {
    margin-top: 6px;
    font-size: 8px;
    letter-spacing: .06em;
}

.char .portrait {
    cursor: zoom-in;
}

.char[open] {
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
    min-height: 0;
}

.char[open] summary {
    border-right: 0;
    border-bottom: 1px solid rgba(255,255,255,.1);
}

.char[open] .portrait {
    aspect-ratio: 3 / 4;
    min-height: 0;
}

.char[open] .char-body {
    padding: 13px 10px;
    text-align: center;
}

.char-expanded {
    padding: 18px 16px 20px;
}

.char-profile-block p {
    font-size: 14px;
    line-height: 1.58;
}

/* ---------------- Auth / Forms ---------------- */
.auth-wrap {
    margin: 34px auto;
    padding: 0 14px;
}

.card-panel {
    padding: 24px 18px;
    border-radius: 8px;
}

.card-panel h1 {
    font-size: 26px;
}

.form-control {
    min-height: 44px;
    border-radius: 8px;
    font-size: 16px;
}

.form-actions .btn {
    width: 100%;
}

/* ---------------- Forum ---------------- */
.list {
    gap: 10px;
}

.list-row {
    align-items: flex-start;
    display: grid;
    gap: 10px;
    padding: 15px;
}

.list-row .main h3 {
    font-size: 17px;
}

.list-row .main p {
    font-size: 13px;
    line-height: 1.5;
}

.list-row .meta {
    text-align: left;
    white-space: normal;
    font-size: 12px;
}

.thread-post {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px;
}

.thread-post .who {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding-right: 0;
    padding-bottom: 12px;
}

.thread-post .content {
    font-size: 14px;
    line-height: 1.6;
}

/* ---------------- Footer ---------------- */
.site-footer {
    margin-top: 36px;
}

.footer-inner {
    display: grid;
    gap: 12px;
    padding: 20px 0;
    text-align: center;
}

.footer-rights {
    justify-content: center;
    flex-wrap: wrap;
}

.footer-nav {
    justify-content: center;
}

@media (max-width: 390px) {
    .container {
        width: min(100% - 22px, 520px);
    }

    .brand-name {
        max-width: 116px;
        font-size: 15px;
    }

    .header-inner {
        grid-template-columns: minmax(0, 1fr) 32px 34px 32px auto;
        column-gap: 6px;
    }

    .studio-mark {
        width: 28px;
    }

    .auth-actions .btn-sm {
        min-height: 32px;
        padding-left: 7px;
        padding-right: 7px;
        font-size: 11px;
    }

    .lang-trigger {
        width: 32px;
        height: 32px;
    }

    .mobile-menu-trigger {
        width: 32px;
        height: 32px;
    }

    .main-nav {
        left: 11px;
        right: 11px;
    }

    .main-nav a {
        min-height: 36px;
        padding: 8px 10px;
        font-size: 13px;
    }

    .cinematic .layer-title {
        top: 35%;
        width: min(70vw, 260px);
    }

    .cinematic .layer-portrait {
        right: -10vw;
        width: min(68vw, 44vh);
    }

    .cinematic .hero-tagline p {
        font-size: 25px;
    }

    .teaser-party {
        transform: translateX(calc(-50% - 84px));
    }

    .teaser-enemies {
        transform: translateX(calc(-50% + 84px));
    }

    .teaser-sprite {
        width: min(28vw, 104px);
    }

    .teaser-goblin-stack {
        width: min(31vw, 114px);
    }

    .teaser-skeleton-mage {
        width: min(28vw, 104px);
        margin-left: -36px;
    }

    .char-grid,
    .char-grid-preview {
        gap: 7px;
    }
}

.portrait-lightbox {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(3, 6, 10, .92);
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
}

.portrait-lightbox.is-open {
    opacity: 1;
    pointer-events: auto;
}

.portrait-lightbox img {
    max-width: min(92vw, 560px);
    max-height: 86svh;
    display: block;
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(0 18px 34px rgba(0,0,0,.55));
    transform: scale(.96);
    transition: transform .22s ease;
}

.portrait-lightbox.is-open img {
    transform: scale(1);
}

.portrait-lightbox button {
    position: absolute;
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(242,207,121,.42);
    border-radius: 999px;
    background: rgba(11,15,20,.82);
    color: #fff;
    font: 700 20px/1 var(--font-game);
    cursor: pointer;
}

body.has-portrait-lightbox {
    overflow: hidden;
}
