:root {
  --paper: #fbe9d7;
  --paper-deep: #fffaf7;
  --ink: #382e35;
  --ink-soft: #756570;
  --line: rgba(56, 46, 53, 0.18);
  --accent: #fffaf7;
  --accent-ink: #840032;
  --cream: #fffaf7;
  --display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --mono: "DM Mono", "SFMono-Regular", Consolas, monospace;
  --content: 1180px;
}

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

html {
  min-width: 320px;
  min-height: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
  background: var(--paper);
  color: var(--ink);
}

body {
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 8% 5%, rgba(255, 250, 247, 0.82), transparent 28%),
    radial-gradient(circle at 92% 48%, rgba(255, 250, 247, 0.46), transparent 34%),
    var(--paper);
  color: var(--ink);
  font-family: var(--display);
  font-size: 18px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  z-index: 100;
  inset: 0;
  opacity: 0.16;
  pointer-events: none;
  content: "";
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.13'/%3E%3C/svg%3E");
}

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

button {
  color: inherit;
  font: inherit;
}

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

[hidden] {
  display: none !important;
}

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

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

.skip-link {
  position: fixed;
  z-index: 200;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--mono);
  font-size: 0.68rem;
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  z-index: 80;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 233, 215, 0.9);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.header-inner,
.writing-section,
.site-footer {
  width: min(calc(100% - 48px), var(--content));
  margin-inline: auto;
}

.header-inner {
  display: grid;
  min-height: 72px;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 28px;
}

.wordmark {
  width: fit-content;
  color: var(--accent-ink);
  font-size: 1.55rem;
  font-style: italic;
  letter-spacing: -0.045em;
  line-height: 1;
}

