/* neilspruce.com blog mock-up (Writing and Italy pages share this stylesheet).
   Document Mode from the Better Angles Editorial Style Guide v2.0: paper panels on a sage canvas, Special Elite for the
   page title only, IBM Plex Mono for everything else, rule-based details, no orange.
   Fonts are self-hosted from fonts/ (latin subset), so the page makes no request to Google. */

@font-face {
  font-family: 'Special Elite'; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/special-elite-latin.woff2") format("woff2");
}
@font-face {
  font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/ibm-plex-mono-400-latin.woff2") format("woff2");
}
@font-face {
  font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/ibm-plex-mono-600-latin.woff2") format("woff2");
}

:root {
  --paper: #FAF7F0;
  --sage: #E2ECCF;
  --sage-deep: #cfdcb3;
  --ink: #202020;
  --ink-soft: #555555;
  --rule: #d8d8d8;
  --error: #8f2d1a;
  --font-display: 'Special Elite', 'Courier New', monospace;
  --font-body: 'IBM Plex Mono', 'Courier Prime', 'Courier New', monospace;
  --shadow: 0 1px 2px rgba(0,0,0,0.05), 0 6px 20px rgba(0,0,0,0.05);
}

* { box-sizing: border-box; }

body {
  margin: 0; display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh;
  background: var(--sage); color: var(--ink);
  font-family: var(--font-body); font-size: 15.5px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Header and footer: the same paper strips as the homepage */
.top, footer {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 56px; padding: 0 24px; background: var(--paper);
}
.wordmark { font-weight: 600; text-decoration: none; letter-spacing: 0.01em; white-space: nowrap; }
.top nav { display: flex; flex-wrap: wrap; gap: 4px 24px; font-size: 14px; }
.top nav a { text-decoration: none; padding: 4px 0; border-bottom: 1px solid transparent; }
.top nav a:hover, .top nav a:focus-visible, .top nav a[aria-current] { border-bottom-color: var(--ink); }
footer { flex-direction: column; justify-content: center; gap: 6px; padding: 14px 24px; font-size: 13px; color: var(--ink-soft); text-align: center; }
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 24px; }
.credit { margin: 0; font-size: 12px; }
footer a { text-decoration: none; }
footer a:hover, footer a:focus-visible { text-decoration: underline; }

main { flex: 1 0 auto; width: 100%; max-width: 1000px; margin: 0 auto; padding: 40px 20px 64px; }

/* ---- Hero: title and intro on the left, the line drawing on the sage on the right ---- */
.hero { display: grid; grid-template-columns: 1fr 1.05fr; gap: 24px 40px; align-items: center; margin-bottom: 40px; }
.hero h1 { font-family: var(--font-display); font-weight: 400; font-size: 2.4rem; line-height: 1.2; margin: 0 0 14px; }
.hero .intro { margin: 0 0 22px; max-width: 34ch; color: var(--ink-soft); font-style: italic; }
.hero .banner { width: 100%; }

/* Writing | Italy switcher */
.sections { display: flex; gap: 6px 22px; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; }
.sections a { text-decoration: none; color: var(--ink-soft); padding: 4px 0; border-bottom: 1px solid transparent; }
.sections a:hover, .sections a:focus-visible { color: var(--ink); border-bottom-color: var(--ink); }
.sections a[aria-current] { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }

/* ---- Shared bits ---- */
.meta { margin: 0 0 8px; font-size: 12px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-soft); }
.meta strong { font-weight: 600; color: var(--ink); }
.read { display: inline-block; margin-top: 4px; font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--ink); padding-bottom: 1px; }
.read:hover, .read:focus-visible { background: var(--sage); }
.thumb { background: var(--sage); display: flex; align-items: center; justify-content: center; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }

