/* ============================================================
   Read — minimalist blog theme
   ============================================================ */

:root {
  --bg:        #fcfcfb;
  --bg-soft:   #f4f3f0;
  --fg:        #16161a;
  --fg-soft:   #3c3c42;
  --muted:     #7a7a82;
  --rule:      rgba(22, 22, 26, 0.10);
  --rule-soft: rgba(22, 22, 26, 0.06);
  --accent:    #b4553a;
  --selection: rgba(180, 85, 58, 0.16);

  --serif: "Lora", Georgia, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono:  ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --measure: 42rem;   /* reading column */
  --wide:    68rem;   /* header / footer */
  --step:    1.5rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #121213;
    --bg-soft:   #1b1b1d;
    --fg:        #e9e7e3;
    --fg-soft:   #cbc8c3;
    --muted:     #8b8983;
    --rule:      rgba(233, 231, 227, 0.14);
    --rule-soft: rgba(233, 231, 227, 0.08);
    --accent:    #e08663;
    --selection: rgba(224, 134, 99, 0.22);
  }
}

:root[data-theme="dark"] {
  --bg:        #121213;
  --bg-soft:   #1b1b1d;
  --fg:        #e9e7e3;
  --fg-soft:   #cbc8c3;
  --muted:     #8b8983;
  --rule:      rgba(233, 231, 227, 0.14);
  --rule-soft: rgba(233, 231, 227, 0.08);
  --accent:    #e08663;
  --selection: rgba(224, 134, 99, 0.22);
}

/* ---------- reset ---------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.75;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--selection); }

img, svg, video { max-width: 100%; height: auto; display: block; }

a { color: inherit; text-decoration: none; }

hr { border: 0; }

/* ---------- layout ---------- */

.wrap { width: 100%; max-width: var(--wide);    margin-inline: auto; padding-inline: 1.5rem; }
.col  { width: 100%; max-width: var(--measure); margin-inline: auto; padding-inline: 1.5rem; }

.skip {
  position: absolute; left: -9999px;
  background: var(--fg); color: var(--bg);
  padding: .75rem 1rem; z-index: 99;
}
.skip:focus { left: 1rem; top: 1rem; }

/* ---------- header ---------- */

.site-header {
  position: relative;
  padding: 3.25rem 0 2.25rem;
  text-align: center;
  border-bottom: 1px solid var(--rule-soft);
}

.brand {
  display: inline-block;
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.brand:hover { color: var(--accent); }

.tagline {
  margin: .6rem 0 0;
  font-family: var(--sans);
  font-size: .8125rem;
  letter-spacing: .06em;
  color: var(--muted);
}

.site-nav {
  margin-top: 1.75rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.75rem;
}

.site-nav a {
  font-family: var(--sans);
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: .25rem;
  border-bottom: 1px solid transparent;
  transition: color .2s ease, border-color .2s ease;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--fg); }

.theme-toggle {
  position: absolute;
  top: 2rem; right: 1.5rem;
  width: 2.25rem; height: 2.25rem;
  display: grid; place-items: center;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease, transform .2s ease;
}
.theme-toggle:hover { color: var(--fg); border-color: var(--fg); transform: rotate(15deg); }
.theme-toggle svg { width: 1rem; height: 1rem; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun  { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* ---------- reading progress ---------- */

.progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0;
  background: var(--accent);
  z-index: 50;
  transition: width .1s linear;
}

/* ---------- meta line ---------- */

.meta {
  font-family: var(--sans);
  font-size: .6875rem;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}
.meta a:hover { color: var(--accent); }
.meta .dot { margin: 0 .55rem; opacity: .5; }

/* ---------- post list ---------- */

.post-list { padding: 4.5rem 0 1rem; }

.post-card + .post-card {
  margin-top: 4.5rem;
  padding-top: 4.5rem;
  border-top: 1px solid var(--rule-soft);
}

.post-card .cover {
  display: block;
  margin-bottom: 2rem;
  overflow: hidden;
  border-radius: 2px;
}
.post-card .cover img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: transform .6s cubic-bezier(.2,.7,.3,1);
}
.post-card .cover:hover img { transform: scale(1.03); }

.post-card h2 {
  margin: .9rem 0 0;
  font-family: var(--serif);
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.1rem);
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.02em;
}
.post-card h2 a {
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size .35s ease, color .2s ease;
}
.post-card h2 a:hover { color: var(--accent); background-size: 100% 1px; }

