/* Temi La Donna Che Legge - editorial reading blog
   Warm paper + bordeaux, Fraunces + Newsreader. Mobile-first. */

:root {
  /* Color (OKLCH, warm-tinted neutrals, no pure black/white) */
  --bg: oklch(0.972 0.008 75);
  --bg-deep: oklch(0.955 0.01 70);
  --surface: oklch(0.99 0.006 85);
  --ink: oklch(0.27 0.02 40);
  --ink-soft: oklch(0.4 0.022 38);
  --muted: oklch(0.53 0.022 40);
  --accent: oklch(0.47 0.084 16);
  --accent-deep: oklch(0.39 0.09 16);
  --accent-soft: oklch(0.93 0.025 18);
  --accent-tint: oklch(0.96 0.013 24);
  --border: oklch(0.89 0.012 55);
  --border-strong: oklch(0.82 0.016 50);
  --focus: oklch(0.44 0.1 16);

  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px oklch(0.3 0.02 40 / 0.06);
  --shadow: 0 6px 24px oklch(0.3 0.03 40 / 0.09);
  --shadow-lg: 0 18px 50px oklch(0.28 0.03 40 / 0.18);

  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.25rem;
  --space-6: 3.5rem;
  --space-7: 5rem;

  --measure: 64ch;
  --content-max: 1180px;
  --header-max: 1180px;

  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --font-body: 'Newsreader', 'Iowan Old Style', Georgia, 'Times New Roman', serif;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out-soft: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-optical-sizing: auto;
  font-size: 1.06rem;
  line-height: 1.72;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'liga' 1, 'kern' 1;
}

a { color: inherit; text-underline-offset: 0.22em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); }

img { max-width: 100%; display: block; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 560;
  line-height: 1.12;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin: 0 0 var(--space-2);
  text-wrap: balance;
}

h1 { font-size: clamp(2.1rem, 6.4vw, 3.4rem); font-weight: 580; }
h2 { font-size: clamp(1.5rem, 3.6vw, 2.05rem); }
h3 { font-size: clamp(1.18rem, 2.4vw, 1.42rem); }

p, ul, ol, figure, blockquote { margin: 0 0 var(--space-3); }

::selection { background: var(--accent-soft); color: var(--accent-deep); }

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

.skip-link {
  position: absolute;
  top: -999px; left: -999px;
  background: var(--ink);
  color: var(--surface);
  padding: 0.6rem 0.85rem;
  border-radius: 6px;
  z-index: 200;
}
.skip-link:focus { top: 0.7rem; left: 0.7rem; }

/* Reading progress */
.reading-progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  z-index: 150;
  background: transparent;
  pointer-events: none;
}
.reading-progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-deep));
  transform-origin: left center;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: oklch(0.972 0.008 75 / 0.82);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: var(--header-max);
  margin: 0 auto;
  padding: 0.85rem var(--space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.branding { text-decoration: none; color: var(--ink); display: inline-flex; flex-direction: column; line-height: 1.05; }
.site-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.22rem;
  letter-spacing: -0.01em;
}
.site-subtitle {
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 0.12rem;
}

.main-nav ul {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
}
.main-nav a {
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  font-size: 0.98rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--ink-soft);
  transition: background-color 0.2s var(--ease-out), color 0.2s var(--ease-out);
}
.main-nav a:hover { background: var(--accent-tint); color: var(--accent); }
.main-nav a[aria-current='page'] { background: var(--accent-soft); color: var(--accent-deep); }

.nav-toggle {
  display: none;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 0.5rem 0.95rem;
  min-height: 44px;
  align-items: center;
  gap: 0.4rem;
}

/* Layout shells */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--space-3); }
.reading-flow { padding-top: var(--space-5); padding-bottom: var(--space-7); }

.page-shell { display: grid; grid-template-columns: 1fr; gap: var(--space-5); }
.page-main { min-width: 0; }
.page-side { min-width: 0; }

/* Buttons */
.button {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  font: inherit;
  cursor: pointer;
  padding: 0.62rem 1.15rem;
  min-height: 46px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out), background-color 0.25s var(--ease-out);
}
.button:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); color: var(--ink); }
.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: oklch(0.98 0.01 80);
}
.button.primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: oklch(0.98 0.01 80); box-shadow: var(--shadow); }
.button .arrow { transition: transform 0.3s var(--ease-out); }
.button:hover .arrow { transform: translateX(3px); }

/* Kicker / meta */
.kicker {
  display: inline-block;
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 var(--space-2);
}
.post-meta {
  font-size: 0.9rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.post-meta .dot { margin: 0 0.45rem; opacity: 0.6; }

/* Hero */
.hero { margin-bottom: var(--space-6); max-width: 38ch; }
.hero h1 { margin-bottom: var(--space-3); }
.hero p { font-size: 1.18rem; color: var(--ink-soft); max-width: 52ch; }
.hero-actions { margin-top: var(--space-4); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-4);
}
.section-head h2 { margin: 0; font-size: clamp(1.3rem, 3vw, 1.7rem); }
.section-head .see-all { font-size: 0.92rem; color: var(--muted); text-decoration: none; white-space: nowrap; }
.section-head .see-all:hover { color: var(--accent); }

