@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,300..800;1,6..72,300..800&family=Inter:opsz,wght@14..32,400;14..32,500&display=swap');

/* ── Variables ──────────────────────────────────────────────────── */

:root {
  --bg:       #ffffff;
  --bg-alt:   #f6f6f6;
  --text:     #111111;
  --muted:    #888888;
  --accent:   #9b2226;
  --accent-h: #7b1a1d;
  --border:   #e6e6e6;
  --serif:    'Newsreader', Georgia, serif;
  --sans:     'Inter', system-ui, sans-serif;
  --w:        680px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:       #0f0f0f;
    --bg-alt:   #1c1c1c;
    --text:     #ededed;
    --muted:    #777777;
    --accent:   #c84b50;
    --accent-h: #d96065;
    --border:   #2a2a2a;
  }
}

[data-theme="dark"] {
  --bg:       #0f0f0f;
  --bg-alt:   #1c1c1c;
  --text:     #ededed;
  --muted:    #777777;
  --accent:   #c84b50;
  --accent-h: #d96065;
  --border:   #2a2a2a;
}

/* ── Reset ──────────────────────────────────────────────────────── */

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

html {
  font-size: 22px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  font-optical-sizing: auto;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-weight: 450;
  line-height: 1.85;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--accent); color: #fff; }

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}

/* ── Layout ─────────────────────────────────────────────────────── */

.container {
  width: 100%;
  max-width: var(--w);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.main { flex: 1; padding-block-end: 7rem; }

/* ── Links ──────────────────────────────────────────────────────── */

a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color .15s;
}

a:hover { color: var(--accent-h); }

/* ── Site header ────────────────────────────────────────────────── */

.site-header {
  border-block-end: 1px solid var(--border);
  margin-block-end: 4rem;
}

.site-header__inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .75rem;
  padding-block: 2rem;
}

.site-brand__name {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 600;
  font-optical-sizing: auto;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -.02em;
  line-height: 1.2;
  transition: color .15s;
}

.site-brand__name:hover { color: var(--accent); }

.site-brand__tagline {
  font-family: var(--sans);
  font-size: .65rem;
  color: var(--muted);
  margin-block-start: .2rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.site-nav { display: flex; gap: 1.75rem; flex-shrink: 0; }

.site-nav a {
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 400;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: .03em;
  transition: color .15s;
}

.site-nav a:hover { color: var(--text); }
.site-nav a.active { color: var(--text); }

.site-nav__sep {
  display: inline-block;
  width: 1px;
  height: .85em;
  background: var(--border);
  align-self: center;
  flex-shrink: 0;
}

.lang-switcher { display: flex; gap: .35rem; }
.lang-link { font-size: 1.1rem !important; letter-spacing: 0 !important; }

.nav-toggle { display: none; }

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  line-height: 0;
  transition: color .15s;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--text); }

.icon-sun { display: none; }
.icon-moon { display: block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* ── Post list ──────────────────────────────────────────────────── */

.post-list { list-style: none; }

.post-card {
  padding-block: 2.75rem;
  border-block-end: 1px solid var(--border);
}

.post-card:first-child { padding-block-start: 0; }
.post-card:last-child  { border-block-end: none; }

/* ── Post meta ──────────────────────────────────────────────────── */

.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  margin-block-end: .6rem;
}

.post-meta time {
  font-family: var(--sans);
  font-size: .7rem;
  color: var(--muted);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.reading-time {
  font-family: var(--sans);
  font-size: .68rem;
  color: var(--muted);
  opacity: .7;
}

.reading-time::before { content: '·'; margin-inline-end: .4em; }

.tags { display: flex; flex-wrap: wrap; gap: .3rem; }

.tag {
  display: inline-block;
  font-family: var(--sans);
  font-size: .62rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: .1em .55em;
  text-decoration: none;
  letter-spacing: .04em;
  text-transform: uppercase;
  transition: color .15s, border-color .15s;
}

.tag:hover { color: var(--accent); border-color: var(--accent); }

/* ── Post card content ──────────────────────────────────────────── */

.post-card__image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  margin-block-end: 1.25rem;
  text-decoration: none;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}

.post-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  opacity: 0;
  transition: opacity .4s ease;
}

.post-card__image img.is-loaded {
  opacity: 1;
}

.post-card__title {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  font-optical-sizing: auto;
  letter-spacing: -.03em;
  line-height: 1.2;
  margin-block-end: .5rem;
}

.post-card__title a {
  color: var(--text);
  text-decoration: none;
  transition: color .15s;
}

.post-card__title a:hover { color: var(--accent); }

.post-card__summary {
  font-size: .9rem;
  font-style: italic;
  color: var(--muted);
  line-height: 1.7;
  margin-block-end: .9rem;
  text-wrap: pretty;
}

