/* mattobrien.org — warm-light editorial design system */
/* Source Serif 4 (self-hosted) + JetBrains Mono · sage accent · cream paper */

/* ---- Self-hosted Source Serif 4 (variable, 400–600) ---- */
@font-face {
  font-family: 'Source Serif 4';
  src: url('/fonts/source-serif-4-latin.woff2') format('woff2');
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('/fonts/source-serif-4-latin-ext.woff2') format('woff2');
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}

:root {
    /* Type scale — 21px root, matches the existing reading scale */
    --text-xs: 0.81rem;   /* 17px — labels, dates, metadata */
    --text-sm: 0.90rem;   /* 19px — secondary text, nav */
    --text-base: 1rem;    /* 21px — body */
    --text-lg: 1.14rem;   /* 24px — h3, post titles */
    --text-xl: 1.25rem;   /* 26px — h2 */
    --text-2xl: 1.75rem;  /* 37px — h1 */

    /* Warm-light palette */
    --bg: #faf6ef;
    --text: #34322c;
    --text-2: #6f6a60;
    --text-3: #9b9486;
    --heading: #2b2922;
    --border: #ece3d4;
    --rule: #e4dccb;

    --accent: oklch(0.5 0.07 150);
    --accent-soft: oklch(0.8 0.06 150);
    --code-bg: #f1ebe0;
    --field-bg: #fffdf9;
}

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

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: "Source Serif 4", "Source Serif Pro", Georgia, serif;
    font-size: var(--text-base);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: oklch(0.8 0.06 150 / 0.35);
}

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

/* ---- Accessibility: skip link ---- */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 1100;
}
.skip-link:focus {
    left: 0;
    background: var(--accent);
    color: var(--bg);
    padding: 0.5rem 0.85rem;
    font-family: "JetBrains Mono", monospace;
    font-size: var(--text-xs);
}

/* ---- Layout ---- */
.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 26px;
}
/* Vertical-only padding so .container's horizontal gutter survives (mobile fix) */
.page {
    padding-top: 3.2rem;
    padding-bottom: 5rem;
}
.home {
    padding-top: 7rem;
    padding-bottom: 5rem;
}

/* ---- Top nav (inner pages) ---- */
.nav {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem 1.4rem;
    padding-top: 2.4rem;
    margin-bottom: 3.5rem;
}
.nav .home-link {
    font-size: var(--text-lg);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--heading);
    margin-right: auto;
    white-space: nowrap;
}
.nav .home-link:hover {
    color: var(--accent);
}
.nav .links {
    display: flex;
    align-items: baseline;
    gap: 1.25rem;
    flex-wrap: wrap;
}
.nav .links a {
    font-family: "JetBrains Mono", monospace;
    font-size: var(--text-xs);
    color: var(--text-3);
    transition: color 0.15s;
}
.nav .links a:hover {
    color: var(--accent);
}
.nav .links a.active {
    color: var(--text);
}

/* ---- Headings ---- */
h1 {
    font-size: var(--text-2xl);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.015em;
    color: var(--heading);
    margin-bottom: 1.4rem;
    text-wrap: balance;
}
h2 {
    font-size: var(--text-xl);
    font-weight: 600;
    line-height: 1.3;
    color: var(--heading);
    margin: 2.6rem 0 0.9rem;
}
h3 {
    font-size: var(--text-lg);
    font-weight: 600;
    line-height: 1.35;
    color: var(--heading);
    margin: 1.8rem 0 0.5rem;
}

/* ---- Body text ---- */
p {
    margin-bottom: 1.3em;
}
p:last-child {
    margin-bottom: 0;
}
.lede {
    font-size: var(--text-base);
    line-height: 1.65;
    color: var(--text);
    max-width: 33rem;
    margin-bottom: 1.3em;
}
strong {
    font-weight: 600;
    color: var(--heading);
}
em {
    font-style: italic;
}

.prose a {
    border-bottom: 1px solid var(--accent-soft);
    transition: color 0.15s, border-color 0.15s;
}
.prose a:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

ul,
ol {
    margin: 0 0 1.3em;
    padding-left: 1.3em;
}
li {
    margin-bottom: 0.4em;
}
li::marker {
    color: var(--text-3);
}

