/* =========================================
   MOON SPIDER CONSPIRACY
   Case File / Research Archive / Field Manual
   ========================================= */

:root {
    --night: #090d12;
    --night-soft: #111820;
    --panel-dark: #151d25;

    --paper: #e8e3d5;
    --paper-light: #f3efe4;
    --paper-aged: #d8cfb9;
    --ink: #20262b;
    --muted-ink: #60666a;

    --moon: #a9d8df;
    --moon-bright: #d8f5f7;
    --archive-blue: #416c77;
    --field-olive: #66705a;
    --hazard: #d0a84c;
    --classified: #8d332f;
    --classified-dark: #67231f;

    --line: rgba(32, 38, 43, 0.24);
    --content: 76ch;
    --wide: 1220px;
    --header-height: 74px;

    --sans: Arial, Helvetica, sans-serif;
    --serif: Georgia, "Times New Roman", serif;
    --mono: "Courier New", Courier, monospace;
}

/* ---------- Foundation ---------- */

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

html {
    scroll-behavior: smooth;
    background: var(--night);
}

body {
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 50% -12rem, rgba(169, 216, 223, 0.12), transparent 44rem),
        var(--night);
    font-family: var(--sans);
    line-height: 1.72;
}

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

a {
    color: var(--archive-blue);
    text-underline-offset: 0.18em;
}

a:hover {
    text-decoration-thickness: 2px;
}

h1,
h2,
h3,
h4,
h5 {
    margin-top: 0;
    line-height: 1.16;
    text-wrap: balance;
}

p,
li {
    text-wrap: pretty;
}

::selection {
    color: var(--night);
    background: var(--moon);
}

/* ---------- Site Header ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;

    min-height: var(--header-height);
    padding: 0.7rem clamp(1rem, 4vw, 3rem);

    color: var(--moon-bright);
    background: rgba(9, 13, 18, 0.94);
    border-bottom: 1px solid rgba(169, 216, 223, 0.35);
    backdrop-filter: blur(12px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    color: inherit;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 2rem;
    aspect-ratio: 1;
    color: var(--moon);
    border: 1px solid currentColor;
    border-radius: 50%;
    box-shadow: 0 0 1.25rem rgba(169, 216, 223, 0.2);
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-family: var(--mono);
    font-size: 0.9rem;
    letter-spacing: 0.13em;
}

.brand small {
    margin-top: 0.1rem;
    color: #91a6ad;
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.18em;
}

.top-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.35rem 1.2rem;
}

.top-nav a {
    color: #b9c8cd;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-decoration: none;
    text-transform: uppercase;
}

.top-nav a:hover,
.top-nav a:focus-visible {
    color: var(--moon-bright);
}

/* ---------- Hero / Case Cover ---------- */

.hero {
    position: relative;
    isolation: isolate;

    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.6fr);
    align-items: end;
    gap: clamp(2rem, 6vw, 6rem);

    min-height: min(760px, calc(100svh - var(--header-height)));
    padding: clamp(4rem, 10vw, 8rem) clamp(1.25rem, 7vw, 7rem) clamp(3rem, 7vw, 6rem);

    color: #edf5f6;
    background:
        linear-gradient(90deg, rgba(5, 9, 13, 0.9) 0%, rgba(5, 9, 13, 0.7) 48%, rgba(5, 9, 13, 0.36) 100%),
        linear-gradient(0deg, rgba(5, 9, 13, 0.9), transparent 55%),
        url("img/moon-spider-bg.jpg") center / cover no-repeat;
}

.hero::after {
    content: "";
    position: absolute;
    inset: 1.25rem;
    z-index: -1;
    border: 1px solid rgba(169, 216, 223, 0.36);
    pointer-events: none;
}

.hero-inner {
    max-width: 800px;
}

