:root {
  --paper: #f6f1e7;
  --paper-2: #efe7d8;
  --ink: #1b1814;
  --muted: #6e6559;
  --line: #d8cdbb;
  --accent: #b34b2c;
  --sage: #7d8a6a;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --max: 1160px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: .025;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

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

a { color: inherit; }

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

img { max-width: 100%; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 18px;
  z-index: 100;
}
.skip:focus { left: 16px; top: 16px; }

/* ---------- masthead ---------- */

.masthead {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 30px 32px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  font-family: var(--serif);
  font-size: 1.85rem;
  font-weight: 500;
  letter-spacing: -.035em;
  line-height: 1;
  text-decoration: none;
}
.wordmark .dot { color: var(--accent); }

.nav { display: flex; gap: 28px; }

.nav a {
  font: 500 .69rem/1 var(--sans);
  letter-spacing: .15em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  padding: 8px 0;
  border-bottom: 1px solid transparent;
  transition: color .2s ease, border-color .2s ease;
}
.nav a:hover,
.nav a[aria-current="page"] { color: var(--ink); border-color: var(--accent); }

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

main {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 32px;
}

#app > * { animation: rise .5s cubic-bezier(.2, .7, .2, 1) both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
  font: 600 .67rem/1 var(--sans);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
}
.kicker::before { content: ""; width: 26px; height: 1px; background: currentColor; }

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  font: 500 .68rem/1.4 var(--sans);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
}
.meta .tag { color: var(--accent); }

/* ---------- hero ---------- */

.hero {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 64px;
  align-items: center;
  padding: 72px 0 64px;
  border-bottom: 1px solid var(--line);
}

.hero h1 {
  margin: 0 0 22px;
  font-family: var(--serif);
  font-size: clamp(2.8rem, 5.2vw, 4.6rem);
  font-weight: 500;
  line-height: .98;
  letter-spacing: -.04em;
}
.hero h1 a { text-decoration: none; transition: color .2s ease; }
.hero h1 a:hover { color: var(--accent); }

.hero-copy > p:not(.kicker) {
  max-width: 46ch;
  margin: 0 0 26px;
  font-size: 1.08rem;
  line-height: 1.65;
  color: var(--muted);
}

.hero-art {
  position: relative;
  display: block;
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--paper-2);
  box-shadow: 16px 16px 0 -1px var(--paper), 16px 16px 0 0 var(--line);
}
.hero-art img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }

/* ---------- post grid ---------- */

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 54px 0 26px;
}
.section-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -.02em;
}
.section-head span {
  font: 500 .66rem/1 var(--sans);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 42px 32px;
  padding-bottom: 88px;
}

.card { display: flex; flex-direction: column; }

.card-art {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper-2);
  aspect-ratio: 4 / 3;
}
.card-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .65s cubic-bezier(.2, .7, .2, 1);
}
.card:hover .card-art img { transform: scale(1.035); }

.card h3 {
  margin: 18px 0 10px;
  font-family: var(--serif);
  font-size: 1.42rem;
  font-weight: 500;
  line-height: 1.16;
  letter-spacing: -.02em;
}
.card h3 a { text-decoration: none; transition: color .2s ease; }
.card h3 a:hover { color: var(--accent); }

.card > p {
  margin: 0 0 16px;
  font-size: .94rem;
  line-height: 1.6;
  color: var(--muted);
}
.card .meta { margin-top: auto; font-size: .64rem; }

.cover-fallback {
  width: 100%;
  height: 100%;
  min-height: 100%;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(179, 75, 44, .18), transparent 55%),
    linear-gradient(135deg, var(--paper-2), #ddd0bc);
  color: var(--accent);
  font-family: var(--serif);
  font-size: 4rem;
  line-height: 1;
}

/* ---------- article ---------- */

.article {
  max-width: 760px;
  margin: 0 auto;
  padding: 64px 0 96px;
}

.back {
  display: inline-block;
  margin-bottom: 26px;
  font: 500 .68rem/1 var(--sans);
  letter-spacing: .13em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  transition: color .2s ease;
}
.back:hover { color: var(--accent); }

.article h1 {
  margin: 18px 0 20px;
  font-family: var(--serif);
  font-size: clamp(2.6rem, 6vw, 4.5rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -.04em;
}

.article .lede {
  margin: 0 0 26px;
  font-family: var(--serif);
  font-size: 1.28rem;
  line-height: 1.5;
  color: var(--muted);
}

.article-cover {
  margin: 40px 0 48px;
  border: 1px solid var(--line);
  background: var(--paper-2);
}
.article-cover img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }

.prose {
  font-size: 1.08rem;
  line-height: 1.78;
  color: #2a2620;
}
.prose > p:first-of-type::first-letter {
  float: left;
  padding: .09em .12em 0 0;
  font-family: var(--serif);
  font-size: 4.1rem;
  line-height: .78;
  color: var(--accent);
}
.prose p { margin: 0 0 1.4em; }
.prose h2 {
  margin: 2.1em 0 .65em;
  font-family: var(--serif);
  font-size: 1.72rem;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -.02em;
}
.prose h3 {
  margin: 1.8em 0 .5em;
  font-family: var(--serif);
  font-size: 1.32rem;
  font-weight: 500;
}
.prose blockquote {
  margin: 2em 0;
  padding: 0 0 0 26px;
  border-left: 2px solid var(--accent);
  font-family: var(--serif);
  font-size: 1.34rem;
  font-style: italic;
  line-height: 1.45;
  color: var(--ink);
}
.prose ul, .prose ol { margin: 0 0 1.4em; padding-left: 1.25em; }
.prose li { margin-bottom: .5em; }
.prose a { color: var(--accent); text-underline-offset: 3px; }
.prose code {
  padding: .15em .35em;
  background: var(--paper-2);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: .87em;
}
.prose pre {
  margin: 1.8em 0;
  padding: 20px 22px;
  overflow-x: auto;
  background: var(--ink);
  color: var(--paper);
  font-size: .9rem;
  line-height: 1.6;
}
.prose pre code { padding: 0; background: none; color: inherit; }
.prose hr { margin: 3em 0; border: 0; border-top: 1px solid var(--line); }
.prose img { margin: 1.8em 0; }