/* ---- Latest post: the big one ---- */
.featured { display: grid; grid-template-columns: 5fr 7fr; background: var(--paper); box-shadow: var(--shadow); margin-bottom: 28px; }
.featured .thumb { padding: 28px; min-height: 300px; }
.featured .body { padding: 32px 36px 34px; }
.featured h2 { font-size: 1.45rem; line-height: 1.35; font-weight: 600; margin: 0 0 14px; text-wrap: balance; }
.featured h2 a { text-decoration: none; }
.featured h2 a:hover, .featured h2 a:focus-visible { text-decoration: underline; }
.featured p { max-width: 58ch; margin: 0 0 14px; }

/* ---- The rest: cards ---- */
.list-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--ink); padding-bottom: 8px; margin: 40px 0 20px; }
.list-head h2 { margin: 0; font-size: 0.85rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; }
.list-head span { font-size: 12px; color: var(--ink-soft); }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: start; }
.card { display: flex; flex-direction: column; background: var(--paper); box-shadow: var(--shadow); text-decoration: none; transition: transform 0.15s, box-shadow 0.15s; }
.card .thumb { height: 150px; padding: 14px; }
.card .body { padding: 18px 20px 22px; display: flex; flex-direction: column; flex: 1; }
.card h3 { margin: 0 0 8px; font-size: 1rem; line-height: 1.4; font-weight: 600; text-wrap: balance; }
.card p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--ink-soft); }
.card:hover h3, .card:focus-visible h3 { text-decoration: underline; }
.card:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) {
  .card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(0,0,0,0.06), 0 10px 26px rgba(0,0,0,0.08); }
}

/* ---- Signup at the foot of the page ---- */
.join { margin-top: 48px; background: var(--paper); box-shadow: var(--shadow); padding: 34px 36px 30px; }
.join h2 { margin: 0 0 8px; font-size: 1.2rem; font-weight: 600; }
.join .sub { margin: 0 0 20px; max-width: 54ch; color: var(--ink-soft); }
.signup { display: grid; grid-template-columns: 1fr 1.3fr auto; gap: 12px; align-items: start; }
.signup input[type="text"], .signup input[type="email"] {
  width: 100%; height: 48px; padding: 0 14px; background: #fff; border: 1px solid var(--rule); border-radius: 0;
  font-family: var(--font-body); font-size: 15px; color: var(--ink);
}
.signup input:focus-visible, .signup button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.signup button {
  height: 48px; padding: 0 28px; background: var(--ink); color: var(--paper); border: 0; border-radius: 0; cursor: pointer;
  font-family: var(--font-body); font-size: 15px; font-weight: 600;
}
.signup button:hover:not(:disabled) { background: var(--ink-soft); }
.signup button:disabled { cursor: default; opacity: 0.7; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-status { grid-column: 1 / -1; min-height: 1.5em; margin: 0; font-size: 13.5px; color: var(--error); }
.small-print { margin: 8px 0 0; font-size: 12px; color: var(--ink-soft); }
.done { outline: none; }
.done-title { margin: 0 0 6px; font-weight: 600; font-size: 1.1rem; }
.done p { margin: 0 0 8px; }

.sample-note { margin: 32px 0 0; font-size: 12px; font-style: italic; color: var(--ink-soft); text-align: center; }

/* ---- Tablet and phone ---- */
@media (max-width: 860px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .signup { grid-template-columns: 1fr 1fr; }
  .signup button { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  main { padding-top: 24px; }
  .hero { grid-template-columns: 1fr; }
  .hero .banner-wrap { order: -1; }
  .hero h1 { font-size: 2rem; }
  .featured { grid-template-columns: 1fr; }
  .featured .thumb { min-height: 0; height: 220px; padding: 18px; }
  .featured .body { padding: 24px 22px 26px; }
  .join { padding: 26px 22px; }
}
@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr; }
  .signup { grid-template-columns: 1fr; }
  .top { padding: 8px 16px; flex-direction: column; align-items: flex-start; gap: 2px; }
  .top nav { font-size: 13px; gap: 2px 14px; }
}

/* ================================================================================================================
   Post page: one paper panel on the sage, a 66-character reading column, rule-based callouts, sage pull quotes.
   ================================================================================================================ */