blockquote {
    border-left: 2px solid var(--accent-soft);
    padding-left: 1.1rem;
    margin: 1.6rem 0;
    color: var(--text-2);
    font-style: italic;
}

code {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.85em;
    background: var(--code-bg);
    padding: 0.12em 0.35em;
    border-radius: 3px;
}
pre {
    background: var(--code-bg);
    padding: 1.1rem 1.25rem;
    overflow-x: auto;
    border-radius: 6px;
    margin: 1.5rem 0;
    font-size: var(--text-sm);
    line-height: 1.5;
}
pre code {
    background: none;
    padding: 0;
}

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

/* ---- Shared section label (mono) ---- */
.label {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.62rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    color: var(--text-3);
    margin-bottom: 1.25rem;
}

/* ---- Homepage hero ---- */
.home header {
    margin-bottom: 3rem;
}
.home .intro {
    font-size: var(--text-base);
    line-height: 1.65;
    color: #423e37;
    max-width: 33rem;
}
.home .intro a {
    border-bottom: 1px solid var(--accent-soft);
    transition: color 0.15s, border-color 0.15s;
}
.home .intro a:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.home section {
    margin-bottom: 2.75rem;
}

/* Curated post (home) — title + gloss */
.posts {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}
.post-card {
    display: block;
    transition: transform 0.15s;
}
.post-card:hover {
    transform: translateX(3px);
}
.post-card .title {
    font-size: 1.12rem;
    line-height: 1.32;
    margin-bottom: 0.2rem;
    color: var(--heading);
    transition: color 0.15s;
}
.post-card:hover .title {
    color: var(--accent);
}
.post-card .gloss {
    font-size: var(--text-xs);
    line-height: 1.5;
    color: var(--text-3);
}
.more {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.67rem;
    color: var(--text-3);
    display: inline-block;
    margin-top: 1.4rem;
    transition: color 0.15s;
}
.more:hover {
    color: var(--accent);
}

/* Building rows (home + software) */
.rows {
    display: flex;
    flex-direction: column;
}
.row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1.25rem;
    padding: 0.7rem 0;
    transition: transform 0.15s;
}
.row:not(:last-child) {
    border-bottom: 1px solid var(--border);
}
.row:hover {
    transform: translateX(3px);
}
.row .title {
    font-size: 1.05rem;
    color: var(--heading);
    transition: color 0.15s;
}
.row:hover .title {
    color: var(--accent);
}
.row .what {
    font-size: var(--text-xs);
    color: var(--text-3);
    text-align: right;
}

