/* =====================================================================
   La Brecha  ·  Ghost theme  ·  screen.css
   Mexican-modernist identity ported from Camila Hub + Thinker Distillery.
   Palette, type, spacing and motifs are the shared house tokens.
   House rule: zero em-dashes in shipped copy.
   ===================================================================== */

/* ---------------------------------------------------------------------
   SELF-HOSTING FONTS (optional, recommended for offline / strict CSP)
   Drop Cardo, Source Serif 4 and JetBrains Mono woff2 files into
   assets/fonts/, uncomment this block, then delete the three <link>
   tags in default.hbs. File names below are a suggestion, adjust to
   match what you download.
   ---------------------------------------------------------------------
   @font-face {
     font-family: 'Cardo';
     src: url('../fonts/cardo-regular.woff2') format('woff2');
     font-weight: 400; font-style: normal; font-display: swap;
   }
   @font-face {
     font-family: 'Source Serif 4';
     src: url('../fonts/source-serif-4-variable.woff2') format('woff2');
     font-weight: 300 700; font-style: normal; font-display: swap;
   }
   @font-face {
     font-family: 'JetBrains Mono';
     src: url('../fonts/jetbrains-mono-variable.woff2') format('woff2');
     font-weight: 400 500; font-style: normal; font-display: swap;
   }
   --------------------------------------------------------------------- */

:root {
    /* ── Mexican-modernist palette (shared house tokens) ─────────────── */
    --paper: #F4EFE6;
    --paper-warm: #EDE6D7;
    --ink: #2A2520;
    --stone-700: #4E4842;
    --stone-600: #6B6258;
    --stone-500: #8B8275;
    --stone-300: #D9D1C2;
    --azul: #2C4A6B;   /* Talavera azul, primary accent */
    --tierra: #A04A2C; /* Oaxaca terracotta, link-hover + ornament */
    --oro: #B8956A;    /* gold, visited links + quote rule */

    /* ── Type stacks ─────────────────────────────────────────────────────
       --gh-font-heading / --gh-font-body are injected by Ghost only when a
       site owner picks a custom font in Admin (Settings, Design, Typography).
       When unset they fall back to the Mexican-modernist house stacks, so the
       identity holds by default and Julie can still override from the UI. */
    --display: var(--gh-font-heading, 'Cardo', 'Iowan Old Style', 'Hoefler Text', Georgia, Cambria, 'Times New Roman', serif);
    --body: var(--gh-font-body, 'Source Serif 4', 'Source Serif Pro', 'Iowan Old Style', Georgia, Cambria, serif);
    --mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;

    /* ── Layout rhythm ───────────────────────────────────────────────── */
    --measure: 720px;                       /* content column */
    --measure-wide: 960px;                  /* feature image column */
    --prose: 65ch;                          /* reading measure */
    --gutter: clamp(16px, 4vw, 32px);
    --section-gap: 56px;
}

/* ── Reset-ish base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
    font-size: 18px;
    -webkit-text-size-adjust: 100%;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--body);
    font-optical-sizing: auto;
    font-feature-settings: "kern", "liga";
    line-height: 1.62;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-main { flex: 1 0 auto; }

img { max-width: 100%; height: auto; }

::selection {
    background-color: var(--azul);
    color: var(--paper);
}

/* ── Shared width container ───────────────────────────────────────────── */
.wrap {
    max-width: var(--measure);
    margin-inline: auto;
    padding-inline: var(--gutter);
    width: 100%;
}

/* ── Links (site-wide affordance) ─────────────────────────────────────── */
a {
    color: var(--azul);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.15em;
    transition: color 120ms ease, text-decoration-color 120ms ease;
}
a:hover { color: var(--tierra); text-decoration-color: var(--tierra); }
a:visited { color: var(--oro); }