.narrow { max-width: 760px; margin-left: auto; margin-right: auto; }

.post { background: var(--paper); box-shadow: var(--shadow); padding: 44px 56px 52px; }
.crumb { margin: 0 0 22px; font-size: 12px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-soft); }
.crumb a { text-decoration: none; border-bottom: 1px solid transparent; }
.crumb a:hover, .crumb a:focus-visible { color: var(--ink); border-bottom-color: var(--ink); }
.post h1 { font-family: var(--font-display); font-weight: 400; font-size: 2.1rem; line-height: 1.25; margin: 0 0 14px; text-wrap: balance; }
.post .meta { margin: 0 0 28px; }
.post .meta a { text-decoration: none; border-bottom: 1px solid var(--ink-soft); }
.post-image { margin: 0 0 32px; }
.post-image .thumb { height: 300px; padding: 22px; }
.post-image figcaption { margin-top: 8px; font-size: 12px; font-style: italic; color: var(--ink-soft); }

.prose p { max-width: 66ch; margin: 0 0 16px; }
.prose h2 { font-size: 1.2rem; line-height: 1.4; font-weight: 600; margin: 36px 0 12px; }
.prose h3 { font-size: 1rem; line-height: 1.4; font-weight: 600; margin: 28px 0 10px; }
.prose h4 { font-size: 0.95rem; line-height: 1.4; font-weight: 600; margin: 22px 0 8px; color: var(--ink-soft); }
.page h1 { margin-bottom: 26px; }
.prose ul, .prose ol { max-width: 60ch; margin: 0 0 20px; padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.prose a { text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a:hover, .prose a:focus-visible { background: var(--sage); }

/* Pull quote: left-aligned, on a sage panel (a markdown blockquote) */
.prose blockquote { margin: 36px 0; padding: 26px 30px; background: var(--sage); }
.prose blockquote p { margin: 0; max-width: 26ch; font-weight: 600; font-size: 1.1rem; line-height: 1.5; }

/* Callout: rule above and below, small label, plain text. Never a coloured box. */
.callout { margin: 32px 0; padding: 20px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.callout .label { margin: 0 0 10px; font-size: 11.2px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-soft); }
.callout p:last-child { margin-bottom: 0; }

/* Older / newer */
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--ink); }
.post-nav a { display: block; text-decoration: none; }
.post-nav .dir { display: block; margin-bottom: 6px; font-size: 12px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-soft); }
.post-nav .t { font-weight: 600; line-height: 1.4; }
.post-nav a:hover .t, .post-nav a:focus-visible .t { text-decoration: underline; }
.post-nav .newer { text-align: right; }
.back { margin: 22px 0 0; font-size: 13px; }
.back a { font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--ink); padding-bottom: 1px; }
.back a:hover, .back a:focus-visible { background: var(--sage); }

@media (max-width: 720px) {
  .post { padding: 28px 22px 34px; }
  .post h1 { font-size: 1.7rem; }
  .post-image .thumb { height: 220px; padding: 16px; }
  .post-nav { grid-template-columns: 1fr; gap: 18px; }
  .post-nav .newer { text-align: left; }
}

/* Pages with no picture, and real photographs (cover) as opposed to cut-outs (contain) */
.featured.no-image { grid-template-columns: 1fr; }
.thumb.cover { padding: 0; }
.thumb.cover img { object-fit: cover; }
/* Illustrations and photographs keep their own proportions on cards and post pages instead of being cropped to a strip */
.card .thumb.cover, .post-image .thumb.cover { height: auto; aspect-ratio: 3 / 2; }
.post .origin { margin: -14px 0 26px; font-size: 13.5px; font-style: italic; color: var(--ink-soft); }
.post .origin a { text-underline-offset: 3px; }
.prose figure { margin: 28px 0; }
.prose figure img { max-width: 100%; height: auto; }
.prose figcaption { margin-top: 8px; font-size: 12px; font-style: italic; color: var(--ink-soft); }
