/* =============================================================================
   RobotsRescue / RobotsRefuge — minimalist stylesheet
   ========================================================================== */

:root {
    --bg:        #faf8f4;
    --bg-alt:    #f2efe7;
    --fg:        #17130f;
    --fg-muted:  #6b645b;
    --fg-subtle: #a89e91;
    --line:      #e4dfd4;
    --accent:    #9a3d1c;
    --accent-ink:#ffffff;
    --accent-soft:#f5e1d5;
    --chip-bg:   #efe9dc;

    --status-10: #c49c3c;
    --status-30: #527bb2;
    --status-50: #7a8a6b;
    --status-70: #5e8c4d;
    --status-90: #8a5a50;

    --max:       1120px;
    --max-prose:  720px;
    --max-wide:   880px;
    --radius:    6px;
    --pad:       clamp(1rem, 3vw, 1.75rem);

    --f-sans:  'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
    --f-serif: ui-serif, 'Iowan Old Style', 'Apple Garamond', 'Baskerville', Georgia, serif;
    --f-mono:  ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

    --ease:    cubic-bezier(.2,.6,.2,1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:        #111010;
        --bg-alt:    #1a1817;
        --fg:        #f1ece5;
        --fg-muted:  #a7a198;
        --fg-subtle: #6e665e;
        --line:      #2a2624;
        --accent:    #e08a5d;
        --accent-ink:#111010;
        --accent-soft:#2a1d15;
        --chip-bg:   #22201d;
    }
}

/* ---------------------------------------------------------------- Reset -- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--f-sans);
    font-size: 17px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; height: auto; }
button { font: inherit; cursor: pointer; }
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }

h1,h2,h3,h4 { font-family: var(--f-serif); font-weight: 500; line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(2.1rem, 5vw, 3.6rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); margin-top: 1.6em; }
h3 { font-size: 1.2rem; margin-top: 1.3em; }
p  { margin: 0 0 1em; }
em { font-style: italic; }
strong { font-weight: 600; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding-inline: var(--pad); }

.skip {
    position: absolute; left: -9999px; top: 8px;
    background: var(--fg); color: var(--bg);
    padding: .5em 1em; border-radius: var(--radius); z-index: 1000;
}
.skip:focus { left: 8px; }

/* ------------------------------------------------------------- Header --- */
/* Dark band at the top of every page — white logo needs a dark background. */
.site-header {
    --hdr-bg:     #111010;
    --hdr-fg:     #f1ece5;
    --hdr-dim:    #a7a198;
    --hdr-hi:     #ffffff;
    --hdr-accent: #e08a5d;

    position: sticky; top: 0; z-index: 20;
    background: var(--hdr-bg);
    color: var(--hdr-fg);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.site-header__inner {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1.5rem; min-height: 66px;
}
.brand__logo { width: auto; max-height: 44px; }

.site-nav__list {
    list-style: none; margin: 0; padding: 0;
    display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
}
.site-nav a {
    color: var(--hdr-fg);
    font-size: .92rem;
    padding: .35em 0;
    border-bottom: 1px solid transparent;
    transition: border-color .15s var(--ease), color .15s var(--ease);
}
.site-nav a:hover { text-decoration: none; border-bottom-color: var(--hdr-hi); color: var(--hdr-hi); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--hdr-accent); color: var(--hdr-accent); }

/* Header CTA — pill, warm accent on dark. Uses .site-nav .header-cta
   selector to beat .site-nav a's specificity (which was nuking our padding). */
.site-nav .header-cta,
.site-nav .header-cta:visited {
    display: inline-flex; align-items: center; justify-content: center;
    padding: .75em 1.6em;
    font-size: .92rem; font-weight: 600; letter-spacing: .015em;
    line-height: 1;
    border-radius: 999px;
    border: 0;
    background: var(--hdr-accent);
    color: #0e0a06;
    text-decoration: none;
    box-shadow: 0 1px 0 rgba(0,0,0,0.35), 0 3px 8px rgba(0,0,0,0.15);
    transition: background .15s var(--ease), transform .08s var(--ease), box-shadow .15s var(--ease);
}
.site-nav .header-cta:hover {
    background: #f4a17a;
    color: #0e0a06;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 0 rgba(0,0,0,0.45), 0 6px 14px rgba(0,0,0,0.2);
    border-bottom: 0;  /* cancel the underline-on-hover inherited from nav */
}
.site-nav .header-cta:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(0,0,0,0.35); }
.site-nav__cta { margin-left: .5rem; }

