/*
Theme Name: A Nerd Writes
Description: Custom editorial theme for anerdwrites.com, built from Leo's Claude design (warm paper palette, Instrument Serif / Newsreader / Space Mono).
Version: 1.0
Author: Leo
*/

:root {
  --paper: #f4eee1;
  --card: #faf6ec;
  --ink: #211d18;
  --ink-soft: #3a352c;
  --text-soft: #5a5347;
  --muted: #7a7263;
  --accent: #c8492f;
  --accent-dark: #8f2f1c;
  --accent-warm: #e0916f;
  --dark-bg: #211d18;
  --dark-text: #f4eee1;
  --dark-soft: #cfc6b5;
  --rule: rgba(33, 29, 24, 0.15);
  --serif-display: 'Instrument Serif', serif;
  --serif-body: 'Newsreader', Georgia, serif;
  --mono: 'Space Mono', monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif-body);
  min-height: 100vh;
}
::selection { background: var(--accent); color: #f6f1e7; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }
img { max-width: 100%; height: auto; }

.wrap { max-width: 1180px; margin: 0 auto; padding-left: 40px; padding-right: 40px; }
.rule { height: 1px; background: var(--ink); opacity: 0.15; }

/* ---- header ---- */
.site-header { padding: 26px 40px; max-width: 1180px; margin: 0 auto; display: flex; align-items: baseline; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.site-logo { font-family: var(--serif-display); font-size: 30px; letter-spacing: -0.01em; color: var(--ink); }
.site-logo em { color: var(--accent); font-style: italic; }
.site-nav { display: flex; gap: 30px; align-items: baseline; font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; flex-wrap: wrap; }
.site-nav a { color: var(--ink); }
.site-nav a.current, .site-nav a:hover { color: var(--accent); }
.site-nav .ext { color: var(--accent); }

/* ---- kickers / section heads ---- */
.kicker { font-family: var(--mono); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); }
.section-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 30px; }
.section-head .rule { flex: 1; }
.section-head .more { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

/* ---- hero ---- */
.hero { padding-top: 70px; padding-bottom: 40px; display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 56px; align-items: center; }
.hero .kicker { margin-bottom: 22px; }
.hero h1 { font-family: var(--serif-display); font-weight: 400; font-size: 76px; line-height: 1.02; letter-spacing: -0.02em; margin: 0 0 24px; }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero .lede { font-size: 21px; line-height: 1.55; max-width: 30em; color: var(--ink-soft); margin: 0 0 32px; font-weight: 350; }
.hero-actions { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.btn-dark { font-family: var(--mono); font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; background: var(--ink); color: var(--paper) !important; padding: 14px 26px; border-radius: 2px; }
.btn-dark:hover { background: var(--accent); }
.link-underline { font-family: var(--mono); font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink) !important; border-bottom: 1px solid var(--ink); padding-bottom: 2px; }
.polaroid { position: relative; aspect-ratio: 4/5; transform: rotate(-2deg); background: #fff; padding: 12px 12px 46px; box-shadow: 0 24px 48px -20px rgba(33,29,24,0.4); }
.polaroid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.polaroid figcaption { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; color: var(--muted); }

/* ---- topic cards ---- */
.topics { padding-top: 56px; padding-bottom: 56px; }
.topic-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.topic-card { color: var(--ink); border: 1px solid rgba(33,29,24,0.18); padding: 26px 22px; background: var(--card); display: block; transition: transform .15s, border-color .15s; }
.topic-card:hover { transform: translateY(-3px); border-color: var(--accent); color: var(--ink); }
.topic-card .num { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-bottom: 14px; }
.topic-card .name { font-family: var(--serif-display); font-size: 30px; line-height: 1.05; margin-bottom: 10px; }
.topic-card p { font-size: 15px; line-height: 1.5; color: var(--text-soft); margin: 0; font-weight: 350; }

/* ---- featured + recent posts (front) ---- */
.writing { padding-top: 56px; padding-bottom: 40px; }
.lead-post { color: var(--ink); display: grid; grid-template-columns: 1fr 1fr; gap: 44px; align-items: center; margin-bottom: 48px; }
.lead-post:hover { color: var(--ink); }
.frame { background: #fff; padding: 10px; box-shadow: 0 18px 36px -22px rgba(33,29,24,0.35); }
.frame img { width: 100%; aspect-ratio: 3/2; object-fit: cover; display: block; }
.post-meta { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-bottom: 14px; display: flex; gap: 12px; flex-wrap: wrap; }
.post-meta .date { color: var(--muted); }
.lead-post h3 { font-family: var(--serif-display); font-weight: 400; font-size: 44px; line-height: 1.06; letter-spacing: -0.01em; margin: 0 0 14px; }
.lead-post .excerpt { font-size: 18px; line-height: 1.55; color: #4a4438; margin: 0 0 18px; font-weight: 350; }
.read-link { font-family: var(--mono); font-size: 12px; letter-spacing: 0.05em; color: var(--ink); border-bottom: 1px solid var(--accent); padding-bottom: 2px; }
.mini-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 36px; }
.mini-post { color: var(--ink); display: block; }
.mini-post:hover { color: var(--ink); }
.mini-post:hover h4 { color: var(--accent); }
.mini-post h4 { font-family: var(--serif-display); font-weight: 400; font-size: 28px; line-height: 1.1; margin: 0 0 10px; }
.mini-post p { font-size: 15.5px; line-height: 1.5; color: var(--text-soft); margin: 0; font-weight: 350; }

/* ---- about strip ---- */
.about-strip { background: var(--dark-bg); color: var(--dark-text); margin-top: 40px; }
.about-strip .inner { padding-top: 70px; padding-bottom: 70px; display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 56px; align-items: center; }
.about-photo { aspect-ratio: 1; background: #2c261f; padding: 10px; max-width: 280px; }
.about-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.about-strip .kicker { color: var(--accent-warm); margin-bottom: 20px; }
.about-strip .big { font-family: var(--serif-display); font-size: 34px; line-height: 1.25; margin: 0 0 20px; font-weight: 400; }
.about-strip .soft { font-size: 18px; line-height: 1.6; color: var(--dark-soft); margin: 0 0 26px; max-width: 34em; font-weight: 350; }
.btn-warm { font-family: var(--mono); font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink) !important; background: var(--accent-warm); padding: 13px 24px; border-radius: 2px; }
.btn-warm:hover { background: var(--paper); }

/* ---- footer ---- */
.site-footer { max-width: 1180px; margin: 0 auto; padding: 44px 40px 60px; display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 24px; }
.site-footer .logo { font-family: var(--serif-display); font-size: 24px; color: var(--ink); }
.site-footer .links { font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; color: var(--muted); display: flex; gap: 24px; flex-wrap: wrap; }
.site-footer .links a { color: var(--muted); }
.site-footer .links a:hover { color: var(--accent); }

/* ---- blog list ---- */
.masthead { padding-top: 60px; padding-bottom: 34px; }
.masthead .kicker { margin-bottom: 18px; }
.masthead h1 { font-family: var(--serif-display); font-weight: 400; font-size: 72px; line-height: 1.0; letter-spacing: -0.02em; margin: 0 0 18px; }
.masthead p { font-size: 20px; line-height: 1.55; color: var(--text-soft); max-width: 34em; margin: 0; font-weight: 350; }
.post-list { padding-top: 24px; padding-bottom: 40px; }
.post-row { color: var(--ink); display: grid; grid-template-columns: 150px 1fr 190px; gap: 32px; align-items: center; padding: 28px 0; border-top: 1px solid rgba(33,29,24,0.14); }
.post-row:last-of-type { border-bottom: 1px solid rgba(33,29,24,0.14); }
.post-row:hover { background: var(--card); color: var(--ink); }
.post-row .rowmeta { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.post-row .rowmeta .date { color: var(--muted); }
.post-row h3 { font-family: var(--serif-display); font-weight: 400; font-size: 34px; line-height: 1.06; margin: 0 0 8px; }
.post-row p { font-size: 16.5px; line-height: 1.5; color: var(--text-soft); margin: 0; font-weight: 350; }
.post-row .thumb { background: #fff; padding: 6px; box-shadow: 0 12px 26px -18px rgba(33,29,24,0.4); }
.post-row .thumb img { width: 100%; aspect-ratio: 3/2; object-fit: cover; display: block; }
.pagination-row { text-align: center; padding: 44px 0 10px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.pagination-row a, .pagination-row span { color: var(--muted); border: 1px solid rgba(33,29,24,0.25); padding: 12px 22px; border-radius: 2px; margin: 0 6px; display: inline-block; }
.pagination-row a:hover { color: var(--accent); border-color: var(--accent); }
.pagination-row .current { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---- single post ---- */
.article-head { max-width: 720px; margin: 0 auto; padding: 56px 40px 20px; }
.backlink { font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.backlink:hover { color: var(--accent); }
.article-head .meta { font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin: 26px 0 18px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.article-head .meta .dim { color: var(--muted); }
.article-head h1 { font-family: var(--serif-display); font-weight: 400; font-size: 62px; line-height: 1.03; letter-spacing: -0.02em; margin: 0 0 22px; }
.article-head .standfirst { font-size: 23px; line-height: 1.5; color: var(--text-soft); font-style: italic; margin: 0 0 8px; font-weight: 350; }
.post-hero { max-width: 960px; margin: 24px auto 0; padding: 0 40px; }
.post-hero .frame img { aspect-ratio: 16/9; }
.post-hero .caption { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; color: var(--muted); margin-top: 12px; text-align: center; }

.prose { max-width: 720px; margin: 0 auto; padding: 50px 40px 20px; }
.prose p { font-size: 20px; line-height: 1.7; color: #322d24; margin: 0 0 26px; font-weight: 350; }
.prose h2 { font-family: var(--serif-display); font-weight: 400; font-size: 38px; line-height: 1.1; letter-spacing: -0.01em; margin: 48px 0 18px; }
.prose h3 { font-family: var(--serif-display); font-weight: 400; font-size: 30px; line-height: 1.15; margin: 40px 0 16px; }
.prose a { border-bottom: 1px solid var(--accent); }
.prose blockquote { border-left: 3px solid var(--accent); padding: 4px 0 4px 24px; margin: 34px 0; }
.prose blockquote p { font-family: var(--serif-display); font-size: 30px; line-height: 1.25; color: var(--ink); margin: 0; font-style: italic; }
.prose img { background: #fff; padding: 8px; box-shadow: 0 14px 30px -20px rgba(33,29,24,0.4); }
.prose code, .prose pre { font-family: var(--mono); font-size: 0.85em; background: var(--card); border: 1px solid var(--rule); }
.prose pre { padding: 18px; overflow-x: auto; }
.prose code { padding: 2px 6px; }
.prose ul, .prose ol { font-size: 20px; line-height: 1.7; color: #322d24; font-weight: 350; }
.author-strip { max-width: 720px; margin: 0 auto; padding: 20px 40px; }
.author-strip .rule { margin-bottom: 32px; opacity: 0.12; }
.author-strip .row { display: flex; gap: 20px; align-items: center; }
.author-strip .avatar { width: 64px; height: 64px; flex: none; background: #e6ddcb; border-radius: 50%; overflow: hidden; }
.author-strip .avatar img { width: 100%; height: 100%; object-fit: cover; }
.author-strip .name { font-family: var(--serif-display); font-size: 24px; line-height: 1.1; }
.author-strip p { font-size: 16px; line-height: 1.5; color: var(--text-soft); margin: 6px 0 0; font-weight: 350; }
.keep-reading { padding-top: 56px; padding-bottom: 56px; }

/* ---- pages ---- */
.page-body { max-width: 960px; margin: 0 auto; padding: 30px 40px 60px; }
.page-body p { font-size: 19px; line-height: 1.65; color: #322d24; font-weight: 350; }

/* ---- Squarespace migrated gallery grids ---- */
.sqs-gallery-block-grid .sqs-gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.sqs-gallery-block-grid.sqs-gallery-thumbnails-per-row-2 .sqs-gallery { grid-template-columns: repeat(2, 1fr); }
.sqs-gallery-block-grid.sqs-gallery-thumbnails-per-row-3 .sqs-gallery { grid-template-columns: repeat(3, 1fr); }
.sqs-gallery-block-grid .sqs-gallery .slide { margin: 0; }
.sqs-gallery-block-grid .sqs-gallery .slide p { margin: 0; }
.sqs-gallery-block-grid .sqs-gallery img.thumb-image { width: 100%; height: auto; display: block; }
.sqs-gallery-block-grid.sqs-gallery-aspect-ratio-square .sqs-gallery img.thumb-image { aspect-ratio: 1 / 1; object-fit: cover; }

/* ---- responsive ---- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 44px; }
  .hero h1 { font-size: 52px; }
  .polaroid { max-width: 380px; }
  .topic-grid { grid-template-columns: repeat(2, 1fr); }
  .lead-post { grid-template-columns: 1fr; gap: 24px; }
  .mini-grid { grid-template-columns: 1fr; }
  .about-strip .inner { grid-template-columns: 1fr; }
  .post-row { grid-template-columns: 1fr; gap: 14px; }
  .post-row .thumb { max-width: 320px; }
  .masthead h1 { font-size: 52px; }
  .article-head h1 { font-size: 42px; }
}
@media (max-width: 640px) {
  .wrap, .site-header, .site-footer, .article-head, .prose, .post-hero, .author-strip, .page-body { padding-left: 22px; padding-right: 22px; }
  .sqs-gallery-block-grid .sqs-gallery { grid-template-columns: repeat(2, 1fr) !important; }
}