.primary-nav {
  display: flex;
  gap: clamp(18px, 3vw, 38px);
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.primary-nav a,
.language-link,
.language-single,
.language-toggle {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.primary-nav a,
.language-link {
  position: relative;
}

.primary-nav a::after,
.language-link::after {
  position: absolute;
  right: 0;
  bottom: 8px;
  left: 0;
  height: 1px;
  background: currentColor;
  content: "";
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 180ms ease;
}

.primary-nav a:hover::after,
.language-link:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.primary-nav a:hover,
.language-link:hover {
  color: var(--accent-ink);
}

.header-language {
  display: flex;
  justify-content: flex-end;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
}

.language-toggle {
  gap: 6px;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--ink-soft);
}

.language-toggle .is-active {
  color: var(--ink);
  font-weight: 500;
}

.hero {
  position: relative;
  display: grid;
  min-height: 600px;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: clamp(40px, 7vw, 96px);
  border-bottom: 1px solid var(--line);
  padding: clamp(80px, 10vw, 150px) max(24px, calc((100vw - var(--content)) / 2));
}

.hero.has-media {
  min-height: 650px;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
}

.hero-copy {
  max-width: 900px;
}

.hero-copy,
.hero-image,
.hero-note {
  animation: rise-in 780ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero-copy.has-flying-butterfly {
  animation: none;
  transform: none;
}

.hero-image {
  animation-delay: 120ms;
}

.hero-note {
  animation-delay: 240ms;
}

.section-label,
.post-meta,
.back-link,
.article-meta,
.site-footer,
.translation-notice,
.article-image figcaption {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.section-label {
  color: var(--accent-ink);
}

.hero h1 {
  max-width: 740px;
  margin-top: 22px;
  font-size: clamp(4.8rem, 8.5vw, 8.3rem);
  font-weight: 400;
  letter-spacing: -0.07em;
  line-height: 0.8;
}

.hero-title-row {
  display: grid;
  width: min(100%, 850px);
  grid-template-columns: minmax(0, 1fr) 96px;
  align-items: start;
  gap: clamp(14px, 2.5vw, 30px);
}

.hero-butterfly {
  display: block;
  width: 96px;
  margin-top: 32px;
  color: var(--accent-ink);
  pointer-events: none;
  filter: drop-shadow(0 7px 10px rgba(132, 0, 50, 0.12));
}

.hero-butterfly svg {
  display: block;
  width: 100%;
  overflow: visible;
}

.hero-butterfly.is-flying {
  position: fixed;
  z-index: 70;
  top: 0;
  left: 0;
  margin: 0;
  transform-origin: top left;
  will-change: transform;
}

.hero-butterfly.is-settling .butterfly-wing {
  animation-duration: 1.4s;
}

.butterfly-wing,
.butterfly-body {
  fill: currentColor;
}

.butterfly-wing {
  transform-box: fill-box;
}

.butterfly-wing-left {
  transform-origin: right center;
  animation: butterfly-flap-left 900ms ease-in-out infinite alternate;
}

.butterfly-wing-right {
  transform-origin: left center;
  animation: butterfly-flap-right 900ms ease-in-out infinite alternate;
}

.hero-copy > p:last-child {
  max-width: 560px;
  margin-top: 34px;
  color: var(--ink-soft);
  font-size: clamp(1.18rem, 2vw, 1.55rem);
  line-height: 1.35;
}

.hero-image {
  position: relative;
  min-height: 440px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--paper-deep);
  box-shadow: -18px 18px 0 var(--accent);
}

.hero-image img {
  width: 100%;
  height: 100%;
  min-height: 440px;
  object-fit: cover;
  filter: saturate(0.76) contrast(1.02);
}

.hero-note {
  position: absolute;
  right: clamp(24px, calc((100vw - var(--content)) / 2), 10vw);
  bottom: 48px;
  z-index: 2;
  width: min(240px, calc(100% - 48px));
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--accent-ink);
  font-size: 0.88rem;
  font-style: italic;
  line-height: 1.35;
}

.writing-section {
  padding-block: clamp(80px, 10vw, 140px);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 42px;
}

.section-heading h2,
.empty-state h2 {
  margin-top: 10px;
  font-size: clamp(2.7rem, 5vw, 4.8rem);
  font-weight: 400;
  letter-spacing: -0.055em;
  line-height: 0.95;
}

.category-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.category-filters button {
  min-height: 44px;
  padding: 0 15px;
  border: 1px solid rgba(56, 46, 53, 0.35);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.category-filters button:hover {
  transform: translateY(-2px);
}

.category-filters button.is-active {
  border-color: var(--accent-ink);
  background: var(--accent);
  color: var(--accent-ink);
}

.post-card {
  min-width: 0;
  background: var(--paper);
}

.posts-feed > .post-card {
  border-block: 1px solid var(--line);
}

.posts-feed > .post-card.has-media {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(310px, 0.92fr);
}

.posts-feed > .post-card:not(.has-media) .post-card-copy {
  max-width: 780px;
  padding-inline: 0;
}

.posts-feed > .post-card .post-card-image {
  min-height: 470px;
}

.post-card-image {
  overflow: hidden;
  background: var(--paper-deep);
}

.post-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.76) contrast(1.02);
  transition: transform 700ms cubic-bezier(0.22, 1, 0.36, 1), filter 300ms ease;
}

.post-card:hover .post-card-image img {
  transform: scale(1.025);
  filter: saturate(0.9) contrast(1.02);
}

.post-card-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 5vw, 70px);
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--ink-soft);
}

.post-meta span:first-child {
  color: var(--accent-ink);
}

.post-card h3 {
  margin-top: 22px;
  font-size: clamp(2.2rem, 4vw, 4rem);
  font-weight: 400;
  letter-spacing: -0.05em;
  line-height: 0.95;
}

.post-card h3 a {
  transition: color 160ms ease;
}

.post-card h3 a:hover {
  color: var(--accent-ink);
}

.post-card-copy > p {
  margin-top: 22px;
  color: var(--ink-soft);
  font-size: 1rem;
}