/* Featured lead entry */
.lead {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}
.lead .media {
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--bg-deep);
  aspect-ratio: 4 / 5;
  box-shadow: var(--shadow);
}
.lead .media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.7s var(--ease-out-soft); }
.lead a:hover .media img { transform: scale(1.035); }
.lead .body { align-self: center; }
.lead h2 { font-size: clamp(1.7rem, 5vw, 2.5rem); margin: 0.4rem 0 var(--space-2); }
.lead a { text-decoration: none; color: inherit; }
.lead a:hover h2 { color: var(--accent); }
.lead .excerpt { color: var(--ink-soft); font-size: 1.1rem; max-width: 48ch; }

/* Entry list (cards with thumbnail) */
.entry-list { display: grid; gap: var(--space-4); }
.entry {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: var(--space-3);
  align-items: start;
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}
.entry:last-child { border-bottom: 0; padding-bottom: 0; }
.entry a.entry-link { text-decoration: none; color: inherit; display: contents; }
.entry .thumb {
  overflow: hidden;
  border-radius: var(--radius);
  aspect-ratio: 3 / 4;
  background: var(--bg-deep);
  box-shadow: var(--shadow-sm);
}
.entry .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease-out-soft); }
.entry:hover .thumb img { transform: scale(1.06); }
.entry h3 { margin: 0.1rem 0 0.35rem; transition: color 0.2s var(--ease-out); font-weight: 520; }
.entry:hover h3 { color: var(--accent); }
.entry .excerpt { color: var(--ink-soft); font-size: 0.99rem; margin: 0; }
.entry .kicker { font-size: 0.72rem; margin-bottom: 0.3rem; }

/* Newsletter card */
.newsletter-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--surface), var(--accent-tint));
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}
.newsletter-card h2 { font-size: 1.35rem; }
.newsletter-card p { color: var(--ink-soft); font-size: 0.98rem; }
.newsletter-form { display: grid; gap: var(--space-2); margin-top: var(--space-2); }
label { font-weight: 600; font-size: 0.92rem; }
input {
  width: 100%;
  padding: 0.7rem 0.8rem;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  min-height: 46px;
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}
input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.success {
  margin: 0;
  padding: 0.6rem 0.7rem;
  border: 1px solid oklch(0.8 0.06 150);
  background: oklch(0.95 0.03 150);
  color: oklch(0.4 0.08 155);
  border-radius: 8px;
  font-size: 0.92rem;
  display: none;
}
.success[aria-hidden='false'] { display: block; animation: fade-up 0.4s var(--ease-out) both; }

/* Article reading */
.article-content { max-width: var(--measure); margin: 0 auto; }
.article-content .kicker { margin-bottom: var(--space-3); }
.article-content h1 { margin-bottom: var(--space-2); }
.article-content > .post-meta { margin-bottom: var(--space-4); }

.article-cover {
  margin: var(--space-4) 0 var(--space-5);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-deep);
  box-shadow: var(--shadow);
}
.article-cover img { width: 100%; height: auto; }
figure { margin: var(--space-5) 0; }
figcaption {
  font-size: 0.88rem;
  color: var(--muted);
  font-style: italic;
  text-align: center;
  margin-top: var(--space-2);
}

.article-body { font-size: 1.16rem; line-height: 1.8; }
.article-body p { margin: 0 0 var(--space-4); }
.article-body p.lede { font-size: 1.24rem; color: var(--ink); }
.article-body p.lede::first-letter {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 3.6em;
  line-height: 0.78;
  float: left;
  margin: 0.06em 0.1em 0 0;
  color: var(--accent);
}
.article-body h2 { margin: var(--space-5) 0 var(--space-2); }
.article-body .stanza {
  text-align: center;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 1.12rem;
  line-height: 1.5;
  margin: var(--space-4) auto;
}

blockquote {
  margin: var(--space-5) 0;
  padding: 0 var(--space-2);
  text-align: center;
  position: relative;
}
blockquote p {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 420;
  font-size: clamp(1.4rem, 3.6vw, 1.85rem);
  line-height: 1.32;
  color: var(--accent-deep);
  margin: 0;
}
blockquote::before {
  content: '\201C';
  display: block;
  font-family: var(--font-display);
  font-size: 3.2rem;
  line-height: 0.4;
  color: var(--accent);
  opacity: 0.5;
  margin-bottom: 0.35rem;
}

.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: var(--space-5); }
.tag {
  font-size: 0.82rem;
  color: var(--accent-deep);
  background: var(--accent-soft);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  text-decoration: none;
}
.tag:hover { background: var(--accent); color: oklch(0.98 0.01 80); }