.nav-toggle {
    display: none; background: transparent; border: 0; padding: 0;
    width: 40px; height: 40px; position: relative;
}
.nav-toggle span {
    position: absolute; left: 8px; right: 8px; height: 2px; background: var(--hdr-fg);
    transition: transform .25s var(--ease), opacity .25s var(--ease), top .25s var(--ease);
}
.nav-toggle span:nth-child(1) { top: 13px; }
.nav-toggle span:nth-child(2) { top: 19px; }
.nav-toggle span:nth-child(3) { top: 25px; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { top: 19px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { top: 19px; transform: rotate(-45deg); }

@media (max-width: 860px) {
    .nav-toggle { display: block; }
    .site-nav {
        position: absolute; left: 0; right: 0; top: 100%;
        background: var(--hdr-bg); color: var(--hdr-fg);
        border-bottom: 1px solid rgba(255,255,255,0.08);
        padding: 1rem var(--pad) 1.25rem;
        transform: translateY(-8px); opacity: 0; pointer-events: none;
        transition: transform .25s var(--ease), opacity .25s var(--ease);
    }
    .site-nav__list { flex-direction: column; align-items: stretch; gap: .75rem; }
    .site-nav__cta { margin-top: .25rem; }
    .site-nav.is-open { transform: none; opacity: 1; pointer-events: auto; }
}

/* --------------------------------------------------------- Buttons ------ */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: .5em; padding: .75em 1.35em;
    font-size: .95rem; font-weight: 500;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease), transform .08s var(--ease);
    line-height: 1; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 85%, black); }
.btn--ghost { border-color: var(--line); color: var(--fg); background: transparent; }
.btn--ghost:hover { border-color: var(--fg); }
.btn--large { padding: 1em 1.75em; font-size: 1rem; }
.btn--compact { padding: .65em 1.6em; font-size: .9rem; }

.link-arrow { color: var(--accent); font-weight: 500; }
.link-arrow:hover { text-decoration: underline; }

/* ---------------------------------------------------- Section framing --- */
.page { padding-bottom: 4rem; }
.section { padding: clamp(2.5rem, 7vw, 5rem) 0; }
.section--muted { background: var(--bg-alt); border-block: 1px solid var(--line); }
.section--prose .prose { margin-inline: auto; }
.section--cta { padding-block: clamp(3rem, 8vw, 6rem); }

.eyebrow {
    font-size: .75rem; font-weight: 600; letter-spacing: .14em;
    text-transform: uppercase; color: var(--fg-muted); margin: 0 0 1rem;
}
.section__head { margin-bottom: 2rem; }
.section__sub { color: var(--fg-muted); max-width: 60ch; }
.section__more { margin-top: 2rem; }

/* ----------------------------------------------------------------- Hero -- */
.hero { padding: clamp(3rem, 9vw, 7rem) 0 clamp(1.5rem, 5vw, 3rem); }
.hero__title {
    font-size: clamp(2.5rem, 7vw, 5.2rem);
    line-height: 1.02; letter-spacing: -0.035em;
    max-width: 16ch; margin-bottom: .3em;
}
.hero__title em { color: var(--accent); font-style: italic; }
.hero__lede {
    max-width: 44ch; font-size: clamp(1.05rem, 1.8vw, 1.25rem);
    color: var(--fg-muted); line-height: 1.55;
    margin: 1rem 0 2rem;
}
.hero__actions { display: flex; gap: .75rem; flex-wrap: wrap; }

/* ---------------------------------------------------- Prose typography -- */
.prose { max-width: var(--max-prose); }
.prose--wide { max-width: var(--max-wide); }
.prose p, .prose li { font-size: 1.05rem; }
.prose .lede { font-size: 1.2rem; color: var(--fg); }
.prose h2 { margin-top: 2em; }
.prose h2 + p { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.2em; margin: 0 0 1.25em; }
.prose ul li, .prose ol li { margin: 0 0 .5em; }
.prose a { text-decoration: underline; }
.prose__cta { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 2.5rem; }

