/*
 * ARTAV landing page.
 *
 * Dark, gold and serif: the page should read like something printed on a war
 * banner, not like a SaaS product. The rules below are a small system rather
 * than a pile of one-off values — colour, space and type each come from one
 * scale, so a new section can be built without inventing anything.
 */

:root {
    /* --- colour ----------------------------------------------------------- */
    --bg: #0a1018;
    --bg-raised: #0e1621;
    --panel: #101a26;
    --panel-2: #151f2b;

    --text: #f4ead6;
    /* Lifted from the original #aeb7c2 to clear 7:1 on the page background,
       because most of the prose on this page is in this colour. */
    --muted: #c3ccd7;
    --faint: #9aa5b1;

    --gold: #d8aa57;
    --gold-light: #f0d28d;
    --gold-deep: #bc8735;

    --human: #315b9b;
    --orc: #913832;

    --line: rgba(255, 255, 255, 0.12);
    --line-strong: rgba(255, 255, 255, 0.22);

    /* --- type ------------------------------------------------------------- */
    --display: ui-serif, Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Times New Roman', serif;
    --body:
        ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

    /* One scale, used everywhere. Each step fluid between a phone and a desk. */
    --step--1: clamp(0.78rem, 0.76rem + 0.1vw, 0.84rem);
    --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.12rem);
    --step-1: clamp(1.15rem, 1.05rem + 0.5vw, 1.4rem);
    --step-2: clamp(1.4rem, 1.2rem + 1vw, 2rem);
    --step-3: clamp(1.8rem, 1.4rem + 2vw, 3rem);
    --step-4: clamp(2.2rem, 1.5rem + 3.4vw, 4rem);

    /* --- space ------------------------------------------------------------ */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 2.75rem;
    --space-8: 4rem;
    /* Vertical rhythm between major sections, fluid so that a phone is not
       scrolled through acres of emptiness. */
    --section: clamp(4rem, 9vw, 7.5rem);

    --gutter: clamp(1.15rem, 5vw, 3rem);
    --max: 1180px;
    --measure: 62ch;

    --ring: 0 0 0 3px rgba(240, 210, 141, 0.55);
    --lift: 0 10px 35px rgba(0, 0, 0, 0.28);
}

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

html {
    scroll-behavior: smooth;
    /* Anchored sections must not land under the fixed header. */
    scroll-padding-top: 5.5rem;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--display);
    font-size: var(--step-0);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img {
    display: block;
    width: 100%;
    height: auto;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
    color: inherit;
}

h1,
h2,
h3 {
    font-weight: 700;
    line-height: 1.05;
    text-wrap: balance;
}

p {
    text-wrap: pretty;
}

/* One focus treatment for everything that takes focus. The original had none,
   which left the whole page unusable by keyboard. */
:focus-visible {
    outline: 2px solid var(--gold-light);
    outline-offset: 3px;
    border-radius: 2px;
}

.skip-link {
    position: absolute;
    top: var(--space-3);
    left: var(--space-3);
    z-index: 100;
    padding: var(--space-3) var(--space-4);
    background: var(--gold-light);
    color: #161108;
    font-family: var(--body);
    font-weight: 700;
    transform: translateY(-160%);
    transition: transform 0.18s ease;
}

.skip-link:focus {
    transform: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- header ---------------------------------------------------------------- */

.topbar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 20;
    min-height: 4.5rem;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: var(--space-6);
    padding: 0 var(--gutter);
    background: linear-gradient(to bottom, rgba(5, 9, 14, 0.94), rgba(5, 9, 14, 0.42), transparent);
    transition:
        background 0.25s ease,
        box-shadow 0.25s ease;
}

/* Once the hero is behind it, the bar needs a floor of its own or the links
   sit on whatever happens to be underneath. */
.topbar.is-scrolled {
    background: rgba(7, 11, 17, 0.94);
    box-shadow: 0 1px 0 var(--line);
    backdrop-filter: blur(8px);
}

.brand {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    color: var(--gold-light);
}

.nav {
    justify-self: center;
    display: flex;
    gap: var(--space-6);
    font-family: var(--body);
    font-size: var(--step--1);
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.nav a {
    color: rgba(255, 255, 255, 0.86);
    padding: var(--space-2) 0;
    border-bottom: 1px solid transparent;
    transition:
        color 0.18s ease,
        border-color 0.18s ease;
}

.nav a:hover,
.nav a:focus-visible {
    color: var(--gold-light);
    border-bottom-color: var(--gold);
}

.menu-toggle {
    display: none;
    background: none;
    border: 0;
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    padding: var(--space-2);
    cursor: pointer;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    justify-self: end;
}

/* --- buttons --------------------------------------------------------------- */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 3.25rem;
    padding: 0 var(--space-7);
    border: 1px solid #f2cf83;
    background: linear-gradient(180deg, #e8bd67, #bc8735);
    color: #161108;
    font-family: var(--body);
    font-weight: 800;
    font-size: var(--step--1);
    text-transform: uppercase;
    letter-spacing: 0.09em;
    box-shadow: var(--lift);
    cursor: pointer;
    transition:
        filter 0.18s ease,
        transform 0.18s ease;
}

.button:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.button:active {
    transform: translateY(0);
    filter: brightness(0.96);
}

/* The war is playable; the campaign is not. The quiet button is the one that
   asks for an email, and the loud one is the one that starts a battle. */
.button-ghost {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--line-strong);
    color: var(--text);
    box-shadow: none;
}