.post-card .excerpt { margin: 1rem 0 0; color: var(--fg-soft); }

.more {
  display: inline-block;
  margin-top: 1.25rem;
  font-family: var(--sans);
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
}
.more .arrow { display: inline-block; transition: transform .25s ease; }
.more:hover .arrow { transform: translateX(.35rem); }

/* ---------- pagination ---------- */

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: 5rem 0 0;
  padding-top: 2rem;
  border-top: 1px solid var(--rule-soft);
  font-family: var(--sans);
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.pagination a:hover { color: var(--accent); }
.pagination .page-num { color: var(--muted); letter-spacing: .1em; }

/* ---------- single post ---------- */

.post-header { padding: 4.5rem 0 0; text-align: center; }
.post-header h1 {
  margin: 1.1rem 0 0;
  font-family: var(--serif);
  font-size: clamp(2rem, 1.3rem + 2.8vw, 3rem);
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: -0.025em;
}
.post-header .lede {
  margin: 1.25rem auto 0;
  max-width: 34rem;
  color: var(--muted);
  font-size: 1.125rem;
  font-style: italic;
}

.post-cover {
  margin: 3rem auto 0;
  max-width: var(--wide);
  padding-inline: 1.5rem;
}
.post-cover img {
  width: 100%;
  aspect-ratio: 21 / 9;
  object-fit: cover;
  border-radius: 2px;
}
.post-cover figcaption {
  margin-top: .75rem;
  text-align: center;
  font-family: var(--sans);
  font-size: .75rem;
  color: var(--muted);
}

/* ---------- prose ---------- */

.prose { padding: 3.25rem 0 0; }
/* Keep both rules at the same specificity so the sibling rule actually wins. */
.prose > * { margin-block: 0; }
.prose > * + * { margin-top: var(--step); }

.prose h2, .prose h3, .prose h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin-top: 3rem;
  margin-bottom: 0;
}
.prose h2 { font-size: 1.6rem; }
.prose h3 { font-size: 1.3rem; }
.prose h4 { font-size: 1.1rem; }

.prose a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: .2em;
  text-decoration-thickness: 1px;
  transition: color .2s ease;
}
.prose a:hover { color: var(--accent); }

.prose strong { font-weight: 600; }

.prose blockquote {
  margin: 2.5rem 0;
  padding-left: 1.5rem;
  border-left: 2px solid var(--accent);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--fg-soft);
}
.prose blockquote p + p { margin-top: 1rem; }

.prose ul, .prose ol { margin: 0; padding-left: 1.4rem; }
.prose li + li { margin-top: .5rem; }
.prose li::marker { color: var(--muted); }

.prose img { margin: 2.5rem auto; border-radius: 2px; }

.prose figure { margin: 2.5rem 0; }
.prose figure img { margin: 0; }
.prose figcaption {
  margin-top: .75rem;
  text-align: center;
  font-family: var(--sans);
  font-size: .8125rem;
  color: var(--muted);
}

.prose hr {
  margin: 3.5rem auto;
  border: 0;
  height: 1rem;
  max-width: 5rem;
  opacity: .55;
  background-image: radial-gradient(circle, var(--muted) 1.2px, transparent 1.3px);
  background-size: 1.25rem 1rem;
  background-repeat: repeat-x;
  background-position: center;
}