:focus-visible {
    outline: 2px solid var(--azul);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ── Skip link ────────────────────────────────────────────────────────── */
.skip-link {
    position: absolute;
    top: -48px;
    left: 0;
    background: var(--azul);
    color: var(--paper);
    padding: 10px 18px;
    text-decoration: none;
    font-family: var(--body);
    font-size: 0.92rem;
    z-index: 1000;
    transition: top 120ms ease;
}
.skip-link:focus, .skip-link:focus-visible { top: 0; color: var(--paper); }

/* ── Cenefa ornament (the one recurring motif) ────────────────────────── */
.cenefa { color: var(--tierra); display: block; }
.ornament-row {
    display: flex;
    justify-content: center;
    padding-block: 20px;
}

/* =====================================================================
   HEADER  ·  wordmark + tagline + nav chrome
   ===================================================================== */
.site-header {
    border-bottom: 1px solid var(--stone-300);
}
.site-header-inner {
    padding-top: 30px;
    padding-bottom: 20px;
}
.site-brand { margin: 0; }

.site-wordmark {
    margin: 0;
    font-family: var(--display);
    font-weight: 500;
    font-size: clamp(1.7rem, 4vw, 2.3rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
}
.site-wordmark a {
    color: var(--ink);
    text-decoration: none;
}
.site-wordmark a:hover { color: var(--tierra); }

.site-tagline {
    margin: 6px 0 0;
    font-family: var(--body);
    font-style: italic;
    font-size: 1rem;
    color: var(--stone-700);
    max-width: 52ch;
    line-height: 1.45;
}

.site-nav { margin-top: 16px; }
.nav-list {
    display: flex;
    flex-wrap: wrap;
    gap: 22px;
    margin: 0;
    padding-top: 12px;
    list-style: none;
    border-top: 1px solid var(--azul);
    font-family: var(--mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
}
.nav-item a {
    color: var(--stone-600);
    text-decoration: none;
    padding: 2px 0;
}
.nav-item a:hover { color: var(--tierra); }
.nav-current a { color: var(--ink); }

/* Ornament row inside header sits flush under the chrome */
.site-header .ornament-row { padding-bottom: 4px; }

/* =====================================================================
   HOME / INDEX FEED  ·  editorial list, not boxy grid
   ===================================================================== */
.post-feed {
    margin: 0;
    padding: 0;
}
.post-feed-lead { margin-top: 40px; }
.post-feed-lead + .post-feed { margin-top: 8px; }

.post-card {
    border-bottom: 1px solid var(--stone-300);
    padding-block: 30px;
}
.post-feed-lead .post-card { border-bottom: 1px solid var(--stone-300); }

.post-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}
.post-card-link:hover .post-card-title { color: var(--tierra); }

.post-card-image {
    margin-bottom: 18px;
    overflow: hidden;
    border-radius: 3px;
}
.post-card-image img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}
/* Lead card gets the image; subsequent rows read as a text list */
.post-feed .post-card:not(:first-child) .post-card-image { display: none; }

.post-card-tag {
    display: inline-block;
    font-family: var(--mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--azul);
    margin-bottom: 8px;
}
.post-card-title {
    font-family: var(--display);
    font-weight: 500;
    font-size: clamp(1.4rem, 3vw, 1.9rem);
    letter-spacing: -0.015em;
    line-height: 1.15;
    color: var(--ink);
    margin: 0 0 10px;
    transition: color 120ms ease;
}
.post-card-excerpt {
    font-family: var(--body);
    color: var(--stone-700);
    font-size: 1.02rem;
    line-height: 1.55;
    max-width: 62ch;
    margin: 0 0 12px;
}
.post-card-meta {
    font-family: var(--mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--stone-500);
}
.post-card-sep { margin-inline: 8px; }

/* ── Pagination ───────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin: 44px 0 8px;
    font-family: var(--mono);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.pagination a { color: var(--azul); text-decoration: none; }
.pagination a:hover { color: var(--tierra); }
.pagination .page-number { color: var(--stone-500); }

/* =====================================================================
   POST  ·  long-form reading experience
   ===================================================================== */
.post-header {
    padding-top: 52px;
    padding-bottom: 8px;
    text-align: left;
}
.post-tag, .post-tag-pill {
    font-family: var(--mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--azul);
    text-decoration: none;
}
.post-tag:hover { color: var(--tierra); }

.post-title {
    font-family: var(--display);
    font-weight: 500;
    font-size: clamp(2.2rem, 5.5vw, 3.4rem);
    letter-spacing: -0.02em;
    line-height: 1.08;
    color: var(--ink);
    margin: 14px 0 0;
    max-width: 20ch;
}
.post-lede {
    font-family: var(--body);
    font-style: italic;
    font-size: 1.28rem;
    line-height: 1.5;
    color: var(--stone-700);
    max-width: 54ch;
    margin: 18px 0 0;
}
.post-byline {
    margin-top: 22px;
    font-family: var(--mono);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--stone-500);
}
.post-byline-sep { margin-inline: 8px; }
.post-author { color: var(--stone-700); }

