/* ============================================================
   404Unfound — shared stylesheet
   Design tokens, base reset, components and page sections.
   Mobile-first, desktop is the priority layout.
   ============================================================ */


/* ---------- Design tokens ---------- */
:root {
    /* Palette */
    --bg: #f0ede6;
    --fg: #141414;
    --fg-muted: rgba(20, 20, 20, 0.55);
    --fg-faint: rgba(20, 20, 20, 0.35);

    /* Class badge colors */
    --class-1: #1a6b35;   /* green  — Local */
    --class-1-bg: rgba(30, 120, 60, 0.08);
    --class-2: #8a5c0a;   /* amber  — Tethered */
    --class-2-bg: rgba(180, 120, 20, 0.10);

    /* Borders (single source of truth) */
    --border: 0.5px solid rgba(0, 0, 0, 0.1);
    --border-strong: 0.5px solid rgba(0, 0, 0, 0.25);

    /* Type */
    --font-display: "Azo Sans", "Inter", system-ui, sans-serif;
    --font-body: "Inter", system-ui, sans-serif;
}


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

html,
body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

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


/* ---------- Layout helpers ---------- */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

@media (min-width: 768px) {
    .container { padding: 0 2rem; }
}


/* ============================================================
   NAV
   Sticky top bar. Adds a stronger border once the page scrolls.
   ============================================================ */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
    border-bottom: var(--border);
    transition: border-color 0.2s ease;
}

.nav.is-scrolled {
    border-bottom: var(--border-strong);
}

.nav__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.nav__logo {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: -0.01em;
}

.nav__links {
    display: flex;
    gap: 1.5rem;
    font-size: 0.875rem;
}

.nav__links a {
    color: var(--fg-muted);
    transition: color 0.15s ease;
}

.nav__links a:hover {
    color: var(--fg);
}


/* ============================================================
   MARQUEE STRIP
   Dark band with infinite-loop scrolling text. Duplicated track
   so the seam between repetitions is invisible.
   ============================================================ */
.marquee {
    background: var(--fg);
    color: var(--bg);
    overflow: hidden;
    border-bottom: var(--border);
}

.marquee__track {
    display: flex;
    width: max-content;
    /* 40s for one full loop; tweak for taste. */
    animation: marquee-scroll 40s linear infinite;
}

.marquee__group {
    display: flex;
    flex-shrink: 0;
    padding: 14px 0;
    font-family: var(--font-display);
    font-size: 0.875rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.marquee__group span {
    padding: 0 2rem;
    white-space: nowrap;
}

@keyframes marquee-scroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }   /* exactly one group width */
}


/* ============================================================
   HERO
   Full-viewport. Title stacks on three lines, tagline anchors
   to the bottom-right.
   ============================================================ */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 4rem 0 3rem;
    border-bottom: var(--border);
}

.hero__title {
    font-family: var(--font-display);
    font-weight: 800;
    /* Fluid type — scales with viewport but capped. */
    font-size: clamp(5rem, 22vw, 18rem);
    line-height: 0.85;
    letter-spacing: -0.04em;
    margin: 0;
}

.hero__title span {
    display: block;
}

.hero__tagline {
    align-self: flex-end;
    text-align: right;
    max-width: 28rem;
    margin-top: 4rem;
}

.hero__tagline-main {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(1.25rem, 2vw, 1.75rem);
    letter-spacing: -0.01em;
    margin: 0 0 0.75rem;
}

.hero__tagline-sub {
    color: var(--fg-muted);
    font-size: 0.9375rem;
    margin: 0;
    line-height: 1.5;
}


/* ============================================================
   SECTION SCAFFOLD
   Shared label / subtitle pattern used by Tools, Posts, etc.
   ============================================================ */
.section {
    padding: 5rem 0;
    border-bottom: var(--border);
}

.section__label {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--fg);
    margin: 0 0 0.5rem;
}

.section__subtitle {
    font-size: 1rem;
    color: var(--fg-muted);
    margin: 0 0 2rem;
    max-width: 36rem;
}


/* ============================================================
   TOOLS SECTION
   Class legend + horizontally scrollable card row.
   ============================================================ */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    font-size: 0.8125rem;
    color: var(--fg-muted);
}

.legend__item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Generic badge — used for class chips on cards and in the legend. */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 2px;
    font-family: var(--font-display);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.2;
}

.badge--class-1 {
    color: var(--class-1);
    background: var(--class-1-bg);
}

.badge--class-2 {
    color: var(--class-2);
    background: var(--class-2-bg);
}

/* Horizontal scroller. Native overflow-x, snap points, hidden scrollbar. */
.tool-row {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 1rem;
    /* negative margin lets cards bleed to the edge of the viewport */
    margin: 0 -1.25rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
    .tool-row {
        margin: 0 -2rem;
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* Custom scrollbar — minimal, matches palette. */
.tool-row::-webkit-scrollbar { height: 6px; }
.tool-row::-webkit-scrollbar-track { background: transparent; }
.tool-row::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 0; }

.tool-card {
    flex: 0 0 280px;
    height: 220px;
    border: var(--border);
    background: var(--bg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    scroll-snap-align: start;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

@media (min-width: 768px) {
    .tool-card { flex: 0 0 320px; height: 240px; }
}

.tool-card:hover {
    border-color: rgba(0, 0, 0, 0.35);
}

.tool-card--passive {
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--fg-muted);
    border-style: dashed;
}

.tool-card--coming {
    opacity: 0.35;
}

.tool-card__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fg-muted);
}