.eyebrow,
.section-kicker,
.index-label {
    margin: 0 0 0.8rem;
    color: var(--moon);
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.hero h1 {
    max-width: 10ch;
    margin-bottom: 1.2rem;
    color: #fff;
    font-family: var(--serif);
    font-size: clamp(3rem, 8vw, 7.5rem);
    font-weight: 700;
    letter-spacing: -0.035em;
}

.hero-deck {
    max-width: 58ch;
    margin-bottom: 0;
    color: #d3dde0;
    font-family: var(--serif);
    font-size: clamp(1.05rem, 2vw, 1.35rem);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 2rem;
}

.button {
    display: inline-block;
    padding: 0.82rem 1.1rem;
    font-family: var(--mono);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-decoration: none;
    text-transform: uppercase;
    border: 1px solid var(--moon);
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}

.button.primary {
    color: var(--night);
    background: var(--moon);
}

.button.ghost {
    color: var(--moon-bright);
    background: rgba(9, 13, 18, 0.45);
}

.button:hover,
.button:focus-visible {
    transform: translateY(-1px);
}

.case-meta {
    align-self: end;
    margin: 0;
    padding: 1rem 1.2rem;
    background: rgba(9, 13, 18, 0.78);
    border: 1px solid rgba(169, 216, 223, 0.38);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
}

.case-meta div {
    display: grid;
    grid-template-columns: 8.5rem 1fr;
    gap: 1rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid rgba(169, 216, 223, 0.14);
}

.case-meta div:last-child {
    border-bottom: 0;
}

.case-meta dt,
.case-meta dd {
    margin: 0;
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.07em;
}

.case-meta dt {
    color: #718991;
}

.case-meta dd {
    color: var(--moon-bright);
}

.case-meta .alert {
    color: #ffcc6c;
}

/* ---------- Lines of Inquiry ---------- */

.lines-of-inquiry {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: min(calc(100% - 2rem), var(--wide));
    margin: -1.5rem auto 3rem;
    position: relative;
    z-index: 5;
    background: var(--paper-light);
    border: 1px solid rgba(169, 216, 223, 0.35);
    box-shadow: 0 20px 55px rgba(0, 0, 0, 0.25);
}

.lines-of-inquiry > div {
    position: relative;
    min-height: 130px;
    padding: 1.25rem;
    border-right: 1px solid var(--line);
}

.lines-of-inquiry > div:last-child {
    border-right: 0;
}

.lines-of-inquiry span {
    display: block;
    margin-bottom: 1.2rem;
    color: var(--classified);
    font-family: var(--mono);
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.lines-of-inquiry strong,
.lines-of-inquiry small {
    display: block;
}

.lines-of-inquiry strong {
    font-family: var(--serif);
    font-size: 1.02rem;
}

.lines-of-inquiry small {
    margin-top: 0.35rem;
    color: var(--muted-ink);
    line-height: 1.4;
}

/* ---------- Dossier Layout ---------- */

.case-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: clamp(2rem, 5vw, 5rem);
    width: min(calc(100% - 2rem), var(--wide));
    margin: 0 auto 5rem;
    align-items: start;
}

.case-index {
    position: sticky;
    top: calc(var(--header-height) + 1.5rem);
    padding: 1.25rem;
    color: #cad7da;
    background: var(--panel-dark);
    border: 1px solid rgba(169, 216, 223, 0.2);
}

.case-index .index-label {
    margin-bottom: 0.35rem;
}

.index-note {
    margin: 0 0 1.2rem;
    color: #8ca0a6;
    font-size: 0.78rem;
    line-height: 1.45;
}

.case-index ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

.case-index li + li {
    border-top: 1px solid rgba(169, 216, 223, 0.12);
}

.case-index a {
    display: grid;
    grid-template-columns: 2rem 1fr;
    gap: 0.55rem;
    padding: 0.7rem 0.2rem;
    color: #bdc9cd;
    font-size: 0.78rem;
    line-height: 1.25;
    text-decoration: none;
}

.case-index a:hover,
.case-index a:focus-visible {
    color: var(--moon-bright);
}

.index-number {
    color: var(--moon);
    font-family: var(--mono);
    font-size: 0.68rem;
}

.index-warning {
    margin-top: 1.3rem;
    padding: 0.8rem;
    color: #d8cab0;
    background: rgba(208, 168, 76, 0.08);
    border: 1px solid rgba(208, 168, 76, 0.35);
}

.index-warning strong {
    color: var(--hazard);
    font-family: var(--mono);
    font-size: 0.67rem;
    letter-spacing: 0.14em;
}

.index-warning p {
    margin: 0.35rem 0 0;
    font-size: 0.72rem;
    line-height: 1.45;
}

.case-file {
    min-width: 0;
}

/* ---------- Major Case Sections ---------- */

.case-section {
    position: relative;
    max-width: 100%;
    margin: 0 0 2rem;
    padding: clamp(2rem, 5vw, 4rem);
    color: var(--ink);
    background: var(--paper-light);
    border: 1px solid rgba(232, 227, 213, 0.55);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
    scroll-margin-top: calc(var(--header-height) + 1.25rem);
}

.case-section::before {
    content: attr(data-file);
    position: absolute;
    top: 0;
    right: 0;
    padding: 0.45rem 0.75rem;
    color: var(--paper-light);
    background: var(--archive-blue);
    font-family: var(--mono);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.case-section > :not(.subfile) {
    max-width: var(--content);
}

.case-section > h2 {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    color: var(--ink);
    font-family: var(--serif);
    font-size: clamp(2rem, 4.5vw, 3.5rem);
    border-bottom: 1px solid var(--line);
}

.case-section h3 {
    margin-top: 2.25rem;
    margin-bottom: 0.8rem;
    color: #26363d;
    font-family: var(--serif);
    font-size: clamp(1.35rem, 2.6vw, 2rem);
}

.case-section h4 {
    margin: 1.6rem 0 0.35rem;
    color: var(--archive-blue);
    font-family: var(--mono);
    font-size: 0.88rem;
    letter-spacing: 0.035em;
    text-transform: uppercase;
}

.case-section h5 {
    margin: 1.5rem 0 0.5rem;
    font-family: var(--mono);
    font-size: 0.82rem;
    letter-spacing: 0.04em;
}

.case-section ul,
.case-section ol {
    max-width: var(--content);
    padding-left: 1.4rem;
}

.case-section li {
    margin: 0.45rem 0;
}

.case-section blockquote {
    position: relative;
    max-width: 66ch;
    margin: 2rem 0;
    padding: 1.2rem 1.4rem 1.2rem 1.7rem;
    color: #364047;
    background: rgba(65, 108, 119, 0.07);
    border-left: 4px solid var(--archive-blue);
    font-family: var(--serif);
    font-size: 1.08rem;
}

.case-section blockquote::before {
    content: "FIELD NOTE";
    display: block;
    margin-bottom: 0.45rem;
    color: var(--archive-blue);
    font-family: var(--mono);
    font-size: 0.62rem;
    font-style: normal;
    font-weight: 700;
    letter-spacing: 0.14em;
}

.case-section blockquote em {
    font-style: italic;
}

/* ---------- Archive Sections ---------- */

.archive {
    background:
        linear-gradient(rgba(255, 255, 255, 0.12), rgba(108, 86, 56, 0.03)),
        var(--paper);
}

.archive::before {
    background: #755f43;
}

.archive .section-kicker {
    color: #755f43;
}

.archive h4 {
    padding-top: 0.9rem;
    border-top: 1px dashed rgba(117, 95, 67, 0.34);
}

.media-archive > ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem 2rem;
    padding-left: 1.2rem;
}

/* ---------- Research / Biological Notes ---------- */

.research {
    background: #e3e8e6;
    border-color: #c3cfcb;
}

.research::before {
    background: var(--field-olive);
}

.research .section-kicker {
    color: var(--field-olive);
}

.research > ul {
    margin-top: 1.2rem;
    padding: 0;
    list-style: none;
}

.research > ul > li {
    padding: 0.8rem 0.9rem;
    background: rgba(255, 255, 255, 0.42);
    border-left: 3px solid rgba(102, 112, 90, 0.55);
}

/* ---------- Lunar Evidence ---------- */

.evidence {
    color: #dce7e9;
    background:
        radial-gradient(circle at 88% 15%, rgba(169, 216, 223, 0.12), transparent 20rem),
        #172028;
    border-color: rgba(169, 216, 223, 0.25);
}

.evidence::before {
    color: var(--night);
    background: var(--moon);
}

.evidence .section-kicker,
.evidence a {
    color: var(--moon);
}

.evidence > h2,
.evidence h3,
.evidence h4 {
    color: #eef7f8;
}

.evidence > h2 {
    border-bottom-color: rgba(169, 216, 223, 0.22);
}

.evidence blockquote {
    color: #dce7e9;
    background: rgba(169, 216, 223, 0.06);
    border-left-color: var(--moon);
}

.evidence blockquote::before {
    color: var(--moon);
}

/* ---------- Classified Dossier ---------- */

.classified {
    background:
        linear-gradient(90deg, transparent 0 97%, rgba(141, 51, 47, 0.045) 97%),
        var(--paper-light);
    border-top: 5px solid var(--classified);
}

.classified::before {
    content: "RESTRICTED // FILE 06";
    color: #fff5ef;
    background: var(--classified);
}

.classified::after {
    content: "CLASSIFIED";
    position: absolute;
    top: 5rem;
    right: 2rem;
    transform: rotate(-8deg);
    padding: 0.28rem 0.55rem;
    color: rgba(141, 51, 47, 0.48);
    border: 3px solid rgba(141, 51, 47, 0.38);
    font-family: var(--mono);
    font-size: clamp(1rem, 2vw, 1.45rem);
    font-weight: 900;
    letter-spacing: 0.13em;
    pointer-events: none;
}

.classified .section-kicker,
.classified h4,
.classified a {
    color: var(--classified);
}

.classified blockquote {
    background: rgba(141, 51, 47, 0.055);
    border-left-color: var(--classified);
}

.classified blockquote::before {
    color: var(--classified);
}

.subfile {
    max-width: var(--content);
    margin: 2.2rem 0 0;
    padding: 1.35rem 1.5rem 1.5rem;
    background: rgba(255, 255, 255, 0.46);
    border: 1px solid var(--line);
    scroll-margin-top: calc(var(--header-height) + 1rem);
}

.subfile h2,
.subfile h3 {
    margin-top: 0;
}

.classified > .subfile {
    border-left: 4px solid rgba(141, 51, 47, 0.55);
}

/* ---------- Field Manual ---------- */

.field-manual {
    background: #d9d9c8;
    border: 1px solid #a9ad91;
    border-top: 5px solid var(--hazard);
}

.field-manual::before {
    content: "EMERGENCY // FILE 07";
    color: var(--night);
    background: var(--hazard);
}

.field-manual .section-kicker {
    color: #64521e;
}

.field-manual > h2 {
    font-family: var(--mono);
    letter-spacing: -0.03em;
}

.field-manual > .subfile {
    position: relative;
    background: #e7e7d8;
    border-color: rgba(102, 112, 90, 0.5);
    border-left: 5px solid var(--field-olive);
}

.field-manual > .subfile:nth-of-type(even) {
    background: #ededdf;
}

.field-manual h3 {
    color: #344035;
}

.field-manual blockquote {
    color: #373b32;
    background: rgba(102, 112, 90, 0.1);
    border-left-color: var(--field-olive);
}

.field-manual blockquote::before {
    content: "SURVIVOR NOTE";
    color: var(--field-olive);
}

.field-manual a {
    color: #4a5e4a;
}

/* ---------- Closeout ---------- */

.closeout {
    color: #dde7e9;
    background: #182128;
    border-color: rgba(169, 216, 223, 0.23);
}

.closeout::before {
    color: var(--night);
    background: var(--moon);
}

.closeout .section-kicker {
    color: var(--moon);
}

.closeout > h2 {
    color: #f5fbfc;
    border-bottom-color: rgba(169, 216, 223, 0.2);
}

.closeout p {
    color: #becdd1;
}

/* ---------- Footer ---------- */

footer {
    padding: 3rem 1.5rem 4rem;
    color: #a8b8bd;
    text-align: center;
    background: #070a0e;
    border-top: 1px solid rgba(169, 216, 223, 0.22);
}

footer strong {
    color: var(--moon-bright);
    font-family: var(--mono);
    letter-spacing: 0.1em;
}

footer p {
    margin: 0.25rem 0;
}

footer a {
    display: inline-block;
    margin-top: 1rem;
    color: var(--moon);
    font-family: var(--mono);
    font-size: 0.75rem;
    text-transform: uppercase;
}

/* ---------- Focus / Accessibility ---------- */

a:focus-visible,
button:focus-visible {
    outline: 3px solid var(--hazard);
    outline-offset: 4px;
}

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
    .hero {
        grid-template-columns: 1fr;
        align-items: end;
    }

    .case-meta {
        max-width: 620px;
    }

    .lines-of-inquiry {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .lines-of-inquiry > div:nth-child(2) {
        border-right: 0;
    }

    .lines-of-inquiry > div:nth-child(-n + 2) {
        border-bottom: 1px solid var(--line);
    }

    .case-layout {
        grid-template-columns: 1fr;
    }

    .case-index {
        position: sticky;
        top: var(--header-height);
        z-index: 50;
        padding: 0.7rem;
        overflow-x: auto;
        white-space: nowrap;
    }

    .case-index .index-label,
    .case-index .index-note,
    .index-warning {
        display: none;
    }

    .case-index ol {
        display: flex;
        width: max-content;
    }

    .case-index li + li {
        border-top: 0;
        border-left: 1px solid rgba(169, 216, 223, 0.12);
    }

    .case-index a {
        display: inline-flex;
        align-items: center;
        padding: 0.65rem 0.85rem;
    }
}

@media (max-width: 700px) {
    :root {
        --header-height: 62px;
    }

    .site-header {
        min-height: var(--header-height);
        padding-inline: 0.8rem;
    }

    .brand small,
    .top-nav {
        display: none;
    }

    .hero {
        min-height: calc(100svh - var(--header-height));
        padding: 4rem 1.2rem 2rem;
    }

    .hero::after {
        inset: 0.6rem;
    }

    .hero h1 {
        font-size: clamp(2.8rem, 16vw, 5rem);
    }

    .hero-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .button {
        text-align: center;
    }

    .case-meta div {
        grid-template-columns: 1fr;
        gap: 0.15rem;
    }

    .lines-of-inquiry {
        width: calc(100% - 1rem);
        grid-template-columns: 1fr;
    }

    .lines-of-inquiry > div,
    .lines-of-inquiry > div:nth-child(2) {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .lines-of-inquiry > div:last-child {
        border-bottom: 0;
    }

    .case-layout {
        width: 100%;
        gap: 0;
        margin-bottom: 0;
    }

    .case-file {
        padding: 0 0.5rem 2rem;
    }

    .case-section {
        padding: 2rem 1.15rem;
        margin-bottom: 0.75rem;
    }

    .case-section::before {
        position: static;
        display: inline-block;
        margin: -0.3rem 0 1rem;
    }

    .classified::after {
        display: none;
    }

    .media-archive > ul {
        grid-template-columns: 1fr;
    }

    .subfile {
        padding: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