.post-feature-image {
    margin: 40px auto 0;
    max-width: var(--measure-wide);
    padding-inline: var(--gutter);
}
.post-feature-image img {
    display: block;
    width: 100%;
    border-radius: 3px;
}
.post-feature-image figcaption {
    margin-top: 10px;
    font-family: var(--mono);
    font-size: 0.74rem;
    color: var(--stone-500);
    text-align: center;
}

/* ── Content prose (Koenig output) ───────────────────────────────────── */
.post-content {
    margin-top: 40px;
    font-size: 1.06rem;
    line-height: 1.7;
    color: var(--ink);
}
.gh-content > * {
    max-width: var(--prose);
    margin-inline: auto;
}
.gh-content > p,
.gh-content > ul,
.gh-content > ol,
.gh-content > blockquote,
.gh-content > h2,
.gh-content > h3,
.gh-content > h4,
.gh-content > hr,
.gh-content > .kg-callout-card,
.gh-content > .kg-toggle-card { margin-block: 1.35em; }

.gh-content p { max-width: var(--prose); }

.gh-content h2, .gh-content h3, .gh-content h4 {
    font-family: var(--display);
    color: var(--ink);
    letter-spacing: -0.01em;
    line-height: 1.2;
}
.gh-content h2 { font-weight: 500; font-size: 1.7rem; margin-top: 2em; }
.gh-content h3 { font-weight: 400; font-size: 1.35rem; margin-top: 1.6em; }
.gh-content h4 { font-weight: 500; font-size: 1.1rem; }

.gh-content a {
    color: var(--tierra);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.15em;
}
.gh-content a:hover { color: var(--azul); }
.gh-content a:visited { color: var(--oro); }

/* Drop cap on the opening paragraph, ported from Camila Hub */
.gh-content > p:first-of-type::first-letter {
    color: var(--azul);
    font-family: var(--display);
    font-weight: 400;
    font-size: 4.2em;
    line-height: 0.82;
    float: left;
    margin: 0.08em 0.1em 0 -0.02em;
}

.gh-content blockquote {
    margin-inline: auto;
    padding: 4px 0 4px 22px;
    border-left: 3px solid var(--oro);
    font-style: italic;
    color: var(--stone-700);
}
.gh-content blockquote p { max-width: none; }

.gh-content hr {
    border: 0;
    border-top: 1px solid var(--stone-300);
    max-width: var(--prose);
}

.gh-content code {
    font-family: var(--mono);
    font-size: 0.86em;
    color: var(--azul);
    background: var(--paper-warm);
    padding: 0.12em 0.36em;
    border-radius: 3px;
}
.gh-content pre {
    max-width: var(--measure-wide);
    background: var(--ink);
    color: var(--paper);
    font-family: var(--mono);
    font-size: 0.86rem;
    line-height: 1.55;
    padding: 20px 22px;
    border-radius: 4px;
    overflow-x: auto;
}
.gh-content pre code {
    background: none;
    color: inherit;
    padding: 0;
    font-size: inherit;
}

.gh-content ul, .gh-content ol { padding-left: 1.3em; }
.gh-content li { margin-block: 0.4em; }
.gh-content li::marker { color: var(--stone-500); }

.gh-content figure { margin-inline: auto; }
.gh-content figcaption {
    margin-top: 10px;
    font-family: var(--mono);
    font-size: 0.74rem;
    color: var(--stone-500);
    text-align: center;
}

/* Koenig wide / full-bleed images escape the reading measure */
.gh-content .kg-width-wide {
    max-width: var(--measure-wide);
}
.gh-content .kg-width-full {
    max-width: 100%;
    padding-inline: 0;
}
.gh-content .kg-card { margin-inline: auto; }

/* Koenig callout card, tinted in the house lane style */
.gh-content .kg-callout-card {
    max-width: var(--prose);
    background: var(--paper-warm);
    border-left: 4px solid var(--azul);
    border-radius: 2px;
    padding: 16px 20px;
}

/* Koenig button card */
.gh-content .kg-btn {
    display: inline-block;
    background: var(--azul);
    color: var(--paper);
    font-family: var(--mono);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-decoration: none;
    padding: 12px 22px;
    border-radius: 3px;
}
.gh-content .kg-btn:hover { background: var(--tierra); color: var(--paper); }