.button-ghost:hover {
    border-color: var(--gold);
    color: var(--gold-light);
    filter: none;
}

.button-small {
    min-height: 2.6rem;
    padding: 0 var(--space-4);
    font-size: 0.75rem;
}

.text-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--body);
    font-size: var(--step--1);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding-bottom: var(--space-1);
    border-bottom: 1px solid var(--line-strong);
    transition:
        color 0.18s ease,
        border-color 0.18s ease;
}

.text-link:hover {
    color: var(--gold-light);
    border-bottom-color: var(--gold);
}

/* --- hero ------------------------------------------------------------------ */

.hero {
    position: relative;
    min-height: 100svh;
    display: grid;
    place-items: center;
    overflow: hidden;
    padding: clamp(7rem, 14vh, 10rem) var(--gutter) var(--space-8);
}

.hero-bg {
    position: absolute;
    inset: 0;
    /* A crop from below the banner in the concept art: the artwork has the
       ARTAV wordmark painted into it, and the page puts a real one on top. */
    background-image: image-set(
        url('assets/hero-surface.webp') type('image/webp'),
        url('assets/hero-surface.jpg') type('image/jpeg')
    );
    background-size: cover;
    background-position: center 60%;
    transform: scale(1.025);
}

.hero-vignette {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(
            to bottom,
            rgba(4, 8, 14, 0.2) 0%,
            rgba(4, 8, 14, 0.3) 45%,
            rgba(4, 8, 14, 0.92) 100%
        ),
        radial-gradient(circle at center, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.58));
}

.hero-content {
    position: relative;
    z-index: 2;
    width: min(50rem, 100%);
    text-align: center;
}

.hero-logo {
    width: min(34rem, 88%);
    margin: 0 auto var(--space-4);
    filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.45));
}

.hero h1 {
    font-size: var(--step-4);
    margin: var(--space-2) 0 var(--space-5);
    text-shadow: 0 4px 18px rgba(0, 0, 0, 0.7);
}

.hero-copy {
    max-width: 44ch;
    margin: 0 auto var(--space-7);
    font-family: var(--body);
    font-size: var(--step-1);
    color: #f1eadf;
    text-shadow: 0 3px 12px rgba(0, 0, 0, 0.9);
}

.hero-actions {
    display: flex;
    gap: var(--space-5);
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.hero-note {
    margin: var(--space-5) 0 0;
    font-family: var(--body);
    font-size: var(--step--1);
    color: rgba(255, 255, 255, 0.72);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
}

.eyebrow {
    margin: 0 0 var(--space-3);
    font-family: var(--body);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--gold-light);
}

.scroll-hint {
    position: absolute;
    bottom: var(--space-5);
    z-index: 2;
    font-family: var(--body);
    font-size: 0.65rem;
    letter-spacing: 0.26em;
    color: rgba(255, 255, 255, 0.75);
}

/* --- shared section furniture ---------------------------------------------- */