.steps { list-style: none; padding: 0; counter-reset: step; }
.steps li {
    position: relative; padding: 1rem 0 1rem 3.25rem;
    border-top: 1px solid var(--line);
    counter-increment: step;
}
.steps li:last-child { border-bottom: 1px solid var(--line); }
.steps li::before {
    content: counter(step, decimal-leading-zero);
    position: absolute; left: 0; top: 1.05rem;
    font-family: var(--f-mono); font-size: .85rem; font-weight: 600;
    color: var(--accent); letter-spacing: .05em;
}

/* ---------------------------------------------------- Page header area -- */
.page-head {
    padding: clamp(2.5rem, 7vw, 5rem) 0 clamp(1rem, 3vw, 2rem);
    border-bottom: 1px solid var(--line);
}
.page-head h1 { max-width: 22ch; }
.page-head__lede {
    max-width: 60ch; color: var(--fg-muted);
    font-size: clamp(1rem, 1.6vw, 1.15rem); margin-top: .5rem;
}

/* ------------------------------------------------------------ Pillars --- */
.pillars__grid {
    list-style: none; padding: 0; margin: 0;
    display: grid; gap: 2.5rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.pillars__grid li { padding-top: 1rem; border-top: 1px solid var(--fg); }
.pillars__num {
    display: block;
    font-family: var(--f-mono); font-size: .8rem; letter-spacing: .14em;
    color: var(--fg-muted); margin-bottom: .5rem;
}
.pillars__grid h3 { margin: 0 0 .4em; font-size: 1.3rem; }
.pillars__grid p  { color: var(--fg-muted); margin: 0; font-size: .98rem; }

/* ------------------------------------------------------------ Cards ----- */
.cards {
    list-style: none; padding: 0; margin: 0;
    display: grid; gap: 1.5rem;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.cards--lg { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 2rem; }
.card { }
.card__link {
    display: flex; flex-direction: column; gap: .9rem;
    color: var(--fg); text-decoration: none;
    padding: 0; border-radius: var(--radius); overflow: hidden;
}
.card__link:hover { text-decoration: none; }
.card__photo {
    display: block; aspect-ratio: 4 / 3;
    background: var(--bg-alt); overflow: hidden;
    border-radius: var(--radius); border: 1px solid var(--line);
}
.card__photo img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .4s var(--ease);
}
.card__link:hover .card__photo img { transform: scale(1.03); }
.card__body { display: flex; flex-direction: column; gap: .25rem; }
.card__name { font-family: var(--f-serif); font-size: 1.3rem; font-weight: 500; }
.card__meta { color: var(--fg-muted); font-size: .9rem; }
.card__chip { align-self: flex-start; margin-top: .25rem; }

/* ------------------------------------------------------------ Chips ----- */
.chip {
    display: inline-flex; align-items: center; gap: .5em;
    padding: .25em .75em; border-radius: 999px;
    font-size: .8rem; font-weight: 500; letter-spacing: .01em;
    background: var(--chip-bg); color: var(--fg);
    border: 1px solid transparent;
}
.chip--link { text-decoration: none; color: var(--fg); border-color: var(--line); }
.chip--link:hover { border-color: var(--fg); text-decoration: none; }
.chip__meta { color: var(--fg-muted); font-size: .75rem; font-weight: 400; }

.chip--s10 { background: color-mix(in srgb, var(--status-10) 20%, transparent); color: var(--status-10); }
.chip--s30 { background: color-mix(in srgb, var(--status-30) 18%, transparent); color: var(--status-30); }
.chip--s50 { background: color-mix(in srgb, var(--status-50) 22%, transparent); color: var(--status-50); }
.chip--s70 { background: color-mix(in srgb, var(--status-70) 22%, transparent); color: var(--status-70); }
.chip--s90 { background: color-mix(in srgb, var(--status-90) 22%, transparent); color: var(--status-90); }

.chip-list { list-style: none; padding: 0; margin: 1rem 0; display: flex; flex-wrap: wrap; gap: .5rem; }

/* ---------------------------------------------------- Resident detail -- */
.resident__back { padding-top: 1.5rem; }
.resident__head { padding-top: 1.5rem; }
.resident__name { margin-bottom: .1em; }
.resident__nickname { color: var(--fg-muted); margin: 0 0 1rem; }
.resident__lede { max-width: 60ch; color: var(--fg-muted); font-size: 1.1rem; }

.gallery {
    margin: 2rem 0;
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--bg-alt);
    position: relative; overflow: hidden;
}
.gallery__item { margin: 0; display: none; }
.gallery__item.is-active { display: block; }
.gallery__item img {
    width: 100%; max-height: 70vh; object-fit: contain;
    display: block; background: var(--bg-alt);
}
.gallery__nav {
    display: flex; align-items: center; justify-content: space-between;
    padding: .5rem 1rem;
    border-top: 1px solid var(--line); background: var(--bg);
    font-family: var(--f-mono); font-size: .85rem; color: var(--fg-muted);
}
.gallery__nav button {
    background: transparent; border: 0; color: var(--fg);
    padding: .4em .75em; border-radius: var(--radius);
}
.gallery__nav button:hover { background: var(--bg-alt); }