.tool-card__name {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: -0.01em;
    margin: 0 0 4px;
}

.tool-card__desc {
    font-size: 0.875rem;
    color: var(--fg-muted);
    margin: 0;
    line-height: 1.45;
}

.tool-row__hint {
    margin-top: 1rem;
    font-size: 0.8125rem;
    color: var(--fg-faint);
}


/* ============================================================
   MANIFESTO STRIP
   One oversized line, second half de-emphasized.
   ============================================================ */
.manifesto {
    padding: 6rem 0;
    border-bottom: var(--border);
}

.manifesto__line {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(2rem, 6vw, 5rem);
    line-height: 1.05;
    letter-spacing: -0.03em;
    margin: 0;
}

.manifesto__line--faint {
    color: var(--fg-faint);
    margin-top: 0.25rem;
}

.manifesto__closing {
    margin-top: 2.5rem;
    font-size: 1.125rem;
    color: var(--fg-muted);
    max-width: 36rem;
}


/* ============================================================
   PHILOSOPHY STRIP
   Three plain columns, no card chrome — labels + paragraphs.
   ============================================================ */
.philosophy {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
    padding: 5rem 0;
    border-bottom: var(--border);
}

@media (min-width: 768px) {
    .philosophy { grid-template-columns: repeat(3, 1fr); gap: 3rem; }
}

.philosophy__col h3 {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.01em;
    margin: 0 0 0.75rem;
}

.philosophy__col p {
    margin: 0;
    color: var(--fg-muted);
    font-size: 0.9375rem;
    line-height: 1.55;
}


/* ============================================================
   POSTS & TUTORIALS
   Vertical list. Each row: type label / title / meta.
   ============================================================ */
.post-row {
    display: grid;
    grid-template-columns: 110px 1fr auto;
    gap: 1rem;
    align-items: center;
    padding: 1.25rem 0;
    border-bottom: var(--border);
    transition: padding-left 0.15s ease;
}

.post-row:first-of-type { border-top: var(--border); }
.post-row:hover { padding-left: 0.5rem; }

.post-row__type {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--fg-muted);
}

.post-row__title {
    font-size: 1rem;
    font-weight: 500;
}

.post-row__meta {
    font-size: 0.8125rem;
    color: var(--fg-muted);
}

.see-all {
    display: inline-block;
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: var(--fg);
    border-bottom: var(--border-strong);
    padding-bottom: 2px;
}


/* ============================================================
   SUGGEST STRIP
   Two-column band with prompt left, CTA button right.
   ============================================================ */
.suggest {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 4rem 0;
    border-bottom: var(--border);
    align-items: center;
}

@media (min-width: 768px) {
    .suggest { grid-template-columns: 1fr auto; gap: 3rem; }
}

.suggest__title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    letter-spacing: -0.02em;
    margin: 0 0 0.5rem;
}

.suggest__sub {
    margin: 0;
    color: var(--fg-muted);
    font-size: 0.9375rem;
    max-width: 36rem;
}

.btn {
    display: inline-block;
    padding: 14px 22px;
    border: var(--border-strong);
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.875rem;
    letter-spacing: 0.02em;
    transition: background 0.15s ease, color 0.15s ease;
}

.btn:hover {
    background: var(--fg);
    color: var(--bg);
}


/* ============================================================
   FOOTER
   ============================================================ */
.footer {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    justify-content: space-between;
    padding: 2rem 0;
    font-size: 0.8125rem;
    color: var(--fg-muted);
}

@media (min-width: 768px) {
    .footer { flex-direction: row; align-items: center; }
}

.footer__links {
    display: flex;
    gap: 1.25rem;
}

.footer__links a:hover { color: var(--fg); }


/* ============================================================
   SUB-PAGE SHELL
   Used by /tools, /posts, /forum, /about — minimal placeholder.
   ============================================================ */
.shell {
    min-height: 60vh;
    padding: 6rem 0;
    border-bottom: var(--border);
}

.shell h1 {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(3rem, 10vw, 6rem);
    letter-spacing: -0.03em;
    margin: 0 0 1rem;
}

.shell p {
    font-size: 1.125rem;
    color: var(--fg-muted);
    max-width: 36rem;
    margin: 0;
}


/* ============================================================
   TOOL DIRECTORY (tools/index.html)
   Page header, filter bar, grid, card variants.
   ============================================================ */

/* Page header — sits above the grid. Same vocabulary as section
   scaffold but with a larger title underneath the label. */
.directory-header {
    padding: 5rem 0 3rem;
    border-bottom: var(--border);
}

.directory-header__title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    letter-spacing: -0.03em;
    margin: 0.25rem 0 1rem;
}