.section-dark {
    background: linear-gradient(180deg, #0b1119, #101925);
}

.shell {
    max-width: var(--max);
    margin: 0 auto;
    padding-inline: var(--gutter);
}

.section-copy h2,
.section-heading h2,
.story h2,
.cta h2,
.feature-card h2 {
    margin: 0 0 var(--space-5);
    font-size: var(--step-3);
}

.section-copy > p:not(.eyebrow),
.story p,
.cta p,
.feature-card p {
    max-width: var(--measure);
    font-family: var(--body);
    font-size: var(--step-0);
    color: var(--muted);
}

/* --- pillars ---------------------------------------------------------------- */

.pillars {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-block: 1px solid var(--line);
}

.pillar {
    padding: var(--space-7) var(--space-6) var(--space-8);
    border-right: 1px solid var(--line);
}

.pillar:last-child {
    border-right: 0;
}

.pillar span {
    font-family: var(--body);
    font-size: 0.75rem;
    letter-spacing: 0.18em;
    color: var(--gold);
}

.pillar h2 {
    margin: var(--space-3) 0 var(--space-2);
    font-size: var(--step-2);
}

.pillar p {
    margin: 0;
    font-family: var(--body);
    font-size: 0.95rem;
    color: var(--muted);
}

/* --- persistent war map ------------------------------------------------------ */

.war-map {
    max-width: var(--max);
    margin: 0 auto;
    padding: var(--section) var(--gutter);
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    gap: clamp(2.5rem, 6vw, 5rem);
    align-items: center;
}

.stat-grid {
    margin-top: var(--space-7);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
}

.stat-grid div {
    border-top: 1px solid var(--line);
    padding-top: var(--space-4);
}

.stat-grid strong {
    display: block;
    font-size: var(--step-2);
    color: var(--gold-light);
}

.stat-grid span {
    font-family: var(--body);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

/*
 * The map is decorative, and it is drawn proportionally: every tile is placed
 * in percentages inside a fixed-ratio box, so it scales with the column
 * instead of being re-positioned by hand at each breakpoint.
 */
/* 7:6 keeps the field the shape the tile positions below were measured in. */
.hex-field {
    position: relative;
    aspect-ratio: 7 / 6;
    background: radial-gradient(circle at 50% 45%, #23384c, #0c131d 70%);
    border: 1px solid var(--line);
    overflow: hidden;
}

.hex {
    position: absolute;
    width: 20%;
    aspect-ratio: 8 / 7;
    clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
    display: grid;
    place-items: center;
    font-family: var(--body);
    font-size: clamp(0.9rem, 2.2vw, 1.6rem);
    font-weight: 700;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.human {
    background: linear-gradient(145deg, #3d69ad, #1b3154);
}

.orc {
    background: linear-gradient(145deg, #a4463f, #4d1f1d);
}

.neutral {
    background: linear-gradient(145deg, #665e50, #2f2b26);
}

.battle {
    background: linear-gradient(145deg, #c9943c, #6f4720);
    color: #fff4cf;
}

.h1 {
    left: 12.5%;
    top: 14.6%;
}

.h2 {
    left: 29.5%;
    top: 26%;
}

.h3 {
    left: 46.4%;
    top: 14.6%;
}

.h4 {
    left: 12.5%;
    top: 37.5%;
}

.h5 {
    left: 29.5%;
    top: 49%;
}

.h6 {
    left: 46.4%;
    top: 37.5%;
}

.h7 {
    left: 12.5%;
    top: 60.4%;
}

.h8 {
    left: 46.4%;
    top: 60.4%;
}

.h9 {
    left: 63.4%;
    top: 49%;
}

.frontline {
    position: absolute;
    left: 43.7%;
    top: 6.25%;
    width: 2px;
    height: 87.5%;
    background: linear-gradient(transparent, var(--gold-light), transparent);
    transform: rotate(-12deg);
    box-shadow: 0 0 20px var(--gold);
}

.map-label {
    position: absolute;
    right: var(--space-5);
    bottom: var(--space-4);
    font-family: var(--body);
    font-size: 0.68rem;
    letter-spacing: 0.22em;
    color: rgba(255, 255, 255, 0.72);
}

/* --- image features ---------------------------------------------------------- */

.feature {
    position: relative;
    display: grid;
    align-items: end;
    min-height: min(85svh, 42rem);
    overflow: hidden;
}

.feature-media,
.feature-media img {
    position: absolute;
    inset: 0;
    height: 100%;
    margin: 0;
}

.feature-media img {
    object-fit: cover;
}

.feature::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        rgba(7, 11, 17, 0.92) 0%,
        rgba(7, 11, 17, 0.58) 38%,
        rgba(7, 11, 17, 0.08) 72%
    );
}

.feature-reverse::after {
    background: linear-gradient(
        270deg,
        rgba(7, 11, 17, 0.93) 0%,
        rgba(7, 11, 17, 0.58) 42%,
        rgba(7, 11, 17, 0.08) 72%
    );
}

/* Placed by the grid rather than by a padding-top guess. */
.feature-card {
    position: relative;
    z-index: 2;
    width: min(33rem, 100%);
    justify-self: start;
    margin: var(--section) max(var(--gutter), calc((100vw - var(--max)) / 2));
}

.feature-reverse .feature-card {
    justify-self: end;
}

/* --- story ------------------------------------------------------------------- */

.story {
    padding: var(--section) var(--gutter);
    text-align: center;
}

.story-inner {
    max-width: 53rem;
    margin: 0 auto;
}

.story-inner p {
    margin-inline: auto;
}

/* --- gallery ----------------------------------------------------------------- */

.gallery {
    max-width: var(--max);
    margin: 0 auto;
    padding: var(--section) var(--gutter);
}

.section-heading {
    margin-bottom: var(--space-7);
}

.gallery-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: var(--space-4);
}

.gallery-grid figure {
    position: relative;
    margin: 0;
    overflow: hidden;
    background: #111;
    min-height: 20rem;
}

.gallery-grid figure.wide {
    grid-row: span 2;
}

.gallery-grid img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-grid figure:hover img {
    transform: scale(1.03);
}

.gallery-grid figcaption {
    position: absolute;
    inset: auto 0 0 0;
    padding: var(--space-8) var(--space-5) var(--space-4);
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.82));
    font-family: var(--body);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

/* --- closing call ------------------------------------------------------------- */

.cta {
    position: relative;
    padding: var(--section) var(--gutter);
    text-align: center;
    background:
        linear-gradient(rgba(8, 13, 20, 0.5), rgba(8, 13, 20, 0.9)),
        image-set(
                url('assets/hero-surface.webp') type('image/webp'),
                url('assets/hero-surface.jpg') type('image/jpeg')
            )
            center 55% / cover;
}

.cta-inner {
    max-width: 48rem;
    margin: 0 auto;
}

.cta p {
    margin-inline: auto;
}

.cta-actions {
    display: flex;
    justify-content: center;
    margin-top: var(--space-6);
}

.signup {
    display: flex;
    max-width: 38rem;
    margin: var(--space-6) auto var(--space-2);
}

.signup input {
    flex: 1;
    min-width: 0;
    min-height: 3.25rem;
    padding: 0 var(--space-4);
    border: 1px solid var(--line-strong);
    border-right: 0;
    background: rgba(7, 11, 17, 0.84);
    color: #fff;
    font-family: var(--body);
}

.signup input::placeholder {
    color: var(--faint);
}

.signup input:focus-visible {
    outline-offset: -2px;
    border-color: var(--gold);
}

.form-note {
    min-height: 1.5rem;
    margin: 0;
    font-family: var(--body);
    font-size: var(--step--1);
    color: var(--muted);
}

/* --- footer -------------------------------------------------------------------- */

footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-5);
    flex-wrap: wrap;
    padding: var(--space-6) var(--gutter);
    border-top: 1px solid var(--line);
    font-family: var(--body);
    font-size: 0.78rem;
    color: var(--faint);
}

footer strong {
    font-family: var(--display);
    font-size: 1.1rem;
    letter-spacing: 0.14em;
    color: var(--gold-light);
}

.footer-links {
    display: flex;
    gap: var(--space-5);
}

.footer-links a:hover {
    color: var(--gold-light);
}

/* --- motion --------------------------------------------------------------------- */

/*
 * Reveal-on-scroll is an enhancement, not a requirement. It only hides anything
 * once the script has announced itself, so a reader with no JavaScript — or a
 * script that failed to load — still sees the whole page.
 */
.js .reveal {
    opacity: 0;
    transform: translateY(20px);
    transition:
        opacity 0.7s ease,
        transform 0.7s ease;
}

.js .reveal.visible {
    opacity: 1;
    transform: none;
}

@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;
    }

    .js .reveal {
        opacity: 1;
        transform: none;
    }

    .gallery-grid figure:hover img {
        transform: none;
    }
}