.resident__grid {
    display: grid; gap: 2rem;
    grid-template-columns: minmax(240px, 1fr) 2fr;
    margin-top: 1rem; padding-bottom: 2rem;
}
@media (max-width: 720px) { .resident__grid { grid-template-columns: 1fr; } }

.meta-list {
    margin: 0; padding: 0;
    display: flex; flex-direction: column; gap: .5rem;
    border-top: 1px solid var(--line);
}
.meta-list > div {
    display: grid; grid-template-columns: 1fr 1.4fr;
    gap: 1rem; padding: .9rem 0;
    border-bottom: 1px solid var(--line);
}
.meta-list dt {
    color: var(--fg-muted); font-size: .85rem;
    text-transform: uppercase; letter-spacing: .08em;
    margin: 0;
}
.meta-list dd { margin: 0; }
.meta-list__note { color: var(--fg-muted); font-size: .9rem; margin: .3em 0 0; }

/* --------------------------------------------------------- Comic grid -- */
.comic-grid {
    list-style: none; padding: 0; margin: 0;
    display: grid; gap: 1.5rem;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.comic-grid li { }
.comic-grid a {
    display: block; color: var(--fg);
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--bg-alt); overflow: hidden;
    transition: border-color .15s var(--ease), transform .15s var(--ease);
}
.comic-grid a:hover { border-color: var(--fg); text-decoration: none; transform: translateY(-2px); }
.comic-grid img { aspect-ratio: 1 / 1; object-fit: contain; width: 100%; background: var(--bg); padding: .5rem; }
.comic-grid__title {
    display: block; padding: .75rem 1rem;
    font-size: .9rem; color: var(--fg-muted);
}

.comic-read__title { margin-top: .5rem; }
.comic-read__figure { margin: 2rem 0; text-align: center; }
.comic-read__figure img {
    max-height: 85vh; margin: 0 auto;
    border: 1px solid var(--line); border-radius: var(--radius);
}
.comic-read__figure figcaption { color: var(--fg-muted); margin-top: .75rem; font-size: .95rem; }
.comic-read__nav {
    display: grid; grid-template-columns: 1fr auto 1fr;
    gap: 1rem; align-items: center; margin-top: 2rem;
}
.comic-read__nav > :first-child { justify-self: start; }
.comic-read__nav > :last-child { justify-self: end; }