.article-divider {
  border: 0;
  height: 1px;
  background: var(--border);
  margin: var(--space-6) 0 var(--space-5);
}
.byline {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.95rem;
  font-style: italic;
}

/* Gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
  margin: var(--space-5) 0;
}
.gallery .g-item {
  padding: 0;
  border: 0;
  cursor: zoom-in;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--bg-deep);
  aspect-ratio: 3 / 4;
  box-shadow: var(--shadow-sm);
}
.gallery .g-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.55s var(--ease-out-soft); }
.gallery .g-item:hover img { transform: scale(1.07); }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  background: oklch(0.2 0.02 40 / 0.92);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  padding: clamp(0.75rem, 4vw, 2.5rem);
}
.lightbox.open { display: flex; animation: fade 0.25s var(--ease-out) both; }
.lightbox figure { margin: 0; max-width: min(92vw, 900px); }
.lightbox img {
  max-width: 100%;
  max-height: 82vh;
  width: auto;
  margin: 0 auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.lightbox figcaption { color: oklch(0.92 0.01 80); }
.lb-btn {
  position: absolute;
  background: oklch(0.99 0.01 80 / 0.12);
  color: oklch(0.98 0.01 80);
  border: 1px solid oklch(0.99 0.01 80 / 0.25);
  border-radius: 999px;
  width: 48px; height: 48px;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}
.lb-btn:hover { background: oklch(0.99 0.01 80 / 0.25); transform: scale(1.06); }
.lb-close { top: clamp(0.75rem, 3vw, 1.5rem); right: clamp(0.75rem, 3vw, 1.5rem); }
.lb-prev { left: clamp(0.5rem, 2vw, 1.5rem); top: 50%; transform: translateY(-50%); }
.lb-next { right: clamp(0.5rem, 2vw, 1.5rem); top: 50%; transform: translateY(-50%); }
.lb-prev:hover, .lb-next:hover { transform: translateY(-50%) scale(1.06); }

/* Related */
.related { margin-top: var(--space-6); padding-top: var(--space-5); border-top: 1px solid var(--border); }
.related h2 { font-size: 1.3rem; margin-bottom: var(--space-3); }

/* Back to top */
.to-top {
  position: fixed;
  right: clamp(1rem, 4vw, 2rem);
  bottom: clamp(1rem, 4vw, 2rem);
  z-index: 90;
  width: 48px; height: 48px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out), visibility 0.3s;
}
.to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { color: var(--accent); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: var(--space-5) 0 var(--space-6); background: var(--bg-deep); margin-top: var(--space-6); }
.footer-inner { display: flex; flex-direction: column; gap: var(--space-3); }
.footer-brand .site-title { font-size: 1.1rem; }
.footer-brand p { color: var(--muted); font-size: 0.92rem; font-style: italic; margin: 0.3rem 0 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.footer-links a { text-decoration: none; color: var(--ink-soft); font-size: 0.95rem; }
.footer-links a:hover { color: var(--accent); }
.footer-fine { color: var(--muted); font-size: 0.82rem; margin: 0; }

/* 404 */
.not-found { min-height: 62vh; display: grid; place-content: center; gap: var(--space-2); max-width: 46ch; }

/* Scroll reveal (gated on .js so content is always visible without JS) */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
  will-change: opacity, transform;
}
.js [data-reveal].in { opacity: 1; transform: none; }

@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Responsive ---------- */
@media (min-width: 720px) {
  .lead { grid-template-columns: 1fr 1fr; gap: var(--space-5); align-items: center; }
  .lead .media { aspect-ratio: 4 / 5; }
  .entry { grid-template-columns: 132px 1fr; gap: var(--space-4); }
  .gallery { grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }
}

@media (min-width: 1024px) {
  html { font-size: 18px; }
  .container { padding: 0 var(--space-4); }
  .reading-flow { padding-top: var(--space-6); }
  .page-shell { grid-template-columns: minmax(0, 1fr) 320px; gap: var(--space-6); align-items: start; }
  .page-shell.single { grid-template-columns: 1fr; }
  .page-side { position: sticky; top: 5.5rem; }
  .entry-list.two-col { grid-template-columns: 1fr 1fr; gap: var(--space-5); }
}

/* Mobile nav */
@media (max-width: 719px) {
  .header-inner { flex-wrap: wrap; }
  .nav-toggle { display: inline-flex; }
  .main-nav {
    display: none;
    width: 100%;
    margin-top: 0.4rem;
    animation: fade-up 0.3s var(--ease-out) both;
  }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; align-items: stretch; gap: 0.1rem; }
  .main-nav a { width: 100%; padding: 0.7rem 0.85rem; }
  .article-body { font-size: 1.1rem; }
}

@media (max-width: 420px) {
  .entry { grid-template-columns: 78px 1fr; gap: var(--space-2); }
  .gallery { gap: 0.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .js [data-reveal] { opacity: 1; transform: none; }
  .lead .media img, .entry .thumb img, .gallery .g-item img { transition: none; }
}
