:root {
  --bg: #f4fbff;
  --ink: #2f5a6b;
  --muted: #5e8b9a;
  --line: #cfe3ea;
  --accent: #8fc3d8;
  --tint: #eaf6fb;
  --on-dark: #d8eaf3;
  --field: #3e6b7a;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
}

h1, h2, h3, p { margin: 0; font-weight: 400; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; }

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Phone layout follows the 440px Figma frame; wider layouts are at the end. */
.page {
  position: relative;
  max-width: 440px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  border: 1px solid var(--accent);
  display: flex;
  flex-direction: column;
}

/* Corner ornaments */
.motif {
  display: block;
  position: relative;
  flex: none;
  width: 72px;
  height: 96px;
  border-radius: 16px;
  color: var(--ink);
  font-size: 10px;
  line-height: 14px;
  text-align: center;
  zoom: 0.6; /* keeps the sticky bar compact on phones */
}
.motif img { position: absolute; left: 3.9px; top: 2.2px; }
.motif span { position: absolute; width: 14px; height: 14px; }
.motif__n { left: 29px; top: 7px; }
.motif__e { left: 55px; top: 41px; }
.motif__s { left: 29px; top: 75px; }
.motif__w { left: 3px; top: 41px; }

/* Header */
.header {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 12px 24px 36px;
  border-bottom: 1px solid var(--line);
}

.nav,
.nav__left,
.nav__right { display: flex; align-items: center; }
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  gap: 8px;
  padding: 8px 11px;
  background: var(--bg);
  border-bottom: 1px solid transparent;
}
/* Hairline appears once the bar has left its resting place (where supported). */
@supports (animation-timeline: scroll()) {
  .nav { animation: nav-stuck linear both; animation-timeline: scroll(); animation-range: 0px 24px; }
  @keyframes nav-stuck { to { border-bottom-color: var(--line); } }
}
.nav__left { gap: 14px; font-size: 13px; line-height: 16px; white-space: nowrap; }
.nav__right { gap: 10px; margin-left: auto; }
.nav__link { font-weight: 500; }
.nav__link--current { font-weight: 600; }

.pill-button {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 15px;
  white-space: nowrap;
}

.emblem { height: 108px; overflow: hidden; }
.emblem__art { position: relative; width: 392px; height: 108px; left: 50%; margin-left: -196px; }
.emblem__art > * { position: absolute; }
.emblem__ball { left: 160px; top: 6px; }
.emblem__moon-a { left: 187px; top: 26px; }
.emblem__moon-b { left: 193px; top: 22px; }
.emblem__base { left: 174px; top: 79px; width: 44px; height: 7px; border-radius: 3px; background: var(--accent); }
.emblem__foot { left: 165px; top: 89px; width: 62px; height: 4px; background: var(--accent); }
.emblem__star--1 { left: 147px; top: 27px; }
.emblem__star--2 { left: 239px; top: 55px; }
.emblem__star--3 { left: 245px; top: 16px; }

.hero { display: flex; flex-direction: column; gap: 12px; text-align: center; }
.hero__title { font-family: var(--serif); font-size: 38px; line-height: 1.12; color: var(--ink); }
.hero__sub { line-height: 1.5; }

/* Content */
.content { display: flex; flex-direction: column; gap: 24px; padding: 24px; }

.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--bg);
}
.card--featured { gap: 16px; }

.meta { display: flex; align-items: center; justify-content: space-between; font-size: 12px; line-height: 15px; }
.tag { padding: 6px 10px; border-radius: 999px; background: var(--tint); font-weight: 600; }

.card__title { font-family: var(--serif); font-size: 20px; line-height: 1.12; color: var(--ink); }
.card--featured .card__title { font-size: 28px; }
.card__excerpt { font-size: 15px; }
.card--featured .card__excerpt { font-size: 16px; }

.author { display: flex; flex-direction: column; gap: 2px; }
.author__name { font-size: 14px; font-weight: 600; line-height: 17px; }
.author__date { font-size: 12px; line-height: 15px; }

.section-heading { display: flex; align-items: center; justify-content: space-between; }
.section-heading h2 { font-size: 18px; font-weight: 600; line-height: 22px; color: var(--ink); }
.section-heading a { font-size: 13px; font-weight: 500; line-height: 16px; }

.post-list { display: flex; flex-direction: column; gap: 16px; }

.newsletter {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  border-radius: 2px;
  background: var(--ink);
}
.newsletter__title { font-family: var(--serif); font-size: 22px; line-height: 1.12; color: var(--bg); }
.newsletter__copy { font-size: 14px; color: var(--on-dark); }
.newsletter__form { display: flex; gap: 12px; }
.newsletter__form input,
.newsletter__form button {
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  line-height: 17px;
}
.newsletter__form input {
  flex: 1 0 0;
  min-width: 0;
  padding: 12px 14px;
  background: var(--field);
  color: #fff;
}
.newsletter__form input::placeholder { color: var(--on-dark); opacity: 1; }
.newsletter__form button {
  padding: 12px 16px;
  background: var(--bg);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
}
.newsletter :focus-visible { outline-color: var(--bg); }