/* --------------------------------------------------------- Œuvres list -- */
.oeuvres { list-style: none; padding: 0; margin: 0; }
.oeuvre {
    padding: 1.5rem 0;
    border-top: 1px solid var(--line);
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 2rem;
}
.oeuvre:last-child { border-bottom: 1px solid var(--line); }
@media (max-width: 720px) { .oeuvre { grid-template-columns: 1fr; gap: .5rem; } }
.oeuvre__type {
    display: inline-block; font-family: var(--f-mono);
    font-size: .75rem; letter-spacing: .08em;
    text-transform: uppercase; color: var(--accent); margin-bottom: .5rem;
}
.oeuvre__title { font-size: 1.35rem; margin: 0 0 .1em; }
.oeuvre__title a { color: var(--fg); }
.oeuvre__title a:hover { color: var(--accent); }
.oeuvre__alt-title {
    font-family: var(--f-serif); font-style: italic;
    color: var(--fg-muted); font-size: 1rem;
    margin: 0 0 .35em;
}
.oeuvre__meta { color: var(--fg-muted); font-size: .95rem; margin: 0; }
.oeuvre__desc { color: var(--fg-muted); margin: 0; }

/* ---------------------------------------------------------- Split ------- */
.split {
    display: grid; gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.split--tight { gap: 1rem; }
.split__card {
    display: block; color: var(--fg);
    padding: 2rem; background: var(--bg-alt);
    border: 1px solid var(--line); border-radius: var(--radius);
    transition: border-color .15s var(--ease), transform .15s var(--ease);
}
.split__card:hover { border-color: var(--fg); text-decoration: none; transform: translateY(-2px); }
.split__card h3 { margin: 0 0 .5em; font-size: 1.35rem; }
.split__card p { color: var(--fg-muted); margin: 0 0 1em; }
.split__cta { color: var(--accent); font-weight: 500; }

/* ---------------------------------------------------------- Contact ----- */
.contact-grid {
    display: grid; gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.contact-card {
    display: flex; flex-direction: column; gap: .5rem;
    padding: 1.75rem; color: var(--fg);
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--bg);
    transition: border-color .15s var(--ease), transform .15s var(--ease);
}
.contact-card:hover { border-color: var(--fg); text-decoration: none; transform: translateY(-2px); }
.contact-card__label { color: var(--fg-muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; }
.contact-card__value { font-family: var(--f-serif); font-size: 1.45rem; font-weight: 500; word-break: break-word; }
.contact-card__hint { color: var(--fg-muted); font-size: .92rem; }

/* ---------------------------------------------------------- CTA block --- */
.cta-block { max-width: 44rem; }
.cta-block--centered { margin: 0 auto; text-align: center; }
.cta-block h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); margin-bottom: .3em; }
.cta-block p { color: var(--fg-muted); font-size: 1.1rem; margin-bottom: 1.5rem; }

.empty {
    padding: 3rem 0; color: var(--fg-muted);
    border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
    text-align: center;
}

.muted { color: var(--fg-muted); }

/* ---------------------------------------------------------- Footer ------ */
.site-footer {
    margin-top: 4rem;
    border-top: 1px solid var(--line);
    background: var(--bg-alt);
    padding: 3rem 0 2rem;
}
.site-footer__grid {
    display: grid; gap: 2.5rem;
    grid-template-columns: 1.4fr repeat(3, minmax(0, 1fr));
}
@media (max-width: 820px) { .site-footer__grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .site-footer__grid { grid-template-columns: 1fr; } }
.site-footer__name {
    font-family: var(--f-serif); font-size: 1.35rem; font-weight: 500;
    display: block; margin-bottom: .4rem;
}
.site-footer__tagline { color: var(--fg-muted); max-width: 30ch; }
.site-footer__title {
    font-size: .78rem; text-transform: uppercase; letter-spacing: .14em;
    color: var(--fg-muted); margin: 0 0 .75rem; font-weight: 600;
    font-family: var(--f-sans);
}
.site-footer__title--spaced { margin-top: 1.5rem; }
.site-footer__col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4rem; }
.site-footer__col a { color: var(--fg); }
.site-footer__col a:hover { color: var(--accent); }
.site-footer__bottom {
    margin-top: 2.5rem; padding-top: 1.5rem;
    border-top: 1px solid var(--line);
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem;
    color: var(--fg-muted); font-size: .85rem;
}
.site-footer__made { font-style: italic; }

/* ---------------------------------------------------------- Print ------- */
@media print {
    .site-header, .site-footer, .btn, .nav-toggle, .skip { display: none !important; }
    a { color: inherit; text-decoration: none; }
    body { background: #fff; color: #000; }
}

/* ---------------------------------------------- Reduced motion / focus -- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px;
}
