/* =========================================================================
   Design system — deep neutrals, editorial type, restrained motion.
   ========================================================================= */
:root {
    --bg:          #0a0b0d;
    --bg-soft:     #0e1014;
    --surface:     #121419;
    --surface-2:   #171a20;
    --line:        rgba(255, 255, 255, 0.07);
    --line-strong: rgba(255, 255, 255, 0.13);

    --text:        #ece9e3;   /* warm white */
    --text-dim:    #a4a59d;
    --text-faint:  #6b6c66;

    --accent:      #c9a877;   /* muted sand — used sparingly */
    --accent-soft: rgba(201, 168, 119, 0.14);

    --success:     #8fcf9f;
    --danger:      #d98a82;

    --maxw: 1120px;
    --radius: 16px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);

    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-serif: "Fraunces", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 17px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

a { color: var(--text); text-decoration: none; transition: color 0.25s var(--ease); }
a:hover { color: var(--accent); }
img { max-width: 100%; display: block; }

h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 380; letter-spacing: -0.01em; line-height: 1.12; margin: 0; }
p { margin: 0 0 1.1rem; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }
.text-dim { color: var(--text-dim); }
.text-faint { color: var(--text-faint); }

.eyebrow {
    font-family: var(--font-sans);
    font-size: 0.72rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.22em;
    color: var(--accent);
    margin: 0 0 1.1rem;
}

/* ---------- Atmosphere ---------- */
.atmosphere {
    position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background:
        radial-gradient(120% 80% at 50% -10%, rgba(201, 168, 119, 0.10), transparent 55%),
        radial-gradient(90% 70% at 85% 0%, rgba(80, 110, 150, 0.07), transparent 50%),
        var(--bg);
}
.atmosphere::after {
    /* fine grain so flat areas never look digitally empty */
    content: ""; position: absolute; inset: 0; opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    transition: background 0.4s var(--ease), border-color 0.4s var(--ease), backdrop-filter 0.4s var(--ease);
    border-bottom: 1px solid transparent;
}
.site-header.is-scrolled {
    background: rgba(10, 11, 13, 0.72);
    backdrop-filter: saturate(140%) blur(14px);
    border-bottom-color: var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 76px; }
.brand { font-family: var(--font-serif); font-size: 1.25rem; letter-spacing: -0.01em; color: var(--text); }
.brand:hover { color: var(--text); }
.site-nav { display: flex; gap: 2.2rem; }
.site-nav a { font-size: 0.92rem; color: var(--text-dim); }
.site-nav a:hover { color: var(--text); }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: clamp(5.5rem, 16vh, 10rem) 0 clamp(4rem, 9vh, 7rem); }
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; opacity: 0; transition: opacity 1.4s var(--ease); }
.hero-canvas.is-live { opacity: 1; }
.hero > .wrap { position: relative; z-index: 1; }
.hero-inner { max-width: 760px; }
.hero h1 {
    font-size: clamp(2.9rem, 6.5vw, 5rem);
    line-height: 1.02; margin: 0.4rem 0 1.6rem;
}
.hero h1 em { font-style: italic; color: var(--accent); }
.hero .lead { font-size: clamp(1.1rem, 2vw, 1.32rem); color: var(--text-dim); max-width: 56ch; margin: 0 0 2.4rem; }
.hero-actions { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }

/* ---------- Section rhythm ---------- */
.section { padding: clamp(4rem, 10vh, 7.5rem) 0; }
.section-head { max-width: 640px; margin-bottom: 3rem; }
.section-head h2 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---------- Build ledger counter ---------- */
.build-counter {
    display: grid; grid-template-columns: minmax(0, 1fr) auto 20px;
    align-items: center; gap: clamp(1.2rem, 3vw, 2.2rem);
    margin: 0 0 2rem; padding-top: 1.2rem;
    border-top: 1px solid var(--line); color: var(--text);
}
.build-counter:hover { color: var(--text); }
.build-counter strong {
    display: block; font-family: var(--font-serif);
    font-size: clamp(1.25rem, 2.2vw, 1.65rem); font-weight: 380; line-height: 1.2;
}
.build-counter .eyebrow { display: block; margin-bottom: 0.45rem; }
.build-counter-metrics,
.ledger-summary,
.admin-metrics {
    display: flex; gap: clamp(1.4rem, 4vw, 3.4rem); flex-wrap: wrap;
}
.build-counter-metrics > div,
.ledger-summary > div,
.admin-metrics > div {
    min-width: 130px;
}
.metric-value,
.admin-metrics .n {
    display: block; font-family: var(--font-serif);
    font-size: clamp(1.8rem, 4vw, 2.55rem); line-height: 1; color: var(--text);
}
.metric-label,
.admin-metrics .l {
    display: block; margin-top: 0.55rem;
    font-size: 0.75rem; color: var(--text-faint);
    text-transform: uppercase; letter-spacing: 0.14em;
}

/* ---------- Ledger page ---------- */
.ledger-summary {
    padding-top: 0.5rem;
}
.ledger-grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px;
    background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.ledger-grid > div { background: var(--bg-soft); padding: clamp(1.5rem, 4vw, 2.2rem); }
.ledger-list { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.ledger-row {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
    background: var(--bg-soft); padding: 1rem;
}
.ledger-row h2 {
    font-family: var(--font-sans); font-size: 0.98rem; font-weight: 500;
    line-height: 1.45; margin: 0;
}
.ledger-row strong {
    font-family: var(--font-serif); font-size: 1.2rem; font-weight: 380;
    white-space: nowrap; color: var(--text);
}
.ledger-date {
    display: block; margin-bottom: 0.25rem;
    font-size: 0.74rem; color: var(--text-faint);
    text-transform: uppercase; letter-spacing: 0.12em;
}

/* ---------- Story ---------- */
.story { position: relative; }
.story-grid { display: grid; grid-template-columns: 1fr; gap: 2rem; max-width: 720px; }
.story-lede {
    font-family: var(--font-serif); font-size: clamp(1.4rem, 3vw, 1.9rem);
    line-height: 1.45; color: var(--text); margin-bottom: 2rem;
}
.story-body p { color: var(--text-dim); }
.story-body p + p { margin-top: 0; }
.story-sign { margin-top: 2.2rem; font-family: var(--font-serif); font-style: italic; color: var(--text); }
.story-stats { display: flex; gap: 3rem; flex-wrap: wrap; margin-top: 3.5rem; }
.stat .n { font-family: var(--font-serif); font-size: 2.4rem; line-height: 1; color: var(--text); }
.stat .l { font-size: 0.82rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.14em; margin-top: 0.5rem; }

/* ---------- Games ---------- */
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.game-card {
    display: flex; gap: 1.3rem; align-items: center;
    padding: 1.7rem; background: var(--bg-soft); color: var(--text);
    transition: background 0.4s var(--ease);
}
.game-card:hover { background: var(--surface-2); color: var(--text); }
.game-icon { width: 76px; height: 76px; border-radius: 18px; object-fit: cover; flex: none; border: 1px solid var(--line-strong); }
.game-icon.placeholder { background: linear-gradient(150deg, var(--surface-2), var(--surface)); }
.game-card h3 { font-size: 1.4rem; margin-bottom: 0.25rem; }
.game-card p { font-size: 0.92rem; color: var(--text-dim); margin: 0 0 0.7rem; line-height: 1.5; }
.game-card .meta-row { display: flex; align-items: center; gap: 0.8rem; }
.arrow { color: var(--text-faint); transition: transform 0.4s var(--ease), color 0.4s var(--ease); margin-left: auto; flex: none; align-self: flex-start; }
.game-card:hover .arrow { color: var(--accent); transform: translate(3px, -3px); }

/* ---------- Tags ---------- */
.tag {
    display: inline-flex; align-items: center; gap: 0.45rem;
    font-family: var(--font-sans); font-size: 0.72rem; font-weight: 500;
    letter-spacing: 0.04em; color: var(--text-dim);
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); }
.tag.published::before { background: var(--success); box-shadow: 0 0 10px rgba(143, 207, 159, 0.6); }
.tag.coming_soon::before { background: var(--accent); box-shadow: 0 0 10px rgba(201, 168, 119, 0.5); }