.read-link,
.next-link {
  display: flex;
  justify-content: space-between;
  margin-top: 34px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.read-link span:last-child,
.next-link span:last-child {
  transition: transform 160ms ease;
}

.read-link:hover span:last-child,
.next-link:hover span:last-child {
  transform: translate(3px, -3px);
}

.read-link:hover,
.next-link:hover {
  color: var(--accent-ink);
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: 42px;
  border: 1px solid var(--line);
  background: var(--line);
}

.post-grid .post-card {
  display: flex;
  min-height: 520px;
  flex-direction: column;
}

.post-grid .post-card-image {
  min-height: 230px;
}

.post-grid .post-card-copy {
  flex: 1;
  justify-content: flex-start;
  padding: 25px;
}

.post-grid .post-card h3 {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.post-grid .read-link {
  margin-top: auto;
}

.posts-feed > .post-card.is-filtered-out,
.post-grid .post-card.is-filtered-out {
  display: none;
}

.filter-empty,
.translation-notice {
  margin-top: 30px;
  color: var(--ink-soft);
}

.empty-state {
  width: min(calc(100% - 48px), var(--content));
  min-height: 52vh;
  margin-inline: auto;
  padding-block: clamp(90px, 12vw, 160px);
}

.empty-state h2 {
  max-width: 780px;
}

.empty-state > p:last-child {
  max-width: 520px;
  margin-top: 28px;
  color: var(--ink-soft);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  border-top: 1px solid var(--line);
  padding-block: 28px;
}

.reading-progress {
  position: fixed;
  z-index: 120;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  pointer-events: none;
}

.reading-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent-ink);
}

.article-shell {
  padding-top: clamp(64px, 9vw, 120px);
}

.article-header,
.article-body,
.author-signature {
  width: min(calc(100% - 48px), 780px);
  margin-inline: auto;
}

.back-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  color: var(--ink-soft);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 20px;
  margin-top: clamp(45px, 7vw, 80px);
  color: var(--ink-soft);
}

.article-meta span:first-child {
  color: var(--accent-ink);
}

.article-header h1 {
  margin-top: 25px;
  font-size: clamp(4rem, 9vw, 8.6rem);
  font-weight: 400;
  letter-spacing: -0.075em;
  line-height: 0.82;
  text-align: center;
}

.article-header > p {
  max-width: 650px;
  margin: 34px auto 0;
  color: var(--ink-soft);
  font-size: clamp(1.25rem, 2.2vw, 1.65rem);
  line-height: 1.4;
  text-align: center;
}

.article-cover {
  width: min(calc(100% - 48px), 1180px);
  max-height: 720px;
  margin: clamp(60px, 9vw, 110px) auto;
  overflow: hidden;
  background: var(--paper-deep);
}

.article-cover img {
  width: 100%;
  max-height: 720px;
  object-fit: cover;
  filter: saturate(0.78);
}

.article-body {
  font-size: clamp(1.23rem, 2vw, 1.42rem);
  line-height: 1.78;
}

.article-body > p:first-child::first-letter {
  float: left;
  margin: 0.14em 0.12em 0 0;
  color: var(--accent-ink);
  font-size: 4.2em;
  line-height: 0.64;
}

.article-body p + p,
.article-body p + ul,
.article-body p + ol,
.article-body ul + p,
.article-body ol + p {
  margin-top: 1.45em;
}

.article-body h2 {
  margin-top: 2.2em;
  font-size: clamp(2.4rem, 4vw, 3.8rem);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 1;
}

.article-body h3 {
  margin-top: 2em;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.article-body h2 + p,
.article-body h3 + p {
  margin-top: 0.8em;
}

.article-body ul,
.article-body ol {
  padding-left: 1.3em;
}

.article-body li + li {
  margin-top: 0.5em;
}

.article-body blockquote {
  width: 122%;
  margin: 2em -11%;
  padding: 1em 8%;
  border-block: 1px solid var(--line);
  color: var(--accent-ink);
  font-size: clamp(1.7rem, 3.2vw, 2.7rem);
  font-style: italic;
  line-height: 1.25;
  text-align: center;
}

.article-body a {
  border-bottom: 1px solid currentColor;
  color: var(--accent-ink);
}

.article-image {
  width: 122%;
  margin: 2.8em -11%;
}

.article-image img {
  width: 100%;
  height: auto;
}

.article-image figcaption {
  margin-top: 12px;
  color: var(--ink-soft);
}

.author-signature {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 22px;
  margin-top: clamp(70px, 10vw, 120px);
  padding-block: 32px;
  border-block: 1px solid var(--line);
}

.author-mark {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink);
  font-size: 1.35rem;
  font-style: italic;
}