/* Koenig bookmark card, palette-aware */
.gh-content .kg-bookmark-container {
    border: 1px solid var(--stone-300);
    border-radius: 4px;
    background: var(--paper-warm);
    color: var(--ink);
    text-decoration: none;
}
.gh-content .kg-bookmark-title { color: var(--ink); font-family: var(--body); }
.gh-content .kg-bookmark-description { color: var(--stone-700); }

/* ── Post footer ──────────────────────────────────────────────────────── */
.post-footer {
    margin-top: 8px;
    padding-bottom: 8px;
}
.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    max-width: var(--prose);
    margin: 8px auto 0;
}
.post-tag-pill {
    background: var(--paper-warm);
    border: 1px solid var(--stone-300);
    border-radius: 999px;
    padding: 3px 12px;
}
.post-tag-pill:hover { color: var(--tierra); border-color: var(--tierra); }

.post-comments { margin: 48px auto 0; }

/* =====================================================================
   SUBSCRIBE  ·  members signup
   ===================================================================== */
.subscribe {
    background: var(--paper-warm);
    border-top: 1px solid var(--stone-300);
    border-bottom: 1px solid var(--stone-300);
    margin-top: var(--section-gap);
}
.subscribe-inner {
    padding-block: 48px;
    text-align: center;
}
.subscribe-heading {
    font-family: var(--display);
    font-weight: 500;
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    letter-spacing: -0.015em;
    color: var(--ink);
    margin: 0 0 10px;
}
.subscribe-sub {
    font-family: var(--body);
    font-size: 1.05rem;
    color: var(--stone-700);
    max-width: 48ch;
    margin: 0 auto 24px;
    line-height: 1.5;
}
.subscribe-label {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap;
}
.subscribe-fields {
    display: flex;
    gap: 10px;
    max-width: 460px;
    margin: 0 auto;
}
.subscribe-fields input {
    flex: 1 1 auto;
    font-family: var(--body);
    font-size: 1rem;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--stone-500);
    border-radius: 3px;
    padding: 12px 14px;
    min-width: 0;
}
.subscribe-fields input::placeholder { color: var(--stone-500); }
.subscribe-button {
    flex: 0 0 auto;
    font-family: var(--mono);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--paper);
    background: var(--azul);
    border: 1px solid var(--azul);
    border-radius: 3px;
    padding: 12px 22px;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease;
}
.subscribe-button:hover { background: var(--tierra); border-color: var(--tierra); }
.subscribe-message {
    font-family: var(--mono);
    font-size: 0.76rem;
    letter-spacing: 0.04em;
    margin: 14px 0 0;
}
.subscribe-success { color: var(--azul); }
.subscribe-error { color: var(--tierra); }
.subscribe-member {
    font-family: var(--body);
    font-style: italic;
    color: var(--stone-700);
}

/* Ghost toggles these classes on the form after submit */
.subscribe-form.success .subscribe-success { display: block !important; }
.subscribe-form.error .subscribe-error { display: block !important; }

/* =====================================================================
   FOOTER
   ===================================================================== */
.site-footer {
    flex-shrink: 0;
    margin-top: var(--section-gap);
    border-top: 1px solid var(--stone-300);
}
.site-footer-inner { padding-block: 24px 32px; }
.site-footer .ornament-row { padding-top: 0; }
.footer-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}
.footer-copy {
    margin: 0;
    font-family: var(--mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--stone-500);
}
.footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-family: var(--mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.footer-nav a {
    color: var(--stone-500);
    text-decoration: none;
    border-bottom: 1px dotted var(--stone-500);
}
.footer-nav a:hover { color: var(--tierra); border-bottom-color: var(--tierra); }
.footer-nav .nav-list {
    border: 0;
    padding: 0;
    gap: 16px;
    font-size: inherit;
    letter-spacing: inherit;
}

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 600px) {
    html { font-size: 17px; }
    .post-header { padding-top: 36px; }
    .subscribe-fields { flex-direction: column; }
    .footer-meta { flex-direction: column; align-items: flex-start; }
    .gh-content > p:first-of-type::first-letter { font-size: 3.4em; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; scroll-behavior: auto !important; }
}

/* Error page helper */
.error-content { text-align: center; padding-block: 80px; }
.error-code {
    font-family: var(--display);
    font-size: clamp(4rem, 14vw, 8rem);
    color: var(--azul);
    line-height: 1;
    margin: 0;
}
.error-message {
    font-family: var(--body);
    font-style: italic;
    font-size: 1.2rem;
    color: var(--stone-700);
    margin: 12px 0 28px;
}