.article-end { margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); }
.article-end .back { margin: 0; }

/* ---------- about ---------- */

.about {
  max-width: 720px;
  padding: 76px 0 100px;
}
.about h1 {
  margin: 0 0 28px;
  font-family: var(--serif);
  font-size: clamp(2.5rem, 5vw, 3.9rem);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -.04em;
}
.about p { font-size: 1.1rem; line-height: 1.75; margin: 0 0 1.3em; }
.about blockquote {
  margin: 2.2em 0;
  padding-left: 26px;
  border-left: 2px solid var(--accent);
  font-family: var(--serif);
  font-size: 1.3rem;
  font-style: italic;
  line-height: 1.45;
}
.about cite { display: block; margin-top: 12px; font: 500 .7rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; font-style: normal; color: var(--muted); }

/* ---------- studio ---------- */

.studio { max-width: 860px; padding: 56px 0 96px; }

.studio-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.studio h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 2.6rem;
  font-weight: 500;
  letter-spacing: -.035em;
}
.studio .kicker { margin-bottom: 14px; }

.sub { color: var(--muted); font-size: .95rem; line-height: 1.6; }

.panel {
  padding: 28px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .3);
}

.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.field label {
  font: 600 .66rem/1 var(--sans);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

input, textarea, select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}
textarea { resize: vertical; line-height: 1.55; }
#excerpt { min-height: 84px; }
#content {
  min-height: 360px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: .88rem;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}

.check { display: flex; align-items: center; gap: 10px; font-size: .92rem; }
.check input { width: auto; accent-color: var(--accent); }

.btn {
  display: inline-block;
  padding: 13px 20px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--ink);
  color: var(--paper);
  font: 600 .69rem/1 var(--sans);
  letter-spacing: .13em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.btn:hover { background: var(--accent); border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: wait; }
.btn.secondary { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn.danger { background: transparent; color: var(--accent); border-color: currentColor; }
.btn.danger:hover { background: var(--accent); color: var(--paper); }

.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.error { margin: 14px 0 0; color: #a33a1f; font-size: .86rem; line-height: 1.5; }

.auth { max-width: 420px; margin: 0 auto; padding: 72px 0 96px; }
.auth h1 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 2.5rem;
  font-weight: 500;
  letter-spacing: -.035em;
}
.auth .sub { margin: 0 0 28px; }

.admin-list { display: flex; flex-direction: column; }
.admin-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.admin-item:first-child { border-top: 1px solid var(--line); }
.admin-item h3 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 1.18rem;
  font-weight: 500;
  letter-spacing: -.01em;
}
.admin-item h3 a { text-decoration: none; }
.admin-item h3 a:hover { color: var(--accent); }

.badge {
  padding: 4px 8px;
  border: 1px solid var(--line);
  font-size: .6rem;
  letter-spacing: .12em;
}
.badge.draft { color: var(--accent); border-color: currentColor; }

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

.footer {
  width: 100%;
  max-width: var(--max);
  margin: 24px auto 0;
  padding: 44px 32px 40px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
}
.footer-mark {
  font-family: var(--serif);
  font-size: 1.8rem;
  letter-spacing: -.035em;
  line-height: 1;
}
.footer-mark span { color: var(--accent); }
.footer p { margin: 0; color: var(--muted); font-size: .9rem; }
.footer .fine { font-size: .72rem; letter-spacing: .05em; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 20;
  transform: translateX(-50%);
  padding: 12px 18px;
  background: var(--ink);
  color: var(--paper);
  font: 500 .78rem/1 var(--sans);
  letter-spacing: .04em;
  box-shadow: 0 8px 30px rgba(27, 24, 20, .2);
}

/* ---------- responsive ---------- */

@media (max-width: 940px) {
  .hero { gap: 40px; }
  .post-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  .masthead { padding: 22px 20px 20px; }
  main { padding: 0 20px; }
  .hero { grid-template-columns: 1fr; gap: 34px; padding: 44px 0 48px; }
  .hero-art { order: -1; box-shadow: 10px 10px 0 -1px var(--paper), 10px 10px 0 0 var(--line); }
  .hero h1 { font-size: clamp(2.5rem, 11vw, 3.6rem); }
  .section-head { padding-top: 44px; }
  .post-grid { gap: 36px; padding-bottom: 64px; }
  .article { padding: 44px 0 72px; }
  .article h1 { font-size: clamp(2.3rem, 10vw, 3.4rem); }
  .about { padding: 52px 0 72px; }
  .studio { padding: 40px 0 72px; }
  .panel { padding: 20px; }
  .footer { padding: 36px 20px 32px; }
}

@media (max-width: 560px) {
  .post-grid { grid-template-columns: 1fr; }
  .nav { gap: 16px; }
  .wordmark { font-size: 1.6rem; }
  .nav a { font-size: .62rem; letter-spacing: .12em; }
  .admin-item { align-items: flex-start; }
  .prose { font-size: 1.03rem; }
}

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