/* --- narrow ---------------------------------------------------------------------- */

@media (max-width: 900px) {
    .topbar {
        grid-template-columns: auto 1fr auto;
        gap: var(--space-3);
    }

    .nav {
        display: none;
        position: absolute;
        top: 4.25rem;
        left: var(--gutter);
        right: var(--gutter);
        flex-direction: column;
        gap: var(--space-4);
        padding: var(--space-5);
        background: #0b121c;
        border: 1px solid var(--line);
    }

    .nav.open {
        display: flex;
    }

    .menu-toggle {
        display: block;
        order: 3;
    }

    .pillars {
        grid-template-columns: repeat(2, 1fr);
    }

    .pillar:nth-child(2) {
        border-right: 0;
    }

    .war-map {
        grid-template-columns: 1fr;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .gallery-grid figure.wide {
        grid-row: auto;
    }

    /* The card sits over the foot of the image rather than beside it. */
    .feature::after,
    .feature-reverse::after {
        background: linear-gradient(
            to top,
            rgba(7, 11, 17, 0.96) 0%,
            rgba(7, 11, 17, 0.56) 58%,
            rgba(7, 11, 17, 0.12)
        );
    }

    .feature-card,
    .feature-reverse .feature-card {
        justify-self: stretch;
        width: auto;
        margin: var(--space-8) var(--gutter) var(--space-7);
    }
}

@media (max-width: 600px) {
    .header-actions .button-small {
        display: none;
    }

    .hero-logo {
        width: 100%;
    }

    .pillars {
        grid-template-columns: 1fr;
    }

    .pillar {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .stat-grid {
        grid-template-columns: 1fr;
    }

    .signup {
        flex-direction: column;
        gap: var(--space-3);
    }

    .signup input {
        border-right: 1px solid var(--line-strong);
    }

    footer {
        flex-direction: column;
        align-items: flex-start;
    }
}