/* ---- Date-stamped index (writing, archive) ---- */
.index {
    display: flex;
    flex-direction: column;
}
.entry {
    display: flex;
    align-items: baseline;
    gap: 1.1rem;
    padding: 0.62rem 0;
    border-top: 1px solid var(--border);
    transition: transform 0.15s;
}
.index .entry:last-child {
    border-bottom: 1px solid var(--border);
}
.entry:hover {
    transform: translateX(3px);
}
.entry .date {
    font-family: "JetBrains Mono", monospace;
    font-size: var(--text-xs);
    color: var(--text-3);
    white-space: nowrap;
    width: 5.1rem;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.entry .ti {
    font-size: var(--text-base);
    line-height: 1.35;
    transition: color 0.15s;
}
.entry:hover .ti {
    color: var(--accent);
}

/* Series sub-lists (writing) */
.series h3 {
    margin-top: 2.2rem;
    margin-bottom: 0.4rem;
}
.series-list {
    display: flex;
    flex-direction: column;
}
.series-list a {
    padding: 0.42rem 0;
    border-top: 1px solid var(--border);
    font-size: var(--text-base);
    transition: color 0.15s, transform 0.15s;
}
.series-list a:hover {
    color: var(--accent);
    transform: translateX(3px);
}

/* ---- Software / project blocks ---- */
.project {
    margin-bottom: 1.8rem;
}
.project h3 {
    margin-top: 0;
}
.project h3 a {
    border-bottom: 1px solid var(--accent-soft);
}
.project h3 a:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.minor p {
    font-size: var(--text-sm);
    color: var(--text-2);
    margin-bottom: 0.55em;
}

/* ---- Callout (therapy disclosure, etc.) ---- */
.callout {
    border-left: 2px solid var(--accent-soft);
    padding-left: 1.1rem;
    margin: 1.8rem 0;
    color: var(--text-2);
    font-size: var(--text-sm);
    line-height: 1.6;
}

/* ---- Article (post) ---- */
.article .meta {
    font-family: "JetBrains Mono", monospace;
    font-size: var(--text-xs);
    color: var(--text-3);
    margin-bottom: 0.6rem;
}
.article .byline {
    font-size: var(--text-sm);
    color: var(--text-2);
    margin-bottom: 2.2rem;
    line-height: 1.5;
}
.article .byline a {
    border-bottom: 1px solid var(--accent-soft);
}
.article .byline a:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.article .prose p,
.article .prose ul {
    font-size: var(--text-base);
    line-height: 1.72;
}
.article .prose h2 {
    font-size: var(--text-lg);
}
.article-foot {
    margin-top: 3rem;
    padding-top: 1.4rem;
    border-top: 1px solid var(--rule);
    font-family: "JetBrains Mono", monospace;
    font-size: var(--text-xs);
    color: var(--text-3);
}
.article-foot a:hover {
    color: var(--accent);
}

/* ---- Footer ---- */
.foot {
    margin-top: 4rem;
    padding-top: 1.6rem;
    border-top: 1px solid var(--rule);
    font-family: "JetBrains Mono", monospace;
    font-size: 0.67rem;
    line-height: 2.1;
    color: var(--text-3);
}
.foot .k {
    color: #8a8474;
}
.foot a {
    border-bottom: 1px solid var(--accent-soft);
    transition: color 0.15s, border-color 0.15s;
}
.foot a:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.foot .nav-row {
    display: flex;
    gap: 1.1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.foot .nav-row a {
    border-bottom: none;
    color: var(--text-2);
}
.foot .nav-row a:hover {
    color: var(--accent);
}

/* ---- Contact / inquiry form ---- */
.form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    max-width: 33rem;
    margin-top: 2.2rem;
}
.field {
    width: 100%;
    font-family: "Source Serif 4", Georgia, serif;
    font-size: var(--text-sm);
    color: var(--text);
    background: var(--field-bg);
    border: 1px solid var(--rule);
    border-radius: 7px;
    padding: 0.6rem 0.75rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.field::placeholder {
    color: var(--text-3);
}
.field:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea.field {
    resize: vertical;
    min-height: 7rem;
    line-height: 1.5;
}
.submit {
    font-family: "JetBrains Mono", monospace;
    font-size: var(--text-xs);
    letter-spacing: 0.03em;
    color: var(--bg);
    background: var(--accent);
    border: none;
    border-radius: 7px;
    padding: 0.62rem 1.3rem;
    cursor: pointer;
    align-self: flex-start;
    white-space: nowrap;
    transition: filter 0.15s;
}
.submit:hover {
    filter: brightness(1.08);
}
.sent {
    margin-top: 2.2rem;
    border-top: 1px solid var(--rule);
    padding-top: 1.6rem;
    font-size: var(--text-base);
    color: var(--text);
    max-width: 33rem;
}
.hp {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}
.cf-turnstile {
    margin: 0.2rem 0;
}
.form-error {
    margin-top: 1rem;
    max-width: 33rem;
    font-size: var(--text-sm);
    color: #a3432f;
}


@media (max-width: 600px) {
    html {
        font-size: 19px;
    }
    .home {
        padding-top: 4.5rem;
        padding-bottom: 4rem;
    }
    .nav {
        gap: 0.4rem 1rem;
    }
    .entry {
        flex-direction: column;
        gap: 0.1rem;
    }
    .entry .date {
        width: auto;
    }
}

/* >=44px tap targets on touch / coarse-pointer devices (shared header nav),
   any viewport incl. landscape phones. Body/footer links + desktop unchanged. */
@media (pointer: coarse) {
    .nav .links a,
    .nav .home-link {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
}

@media print {
    body {
        color: #000;
        background: #fff;
    }
    .nav,
    .foot {
        display: none;
    }
    .prose a,
    .foot a {
        border-bottom: none;
    }
}
