/* ============================================================
   chwal — a text-first, 3-tone theme for anditherobot.com
   Three colors: paper (bg), ink (text), rust (accent).
   No frameworks, no decorative art. Let the work speak.
   ============================================================ */

:root {
    /* --- the three tones --- */
    --paper: #faf8f5;
    --ink: #1c1917;
    --rust: #c8450c;

    /* tints/shades derived from the three (still the same family) */
    --ink-muted: rgba(28, 25, 23, 0.64);
    --ink-faint: rgba(28, 25, 23, 0.45);
    --rule: rgba(28, 25, 23, 0.12);
    --paper-2: #f2efe9;
    --rust-soft: rgba(200, 69, 12, 0.10);

    --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
    --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

    --measure: 42rem;   /* reading width */
    --wide: 60rem;      /* lists / nav */
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 1.0625rem;
    line-height: 1.65;
    font-feature-settings: "kern" 1;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a { color: var(--rust); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

h1, h2, h3, h4 {
    font-family: var(--sans);
    line-height: 1.15;
    letter-spacing: -0.02em;
    font-weight: 700;
    color: var(--ink);
}

hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }

::selection { background: var(--rust-soft); }

/* --- layout --- */
.wrap {
    width: 100%;
    max-width: var(--measure);
    margin: 0 auto;
    padding: 0 1.5rem;
}
.wrap--wide { max-width: var(--wide); }

main { flex: 1 0 auto; }

.section { padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
.section + .section { padding-top: 0; }

/* --- eyebrow / kicker --- */
.eyebrow {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--rust);
    margin: 0 0 0.75rem;
}

.lede {
    font-size: 1.2rem;
    line-height: 1.55;
    color: var(--ink-muted);
}

.muted { color: var(--ink-muted); }
.small { font-size: 0.85rem; }

/* ============================================================
   header / nav
   ============================================================ */
.site-head {
    border-bottom: 1px solid var(--rule);
}
.site-head__inner {
    max-width: var(--wide);
    margin: 0 auto;
    padding: 1.1rem 1.5rem;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.brand {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
    color: var(--ink);
}
.brand:hover { text-decoration: none; color: var(--rust); }
.nav {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    font-size: 0.95rem;
}
.nav a { color: var(--ink-muted); }
.nav a:hover { color: var(--rust); text-decoration: none; }
.nav a.is-active { color: var(--ink); }
.nav a.is-active::after {
    content: "";
    display: block;
    height: 2px;
    background: var(--rust);
    margin-top: 2px;
}

/* ============================================================
   footer
   ============================================================ */
.site-foot {
    flex-shrink: 0;
    border-top: 1px solid var(--rule);
    margin-top: 4rem;
    padding: 2.5rem 0;
    font-size: 0.9rem;
}
.site-foot__inner {
    max-width: var(--wide);
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.site-foot .muted { color: var(--ink-muted); }
.site-foot nav { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.site-foot nav a { color: var(--ink-muted); }
.site-foot nav a:hover { color: var(--rust); text-decoration: none; }

/* ============================================================
   hero (home / page tops)
   ============================================================ */
.hero { padding: clamp(3rem, 8vw, 5.5rem) 0 clamp(2rem, 5vw, 3rem); }
.hero h1 {
    font-size: clamp(2rem, 5.5vw, 3.1rem);
    margin: 0 0 1.25rem;
}
.hero .lede { max-width: 36rem; margin: 0 0 1.75rem; }
.hero__actions { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: center; }

.text-link {
    font-weight: 600;
    color: var(--rust);
}
.text-link .arr { transition: margin 0.15s ease; }
.text-link:hover { text-decoration: none; }
.text-link:hover .arr { margin-left: 0.25rem; }

.btn {
    display: inline-block;
    padding: 0.6rem 1.15rem;
    border: 1px solid var(--ink);
    border-radius: 2px;
    color: var(--ink);
    font-weight: 600;
    font-size: 0.95rem;
}
.btn:hover { background: var(--ink); color: var(--paper); text-decoration: none; }
.btn--rust { border-color: var(--rust); color: var(--rust); }
.btn--rust:hover { background: var(--rust); color: #fff; }

/* ============================================================
   block headings inside pages
   ============================================================ */
.block-head { margin-bottom: 1.75rem; }
.block-head h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin: 0; }

/* ============================================================
   definition-style list (competencies, values, method, stack)
   ============================================================ */
.deflist {
    display: grid;
    gap: 2rem;
    margin: 0;
    padding: 0;
}
.deflist--2 { grid-template-columns: 1fr 1fr; gap: 2.25rem 3rem; }
.def {
    margin: 0;
    padding-top: 1.25rem;
    border-top: 1px solid var(--rule);
}
.def__num {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--rust);
}
.def h3 {
    font-size: 1.1rem;
    margin: 0.35rem 0 0.4rem;
}
.def p { margin: 0; color: var(--ink-muted); }
.def__note {
    display: block;
    margin-top: 0.6rem;
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

/* ============================================================
   article index (blog list / latest / series) — plain rows
   ============================================================ */
.post-list { border-top: 1px solid var(--rule); }
.post-row {
    display: grid;
    grid-template-columns: 7rem 1fr;
    gap: 0 1.5rem;
    align-items: baseline;
    padding: 1.1rem 0;
    border-bottom: 1px solid var(--rule);
}
.post-row__date {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--ink-faint);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.post-row__title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.01em;
}
.post-row a.post-row__title:hover { color: var(--rust); text-decoration: none; }
.post-row__excerpt {
    margin: 0.35rem 0 0;
    color: var(--ink-muted);
    font-size: 0.95rem;
}
.post-row__cats {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-family: var(--mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.post-row__cats a { color: var(--ink-faint); }
.post-row__cats a:hover { color: var(--rust); text-decoration: none; }

/* compact variant (home latest / series) */
.post-list--compact .post-row { grid-template-columns: 6rem 1fr; padding: 0.8rem 0; }

/* ============================================================
   single article (blog detail) prose
   ============================================================ */
.article-head { padding: clamp(2.5rem, 6vw, 4rem) 0 0; }
.breadcrumb { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; }
.breadcrumb a { color: var(--ink-faint); }
.breadcrumb a:hover { color: var(--rust); text-decoration: none; }

.article-title {
    font-size: clamp(1.9rem, 5vw, 2.8rem);
    margin: 1rem 0 0.85rem;
    line-height: 1.1;
}
.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.85rem;
    align-items: baseline;
    font-size: 0.85rem;
    color: var(--ink-muted);
    font-family: var(--mono);
}
.article-meta .sep { color: var(--rule); }
.article-meta a { color: var(--ink-muted); }
.article-meta a:hover { color: var(--rust); text-decoration: none; }

.series-tag {
    display: inline-block;
    margin-bottom: 0.75rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-muted);
}
.series-tag a { color: var(--rust); }

/* the rendered markdown body */
.prose {
    font-family: var(--serif);
    font-size: 1.18rem;
    line-height: 1.7;
    margin-top: 2rem;
}
.prose > * { max-width: 100%; }
.prose p { margin: 0 0 1.3rem; }
.prose h2 {
    font-family: var(--sans);
    font-size: 1.5rem;
    margin: 2.5rem 0 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule);
}
.prose h3 { font-family: var(--sans); font-size: 1.2rem; margin: 2rem 0 0.75rem; }
.prose ul, .prose ol { margin: 0 0 1.3rem; padding-left: 1.4rem; }
.prose li { margin-bottom: 0.4rem; }
.prose a { text-decoration: underline; text-underline-offset: 2px; }
.prose blockquote {
    margin: 1.8rem 0;
    padding: 0.3rem 0 0.3rem 1.25rem;
    border-left: 3px solid var(--rust);
    color: var(--ink-muted);
    font-style: italic;
}
.prose img { display: block; width: 100%; height: auto; margin: 1.8rem 0; border: 1px solid var(--rule); }
.prose code {
    font-family: var(--mono);
    font-size: 0.85em;
    background: var(--paper-2);
    border: 1px solid var(--rule);
    border-radius: 3px;
    padding: 0.1em 0.35em;
}
.prose pre {
    font-family: var(--mono);
    font-size: 0.85rem;
    line-height: 1.6;
    background: var(--ink);
    color: #f5f3f0;
    padding: 1.1rem 1.25rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 1.6rem 0;
}
.prose pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.6rem 0; font-family: var(--sans); font-size: 0.95rem; }
.prose th, .prose td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--rule); }
.prose th { font-weight: 700; }