.directory-header__sub {
    font-size: 1.0625rem;
    color: var(--fg-muted);
    max-width: 36rem;
    margin: 0;
}

/* Filter bar — plain text buttons with an underline on the active one. */
.filter-bar {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem 0;
    border-bottom: var(--border);
    font-family: var(--font-display);
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.filter-btn {
    padding-bottom: 4px;
    color: var(--fg-muted);
    border-bottom: 0.5px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.filter-btn:hover {
    color: var(--fg);
}

.filter-btn.is-active {
    color: var(--fg);
    border-bottom: 0.5px solid #141414;
}

/* Status block reused for loading and error messages. */
.status-block {
    padding: 4rem 0;
    color: var(--fg-muted);
    font-size: 0.875rem;
}

.status-block--error { color: var(--fg); }

.status-block .btn {
    margin-top: 1rem;
}

/* Tool grid — 3 columns desktop, 2 tablet, 1 mobile. */
.tool-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 3rem 0 5rem;
}

@media (min-width: 640px) {
    .tool-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
    .tool-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Grid card — uses the same chrome as the row card but vertical
   and slightly more spacious. */
.tool-item {
    border: var(--border);
    background: var(--bg);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 220px;
    transition: border-color 0.2s ease;
}

.tool-item:hover {
    border-color: rgba(0, 0, 0, 0.35);
}

.tool-item--coming {
    opacity: 0.4;
    pointer-events: none; /* disables hover/click on the card itself */
}

.tool-item__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fg-muted);
}

.tool-item__name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.01em;
    margin: 0;
}

.tool-item__desc {
    font-size: 0.875rem;
    color: var(--fg-muted);
    line-height: 1.5;
    margin: 0;
    flex: 1;
}

.tool-item__foot {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 6px;
    border-top: var(--border);
}

.tool-item__launch {
    font-family: var(--font-display);
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--fg);
    text-transform: uppercase;
}

.tool-item__launch--disabled {
    color: var(--fg-faint);
    pointer-events: none;
}

.tool-item__launch--coming {
    color: var(--fg-faint);
    pointer-events: none;
    text-transform: uppercase;
}

.tool-item__note {
    font-size: 0.75rem;
    color: var(--class-2);
}


/* ============================================================
   ADMIN PANEL (admin/index.html) — LOCAL ONLY
   Password gate, upload form, current-tools table.
   ============================================================ */

/* Gate — centered card with a single password field. */
.gate {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.gate__card {
    width: 100%;
    max-width: 360px;
    border: var(--border);
    padding: 2rem;
    background: var(--bg);
}

.gate__title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.25rem;
    margin: 0 0 0.25rem;
}

.gate__sub {
    margin: 0 0 1.5rem;
    color: var(--fg-muted);
    font-size: 0.875rem;
}

.gate__input,
.admin-input,
.admin-textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg);
    color: var(--fg);
    border: var(--border-strong);
    font-family: var(--font-body);
    font-size: 0.9375rem;
    border-radius: 0;
    outline: none;
    transition: border-color 0.15s ease;
}

.gate__input:focus,
.admin-input:focus,
.admin-textarea:focus {
    border-color: var(--fg);
}

.gate__error {
    margin-top: 0.75rem;
    font-size: 0.8125rem;
    color: #a02020;
    min-height: 1.2em;
}

/* Admin shell — once unlocked. */
.admin {
    padding: 3rem 0 6rem;
}

.admin__header {
    border-bottom: var(--border);
    padding-bottom: 1.5rem;
    margin-bottom: 2.5rem;
}

.admin__title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 2rem;
    margin: 0 0 0.25rem;
    letter-spacing: -0.02em;
}

.admin__sub {
    color: var(--fg-muted);
    margin: 0;
    font-size: 0.9375rem;
}

.admin__section {
    margin-bottom: 3.5rem;
}

.admin__section-label {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--fg-muted);
    margin: 0 0 1rem;
}

/* Form layout — single column, generous spacing for legibility. */
.admin-form {
    display: grid;
    gap: 1.25rem;
    max-width: 640px;
}

.admin-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.admin-field__label {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--fg);
}

.admin-textarea {
    min-height: 100px;
    resize: vertical;
    font-family: var(--font-body);
}

/* Radio group — inline chips */
.admin-radios {
    display: flex;
    gap: 1.25rem;
    font-size: 0.9375rem;
}

.admin-radios label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.admin-file {
    font-size: 0.875rem;
}

/* Submit + status row */
.admin-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.admin-status {
    font-size: 0.875rem;
}
.admin-status--ok    { color: #1a6b35; }
.admin-status--err   { color: #a02020; }
.admin-status--info  { color: var(--fg-muted); }

.admin-result {
    margin-top: 1.25rem;
    padding: 12px;
    background: rgba(0,0,0,0.04);
    border: var(--border);
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 0.75rem;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Current-tools table */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.admin-table th,
.admin-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: var(--border);
    vertical-align: middle;
}

.admin-table th {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.6875rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fg-muted);
    border-bottom: var(--border-strong);
}

.admin-table td.is-url {
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 0.75rem;
    color: var(--fg-muted);
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