.prose code {
  font-family: var(--mono);
  font-size: .875em;
  background: var(--bg-soft);
  padding: .15em .4em;
  border-radius: 3px;
}
.prose pre {
  margin: 2rem 0;
  padding: 1.25rem 1.35rem;
  background: var(--bg-soft);
  border: 1px solid var(--rule-soft);
  border-radius: 4px;
  overflow-x: auto;
  font-size: .875rem;
  line-height: 1.65;
}
.prose pre code { background: none; padding: 0; font-size: inherit; }

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: .9375rem;
  margin: 2rem 0;
}
.prose th, .prose td {
  text-align: left;
  padding: .7rem .5rem;
  border-bottom: 1px solid var(--rule-soft);
}
.prose th {
  font-size: .75rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

/* ---------- post footer ---------- */

.tags { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 3.5rem; }
.tags a {
  font-family: var(--sans);
  font-size: .6875rem;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: .35rem .85rem;
  transition: color .2s, border-color .2s;
}
.tags a:hover { color: var(--accent); border-color: var(--accent); }

.author-box {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  margin-top: 3.5rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--rule-soft);
}
.author-box .avatar {
  flex: 0 0 auto;
  width: 3.25rem; height: 3.25rem;
  border-radius: 50%;
  background: var(--bg-soft);
  display: grid; place-items: center;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--muted);
}
.author-box .name { font-family: var(--sans); font-size: .9375rem; font-weight: 500; }
.author-box .bio { margin: .2rem 0 0; font-size: .9375rem; color: var(--muted); }

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 4rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--rule-soft);
}
.post-nav .label {
  font-family: var(--sans);
  font-size: .6875rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.post-nav .title {
  display: block;
  margin-top: .4rem;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.35;
}
.post-nav a:hover .title { color: var(--accent); }
.post-nav .next { text-align: right; }
.post-nav .empty { opacity: 0; pointer-events: none; }

/* ---------- archive ---------- */

.page-title { padding: 4.5rem 0 0; text-align: center; }
.page-title h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.9rem, 1.4rem + 2vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.page-title p { margin: .75rem 0 0; color: var(--muted); }

.archive { padding: 3.5rem 0 0; }
.archive-year {
  margin: 3rem 0 1.25rem;
  font-family: var(--sans);
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .18em;
  color: var(--muted);
}
.archive-item {
  display: flex;
  gap: 1.5rem;
  align-items: baseline;
  padding: .9rem 0;
  border-bottom: 1px solid var(--rule-soft);
}
.archive-item time {
  flex: 0 0 4.5rem;
  font-family: var(--sans);
  font-size: .75rem;
  letter-spacing: .08em;
  color: var(--muted);
}
.archive-item .title { font-size: 1.0625rem; line-height: 1.4; }
.archive-item:hover .title { color: var(--accent); }

/* ---------- footer ---------- */

.site-footer {
  margin-top: 7rem;
  padding: 3rem 0 4rem;
  border-top: 1px solid var(--rule-soft);
  text-align: center;
}
.footer-social {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.footer-social a {
  font-family: var(--sans);
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.footer-social a:hover { color: var(--accent); }
.copyright { font-family: var(--sans); font-size: .75rem; color: var(--muted); letter-spacing: .04em; }

/* ---------- holding page ---------- */

.site-header.bare { border-bottom: 0; padding-bottom: 0; }
.site-footer.bare { margin-top: 0; border-top: 0; }

.soon {
  min-height: 46vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 1.5rem 2rem;
}

.soon-word {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(3rem, 2rem + 6vw, 5.5rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--accent);
}

.soon-word::after {
  content: "";
  display: block;
  margin: 2rem auto 0;
  width: 5rem;
  height: 1rem;
  opacity: .5;
  background-image: radial-gradient(circle, var(--muted) 1.2px, transparent 1.3px);
  background-size: 1.25rem 1rem;
  background-repeat: repeat-x;
  background-position: center;
}

.soon-note {
  margin: 1.75rem 0 0;
  max-width: 28rem;
  color: var(--muted);
  font-size: 1.0625rem;
  font-style: italic;
}
.soon-note:empty { display: none; }

/* ---------- 404 ---------- */

.notfound { padding: 8rem 0; text-align: center; }
.notfound .big {
  font-family: var(--serif);
  font-size: 5rem;
  font-weight: 600;
  line-height: 1;
  color: var(--rule);
}
.notfound p { margin-top: 1rem; color: var(--muted); }

/* ---------- motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

/* ---------- small screens ---------- */

@media (max-width: 40rem) {
  body { font-size: 1rem; }
  .site-header { padding: 2.5rem 0 1.75rem; }
  .theme-toggle { top: 1.25rem; right: 1.25rem; }
  .brand { font-size: 1.6rem; }
  .site-nav { gap: 1.25rem; margin-top: 1.4rem; }
  .post-list { padding-top: 3rem; }
  .post-card + .post-card { margin-top: 3rem; padding-top: 3rem; }
  .post-nav { grid-template-columns: 1fr; gap: 1.5rem; }
  .post-nav .next { text-align: left; }
  .archive-item { flex-direction: column; gap: .25rem; }
  .site-footer { margin-top: 4.5rem; }
}

/* ---------- print ---------- */

@media print {
  .site-nav, .theme-toggle, .post-nav, .site-footer, .progress, .more { display: none; }
  body { background: #fff; color: #000; }
}