/* in-series related + prev/next */
.series-related {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule);
}
.series-related ul { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 0.4rem; }

.post-nav {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule);
    font-size: 0.95rem;
}
.post-nav .next { text-align: right; }
.post-nav small { display: block; font-family: var(--mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-faint); }

/* category chips inline (article) */
.cat-inline a {
    font-family: var(--mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-faint);
}

/* ============================================================
   forms (contact)
   ============================================================ */
.chwal-form { margin-top: 2rem; }
.field { margin-bottom: 1.25rem; }
.field label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink);
}
.field input,
.field textarea,
.field select,
.chwal-form input[type="text"],
.chwal-form input[type="email"],
.chwal-form textarea,
.chwal-form select {
    width: 100%;
    font-family: var(--sans);
    font-size: 1rem;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--rule);
    border-radius: 2px;
    padding: 0.6rem 0.75rem;
}
.chwal-form input:focus,
.chwal-form textarea:focus,
.chwal-form select:focus {
    outline: none;
    border-color: var(--rust);
    box-shadow: 0 0 0 2px var(--rust-soft);
}
.chwal-form textarea { min-height: 9rem; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.field small { display: block; margin-top: 0.3rem; font-size: 0.78rem; color: var(--ink-faint); }

/* type toggle */
.type-toggle { display: flex; gap: 0; border: 1px solid var(--rule); border-radius: 2px; overflow: hidden; margin-bottom: 1.75rem; }
.type-btn {
    flex: 1;
    background: transparent;
    border: 0;
    border-right: 1px solid var(--rule);
    padding: 0.7rem 1rem;
    text-align: left;
    cursor: pointer;
    font-family: var(--sans);
    color: var(--ink-muted);
}
.type-btn:last-child { border-right: 0; }
.type-btn.active { background: var(--ink); color: var(--paper); }
.type-btn strong { display: block; font-size: 0.9rem; }
.type-btn span { font-size: 0.75rem; opacity: 0.8; }

.check-group { display: grid; gap: 0.75rem; margin: 1rem 0 1.5rem; }
.check-item { display: flex; gap: 0.6rem; align-items: flex-start; }
.check-item input { width: auto; margin-top: 0.25rem; }
.check-item label { font-weight: 500; margin: 0; }
.check-item small { margin-top: 0; }

.submit-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.btn-submit {
    background: var(--rust);
    color: #fff;
    border: 0;
    padding: 0.7rem 1.6rem;
    font-family: var(--sans);
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 2px;
    cursor: pointer;
}
.btn-submit:hover { background: #a8390a; }

/* django messages */
.alert {
    padding: 0.8rem 1rem;
    border: 1px solid var(--rule);
    border-left: 3px solid var(--rust);
    border-radius: 2px;
    background: var(--paper-2);
    margin: 1.5rem 0;
    font-size: 0.95rem;
}

/* contact quick line */
.contact-routes { margin: 1.5rem 0 0; color: var(--ink-muted); }
.contact-routes a { font-weight: 600; }

/* pagination */
.pager { display: flex; gap: 1.5rem; justify-content: center; margin-top: 2.5rem; font-family: var(--mono); font-size: 0.85rem; }
.pager .current { color: var(--ink-faint); }

/* ============================================================
   responsive
   ============================================================ */
@media (max-width: 640px) {
    .deflist--2 { grid-template-columns: 1fr; }
    .field-row { grid-template-columns: 1fr; }
    .post-row { grid-template-columns: 1fr; gap: 0.25rem; }
    .post-row__date { order: -1; }
    .type-toggle { flex-direction: column; }
    .type-btn { border-right: 0; border-bottom: 1px solid var(--rule); }
    .type-btn:last-child { border-bottom: 0; }
    .prose { font-size: 1.08rem; }
}