.read-more {
  display: inline-flex;
  align-items: center;
  gap: .3em;
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 400;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: .03em;
  transition: color .2s, gap .2s;
}

.read-more:hover { color: var(--text); gap: .55em; }

/* ── Empty state ────────────────────────────────────────────────── */

.empty {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-style: italic;
  color: var(--muted);
  padding-block: 5rem;
  text-align: center;
}

/* ── Pagination ─────────────────────────────────────────────────── */

.pagination {
  display: flex;
  justify-content: center;
  gap: .4rem;
  list-style: none;
  margin-block-start: 3rem;
  font-family: var(--sans);
  font-size: .75rem;
}

.pagination .page-item a,
.pagination .page-item span {
  display: inline-block;
  padding: .4em .9em;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--muted);
  text-decoration: none;
  transition: all .15s;
}

.pagination .page-item a:hover { border-color: var(--text); color: var(--text); }
.pagination .page-item.active span { background: var(--text); border-color: var(--text); color: var(--bg); }

/* ── Single post ────────────────────────────────────────────────── */

.post-single__header {
  margin-block-end: 3rem;
  padding-block-end: 2.5rem;
  border-block-end: 1px solid var(--border);
}

.post-single__title {
  font-family: var(--serif);
  font-size: 2.6rem;
  font-weight: 700;
  font-optical-sizing: auto;
  letter-spacing: -.045em;
  line-height: 1.08;
  margin-block: .75rem .9rem;
  text-wrap: balance;
}

.post-single__description {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-style: italic;
  font-weight: 300;
  color: var(--muted);
  line-height: 1.65;
  font-optical-sizing: auto;
}

/* ── Post content typography ────────────────────────────────────── */

.post-content {
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.9;
  font-optical-sizing: auto;
}

.post-content > * + * { margin-block-start: 1.6rem; }

.post-content p { text-wrap: pretty; }

/* Drop cap – literary first letter */
.post-content > p:first-of-type::first-letter {
  float: left;
  font-size: 3.5em;
  font-weight: 700;
  line-height: .82;
  margin-inline-end: .06em;
  margin-block-start: .06em;
  color: var(--text);
}

.post-content h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  font-optical-sizing: auto;
  letter-spacing: -.025em;
  line-height: 1.25;
  margin-block-start: 3rem;
  margin-block-end: -.6rem;
}

.post-content h3 {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
  font-optical-sizing: auto;
  letter-spacing: -.015em;
  margin-block-start: 2.5rem;
  margin-block-end: -.75rem;
}

.post-content a { color: var(--accent); }

.post-content ul,
.post-content ol { padding-inline-start: 1.4rem; }

.post-content li + li { margin-block-start: .4rem; }

.post-content blockquote {
  border-inline-start: 2px solid var(--border);
  padding-inline-start: 1.5rem;
  padding-block: .25rem;
  color: var(--muted);
  font-style: italic;
}

.post-content blockquote p { margin-block-start: 0; }

/* HR rendered as classic literary separator */
.post-content hr {
  border: none;
  text-align: center;
  margin-block: 2.75rem;
  color: var(--muted);
  overflow: visible;
  height: 0;
}

.post-content hr::after {
  content: '* * *';
  font-family: var(--serif);
  font-size: .9rem;
  letter-spacing: .35em;
  font-style: italic;
}

.post-content code {
  font-family: ui-monospace, 'Fira Code', monospace;
  font-size: .875em;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: .1em .4em;
}

.post-content pre {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  tab-size: 2;
}

.post-content pre code {
  background: none; border: none; padding: 0;
  font-size: .875rem; line-height: 1.65;
}

.post-content img { max-width: 100%; height: auto; border-radius: 4px; display: block; }
.post-content figure { margin: 0; }

.post-content figcaption {
  font-family: var(--sans);
  font-size: .7rem;
  color: var(--muted);
  text-align: center;
  margin-block-start: .5rem;
  font-style: italic;
  letter-spacing: .02em;
}

.post-content table { width: 100%; border-collapse: collapse; font-size: .88rem; }

.post-content th,
.post-content td { padding: .5rem .75rem; border: 1px solid var(--border); text-align: left; }

.post-content th {
  background: var(--bg-alt);
  font-family: var(--sans);
  font-size: .68rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: .06em;
  text-transform: uppercase;
}


/* ── Post single footer ─────────────────────────────────────────── */

.post-single__footer {
  margin-block-start: 4rem;
  padding-block-start: 2rem;
  border-block-start: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.back-link {
  font-family: var(--sans);
  font-size: .75rem;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: .02em;
  transition: color .15s;
}

.back-link:hover { color: var(--text); }

/* ── List page ──────────────────────────────────────────────────── */

.list-header {
  margin-block-end: 2.5rem;
  padding-block-end: 2rem;
  border-block-end: 1px solid var(--border);
}

.list-header h1 {
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 600;
  font-optical-sizing: auto;
  letter-spacing: -.025em;
}

/* ── Site footer ────────────────────────────────────────────────── */

.site-footer {
  border-block-start: 1px solid var(--border);
  margin-block-start: auto;
}

.site-footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--sans);
  font-size: .7rem;
  color: var(--muted);
  padding-block: 1.75rem;
  letter-spacing: .03em;
}