/* Footer */
.footer {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: auto;
  padding: 24px;
  border-top: 1px solid var(--line);
}
.footer__note { font-size: 14px; }
.footer__links { display: flex; align-items: center; justify-content: space-between; font-size: 13px; line-height: 16px; }

/* Small phones */
@media (max-width: 380px) {
  .nav { gap: 6px; padding: 8px; }
  .nav__right { gap: 8px; }
  .motif { zoom: 0.5; }
  .pill-button { padding: 8px 10px; }
  .hero__title { font-size: 32px; }
  .newsletter__form { flex-direction: column; }
}

/* Tablet and up: the framed page widens and floats inside a margin. */
@media (min-width: 720px) {
  body { padding: 24px; }
  .page { max-width: 1120px; min-height: calc(100vh - 48px); }

  .nav { gap: 20px; padding: 11px; }
  .motif { zoom: 1; }
  .header { gap: 28px; padding: 20px 48px 56px; }
  .nav__left { gap: 28px; font-size: 14px; }
  .pill-button { padding: 10px 16px; font-size: 13px; }
  .hero { gap: 16px; max-width: 760px; margin: 0 auto; }
  .hero__title { font-size: 52px; }
  .hero__sub { font-size: 18px; }

  .content { gap: 32px; padding: 48px; }
  .card { padding: 24px; }
  .card--featured { padding: 32px; }
  .card--featured .card__title { font-size: 36px; }
  .card--featured .card__excerpt { max-width: 640px; font-size: 17px; }
  .card__title { font-size: 22px; }
  .section-heading h2 { font-size: 20px; }

  .post-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
  .post-list .card:last-child:nth-child(odd) { grid-column: 1 / -1; }

  .newsletter { padding: 32px; }
  .newsletter__title { font-size: 28px; }
  .newsletter__copy { max-width: 520px; font-size: 15px; }
  .newsletter__form { max-width: 520px; }

  .footer { flex-direction: row; align-items: center; justify-content: space-between; padding: 32px 48px; }
}

/* Desktop: three posts side by side, newsletter copy beside its form. */
@media (min-width: 1000px) {
  .header { padding: 20px 64px 64px; }
  .hero__title { font-size: 60px; }
  .content { padding: 56px 64px; }

  .post-list { grid-template-columns: repeat(3, 1fr); }
  .post-list .card:last-child:nth-child(odd) { grid-column: auto; }

  .newsletter {
    display: grid;
    grid-template-columns: 1fr minmax(360px, 440px);
    column-gap: 48px;
    align-items: center;
    padding: 40px;
  }
  .newsletter__title,
  .newsletter__copy { grid-column: 1; }
  .newsletter__form { grid-column: 2; grid-row: 1 / span 2; max-width: none; }

  .footer { padding: 32px 64px; }
}

/* Keep in-page link targets clear of the sticky bar. */
[id] { scroll-margin-top: 128px; }

/* Inner pages: archive, about, posts */
.page-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px 24px 36px;
  border-bottom: 1px solid var(--line);
  text-align: center;
}
.page-header__title { font-family: var(--serif); font-size: 38px; line-height: 1.12; color: var(--ink); }
.page-header__sub a { text-decoration: underline; }
[aria-current="page"] { text-decoration: underline; text-underline-offset: 4px; }

.article { display: flex; flex-direction: column; gap: 16px; width: 100%; max-width: 680px; margin: 0 auto; padding-top: 12px; }
.article__title { font-family: var(--serif); font-size: 38px; line-height: 1.12; color: var(--ink); }
.article__dek { font-size: 17px; }
.article__back { margin-top: 16px; font-size: 13px; font-weight: 500; }

.prose { width: 100%; max-width: 680px; margin: 0 auto; color: var(--ink); font-size: 17px; line-height: 1.75; }
.article .prose { padding-top: 16px; border-top: 1px solid var(--line); }
.prose > * + * { margin-top: 1.1em; }
.prose h2, .prose h3 { font-family: var(--serif); font-weight: 400; line-height: 1.2; margin-top: 1.6em; }
.prose h2 { font-size: 28px; }
.prose h3 { font-size: 22px; }
.prose a { text-decoration: underline; }
.prose blockquote { margin: 1.4em 0; padding-left: 16px; border-left: 2px solid var(--accent); color: var(--muted); font-style: italic; }
.prose img { max-width: 100%; height: auto; border-radius: 2px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose--poem { font-family: var(--serif); font-size: 21px; line-height: 1.6; }

@media (min-width: 720px) {
  .page-header { padding: 40px 48px 56px; }
  .page-header__title, .article__title { font-size: 52px; }
  .prose { font-size: 18px; }
  .prose--poem { font-size: 23px; }
}

/* Search */
.search { display: flex; gap: 12px; width: 100%; max-width: 560px; margin: 4px auto 0; }
.search input,
.search button { border-radius: 10px; font: inherit; font-size: 15px; line-height: 20px; }
.search input { flex: 1 0 0; min-width: 0; padding: 11px 14px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.search input::placeholder { color: var(--muted); opacity: 1; }
.search button { padding: 11px 16px; border: 0; background: var(--ink); color: #fff; font-weight: 600; cursor: pointer; }
.search__status { font-size: 15px; }
.search__status a { text-decoration: underline; }