/* ---------- Single game ---------- */
.game-hero { padding: clamp(3rem, 8vh, 5rem) 0 2rem; }
.game-hero-banner {
    border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line);
    background-size: cover; background-position: center; min-height: 320px;
    display: flex; align-items: flex-end;
}
.game-hero-banner.no-art { background: linear-gradient(160deg, var(--surface-2), var(--bg-soft)); }
.game-hero-overlay {
    width: 100%; padding: 2.5rem;
    background: linear-gradient(0deg, rgba(10,11,13,0.92), rgba(10,11,13,0.25) 70%, transparent);
    display: flex; gap: 1.6rem; align-items: flex-end; flex-wrap: wrap;
}
.game-hero-icon { width: 104px; height: 104px; border-radius: 24px; border: 1px solid var(--line-strong); flex: none; }
.game-hero h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); margin-bottom: 0.5rem; }
.game-hero .lead { color: var(--text-dim); max-width: 50ch; margin: 0 0 1.2rem; }

.back-link { display: inline-block; margin-bottom: 1.5rem; font-size: 0.88rem; color: var(--text-faint); }

.video { position: relative; padding-top: 56.25%; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.prose { max-width: 680px; }
.prose p { color: var(--text-dim); }
.prose h2 { font-size: 1.7rem; margin: 2.2rem 0 1rem; }
.prose a { color: var(--accent); }

.shot-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.shot-gallery img { border-radius: 12px; border: 1px solid var(--line); transition: transform 0.5s var(--ease); }
.shot-gallery img:hover { transform: scale(1.015); }

.game-legal { display: flex; gap: 1.6rem; padding-top: 1rem; font-size: 0.88rem; }
.game-legal a { color: var(--text-faint); }

/* ---------- Notify / forms ---------- */
.notify {
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: clamp(2rem, 5vw, 3rem); background: var(--bg-soft); max-width: 620px;
}
.notify h2 { font-size: 1.7rem; margin-bottom: 0.6rem; }
.notify-form { display: flex; gap: 0.7rem; flex-wrap: wrap; margin-top: 1.4rem; }
.notify-form input[type=email] { flex: 1; min-width: 240px; }

input, select, textarea {
    width: 100%; padding: 0.8rem 1rem;
    background: var(--surface); border: 1px solid var(--line-strong); border-radius: 11px;
    color: var(--text); font: inherit; transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: var(--surface-2); }
textarea { resize: vertical; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 0.55rem; cursor: pointer;
    font-family: var(--font-sans); font-size: 0.95rem; font-weight: 500;
    padding: 0.82rem 1.5rem; border-radius: 11px; border: 1px solid transparent;
    transition: transform 0.3s var(--ease), background 0.3s var(--ease), border-color 0.3s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { background: #fff; color: var(--bg); }
.btn-ghost { border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--text); }
.appstore-btn {
    display: inline-flex; align-items: center; gap: 0.6rem;
    background: var(--text); color: var(--bg); font-weight: 500;
    padding: 0.85rem 1.5rem; border-radius: 12px;
    transition: transform 0.3s var(--ease), background 0.3s var(--ease);
}
.appstore-btn:hover { transform: translateY(-1px); background: #fff; color: var(--bg); }

button[type=submit] {
    cursor: pointer; font: inherit; font-weight: 500; color: var(--bg);
    background: var(--text); border: 0; padding: 0.82rem 1.6rem; border-radius: 11px;
    transition: transform 0.3s var(--ease), background 0.3s var(--ease);
}
button[type=submit]:hover { transform: translateY(-1px); background: #fff; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 5rem; padding: 4rem 0 2.5rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 2.5rem; flex-wrap: wrap; }
.footer-brand .brand { font-size: 1.4rem; }
.footer-brand p { margin: 0.6rem 0 0; max-width: 30ch; font-size: 0.92rem; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1.6rem; align-content: flex-start; }
.footer-nav a { font-size: 0.9rem; color: var(--text-dim); }
.footer-base { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--line); font-size: 0.84rem; }

/* ---------- Scroll reveals (only hide when JS is available) ---------- */
.js [data-reveal] { opacity: 0; transform: translateY(22px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.js [data-reveal].is-in { opacity: 1; transform: none; }
.js [data-reveal][data-delay="1"] { transition-delay: 0.08s; }
.js [data-reveal][data-delay="2"] { transition-delay: 0.16s; }
.js [data-reveal][data-delay="3"] { transition-delay: 0.24s; }

/* =========================================================================
   Admin / auth (functional, kept calm and consistent)
   ========================================================================= */
body.centered { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 1.5rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 2.4rem; }
.card.narrow { width: 100%; max-width: 400px; }
.card h1 { font-size: 1.8rem; margin-bottom: 1.4rem; }
.card label { display: block; margin-bottom: 1rem; font-size: 0.9rem; font-weight: 500; }
.card input { margin-top: 0.4rem; }

body.admin { background: var(--bg); }
.admin-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; padding: 1.1rem 1.8rem; background: var(--bg-soft); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.admin-bar .brand { font-size: 1.1rem; }
.admin-bar nav { display: flex; gap: 1.6rem; }
.admin-bar nav a { font-size: 0.9rem; color: var(--text-dim); }
.admin-bar nav form { margin: 0; }
.admin-bar .nav-link {
    border: 0; background: none; padding: 0; cursor: pointer;
    font: inherit; font-size: 0.9rem; color: var(--text-dim);
}
.admin-bar .nav-link:hover { color: var(--text); }
.admin-main { max-width: 920px; margin: 0 auto; padding: 2.5rem 1.8rem; }
.admin-main h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }

label { display: block; margin-bottom: 1.1rem; font-weight: 500; font-size: 0.92rem; }
label small { font-weight: 400; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; margin: 1.4rem 0; }
legend { padding: 0 0.6rem; color: var(--text-dim); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.12em; }
.stack > * { margin-bottom: 0.3rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.admin-metrics {
    border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
    padding: 1.4rem 0; margin: 1.6rem 0;
}
.admin-section-title {
    font-family: var(--font-serif); font-size: 1.6rem; font-weight: 380;
    margin: 2.4rem 0 1rem;
}

table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 0.85rem 0.7rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { color: var(--text-faint); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; }
.actions { display: flex; gap: 1.1rem; align-items: center; }
.actions form { margin: 0; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font: inherit; }
.link.danger, .danger { color: var(--danger); }

.button { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; font: inherit; font-weight: 500; background: var(--text); color: var(--bg); padding: 0.7rem 1.3rem; border-radius: 10px; }
.button:hover { background: #fff; color: var(--bg); }

.thumb { width: 84px; height: 84px; object-fit: cover; border-radius: 14px; margin: 0.5rem 0; border: 1px solid var(--line); }
.thumb.wide { width: 170px; }
.shot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.9rem; margin-top: 0.9rem; }
.shot { text-align: center; }
.shot img { border-radius: 10px; border: 1px solid var(--line); margin-bottom: 0.4rem; }

.error { color: var(--danger); }
.success { color: var(--success); }
.muted { color: var(--text-dim); }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
    body { font-size: 16px; }
    .site-nav { gap: 1.3rem; }
    .build-counter { grid-template-columns: 1fr 20px; }
    .build-counter-metrics { grid-column: 1 / -1; }
    .ledger-grid { grid-template-columns: 1fr; }
    .game-hero-overlay { padding: 1.5rem; }
    .game-hero-icon { width: 80px; height: 80px; }
    .story-stats { gap: 2rem; }
}
@media (max-width: 520px) {
    .site-nav a:nth-child(2) { display: none; }
}