.author-signature h2 {
  margin-top: 3px;
  font-size: 1.7rem;
  font-weight: 400;
}

.author-signature div > p:last-child {
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 0.94rem;
}

.next-post {
  margin-top: clamp(75px, 10vw, 130px);
  padding: clamp(70px, 9vw, 120px) max(24px, calc((100vw - 1000px) / 2));
  background: var(--accent);
  color: var(--ink);
}

.next-post h2 {
  max-width: 840px;
  margin-top: 20px;
  font-size: clamp(3.2rem, 7vw, 6.5rem);
  font-weight: 400;
  letter-spacing: -0.06em;
  line-height: 0.88;
}

.next-post .next-link {
  margin-top: 46px;
  border-color: var(--line);
}

.next-post.is-empty {
  background: var(--paper-deep);
  color: var(--ink);
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes butterfly-flap-left {
  50% { transform: scaleX(0.48) rotate(9deg); }
}

@keyframes butterfly-flap-right {
  50% { transform: scaleX(0.48) rotate(-9deg); }
}

@media (max-width: 900px) {
  .hero.has-media {
    grid-template-columns: 1fr;
  }

  .hero-image {
    width: min(82%, 520px);
    min-height: 390px;
    justify-self: end;
  }

  .hero-note {
    bottom: 78px;
    left: max(24px, calc((100vw - var(--content)) / 2));
    right: auto;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .category-filters {
    justify-content: flex-start;
  }

  .posts-feed > .post-card {
    grid-template-columns: 1fr;
  }

  .posts-feed > .post-card .post-card-image {
    min-height: 380px;
  }

  .post-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .header-inner {
    grid-template-columns: 1fr auto auto;
    gap: 12px;
  }

  .wordmark {
    font-size: 1.35rem;
  }

  .primary-nav {
    grid-row: auto;
    grid-column: auto;
    justify-content: flex-end;
    border-top: 0;
  }

  .header-language {
    grid-column: auto;
  }

  .hero {
    min-height: 0;
    padding-top: 68px;
    padding-bottom: 130px;
  }

  .hero h1 {
    font-size: clamp(4rem, 19vw, 6rem);
  }

  .hero-title-row {
    grid-template-columns: minmax(0, 1fr) 58px;
    gap: 10px;
  }

  .hero-butterfly {
    width: 58px;
    margin-top: 27px;
  }

  .hero-image {
    width: calc(100% - 28px);
    min-height: 320px;
  }

  .hero-image img {
    min-height: 320px;
  }

  .hero-note {
    bottom: 32px;
    width: 180px;
    padding: 10px 0 0;
    font-size: 0.8rem;
  }

  .post-grid {
    grid-template-columns: 1fr;
  }

  .post-grid .post-card {
    min-height: 0;
  }

  .post-card-copy {
    padding: 28px 22px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .article-meta {
    justify-content: flex-start;
  }

  .article-header h1,
  .article-header > p {
    text-align: left;
  }

  .article-body blockquote,
  .article-image {
    width: 100%;
    margin-inline: 0;
  }

  .author-signature {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .author-mark {
    width: 58px;
    height: 58px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-copy,
  .hero-image,
  .hero-note { animation: none; }
  .butterfly-wing { animation: none; }
  .hero-butterfly.is-flying {
    position: static;
    transform: none !important;
    will-change: auto;
  }
  .post-card-image img,
  .category-filters button { transition: none; }
  .reading-progress { display: none; }
}