.site-footer a { color: var(--muted); text-decoration: none; transition: color .15s; }
.site-footer a:hover { color: var(--text); }

/* ── Responsive ─────────────────────────────────────────────────── */

@media (max-width: 640px) {
  html { font-size: 20px; }

  .site-header { margin-block-end: 1rem; }
  .site-header__inner {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0;
    padding-block: .7rem;
  }
  .site-brand { flex: 1; min-width: 0; }
  .site-brand__name { font-size: .9rem; }

  .nav-toggle {
    display: flex;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    padding: 0;
    flex-shrink: 0;
    transition: color .15s;
  }
  .nav-toggle:hover { color: var(--text); }
  .nav-toggle .icon-close { display: none; }
  .nav-toggle[aria-expanded="true"] .icon-menu { display: none; }
  .nav-toggle[aria-expanded="true"] .icon-close { display: block; }

  .site-nav {
    display: none;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1.25rem;
    padding-block: .4rem .7rem;
  }
  .site-nav.is-open { display: flex; }

  .post-single__title { font-size: 2rem; }
  .post-content > p:first-of-type::first-letter { font-size: 3em; }
  .site-footer__inner { flex-direction: column; gap: .5rem; text-align: center; }
}

/* ── Shorts ─────────────────────────────────────────────────────── */

.list-description {
  font-size: .9rem;
  font-style: italic;
  color: var(--muted);
  margin-block-start: .4rem;
}

.shorts-feed {
  display: flex;
  flex-direction: column;
  gap: 3.5rem;
}

.short-video {
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-alt);
  margin-block-end: 1rem;
}

.short-video iframe,
.short-video video {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.short-title {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  font-optical-sizing: auto;
  letter-spacing: -.015em;
  line-height: 1.3;
  margin-block-end: .35rem;
}

.short-title a {
  color: var(--text);
  text-decoration: none;
  transition: color .15s;
}

.short-title a:hover { color: var(--accent); }

.short-desc {
  font-size: .875rem;
  font-style: italic;
  color: var(--muted);
  line-height: 1.65;
}

.short-single .short-video { margin-block-end: 1.5rem; }
.short-single .short-title { font-size: 1.55rem; margin-block-end: .6rem; }

.shorts-sentinel { height: 1px; }

.shorts-loader {
  text-align: center;
  font-family: var(--sans);
  font-size: .75rem;
  color: var(--muted);
  padding-block: 2.5rem;
}

/* ── Print ──────────────────────────────────────────────────────── */

.print-colophon {
  display: flex;
  gap: .5em;
  align-items: baseline;
  margin-block-start: 3.5rem;
  padding-block-start: 2.5rem;
  border-block-start: 1px solid var(--border);
}

.print-colophon__author {
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: .05em;
  text-transform: uppercase;
}

.print-colophon__url {
  font-family: var(--sans);
  font-size: .68rem;
  color: var(--muted);
  letter-spacing: .03em;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 2cm 2.5cm 2.5cm;

    @bottom-center {
      content: counter(page) " / " counter(pages);
      font-family: sans-serif;
      font-size: 9pt;
      color: #777;
    }
  }

  @page :left  { margin-left: 3cm; }
  @page :right { margin-left: 2cm; }

  :root {
    --bg:     white;
    --text:   black;
    --muted:  #555;
    --accent: #9b2226;
  }

  html { font-size: 13pt; }

  body { line-height: 1.75; }

  .site-header,
  .site-footer,
  .post-single__footer { display: none; }

  .container { max-width: 100%; padding: 0; }

  .post-single__header { margin-block-end: 2rem; }

  .post-single__title { font-size: 22pt; }

  .post-meta { font-size: 9pt; color: #555; }

  .post-content a { color: inherit; text-decoration: underline; }
  .post-content a::after { content: none; }

  h2, h3 { break-after: avoid; page-break-after: avoid; }
  p       { orphans: 3; widows: 3; }

  .print-colophon {
    flex-direction: column;
    align-items: center;
    gap: .4rem;
    margin-block-start: 6rem;
    padding-block-start: 2rem;
    border-top: 1px solid #bbb;
    border-block-start: none;
    font-family: var(--sans);
    text-align: center;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-colophon__author {
    font-size: 9.5pt;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #333;
  }

  .print-colophon__url {
    font-size: 8.5pt;
    color: #666;
    letter-spacing: .04em;
  }
}
