:root {
  --paper: #f3eee4;
  --paper-2: #ebe4d6;
  --ink: #1b1814;
  --ink-soft: #4a433a;
  --line: #d5ccbc;
  --terracotta: #9f4324;
  --terracotta-deep: #7a3018;
  --sea: #1d4a56;
  --moss: #3c4c38;
  --sand: #c4a574;
  --white: #fffcf7;
  --max: 1120px;
  --nav-h: 72px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  font-size: 18px;
  line-height: 1.7;
  overflow-x: hidden;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--terracotta-deep); }
a:hover { color: var(--sea); }
h1, h2, h3, .brand-name, .kicker {
  font-family: Fraunces, Georgia, serif;
  font-optical-sizing: auto;
  letter-spacing: -0.02em;
}
h1 { font-size: clamp(2.1rem, 4vw, 3.4rem); line-height: 1.12; margin: 0 0 0.4em; font-weight: 600; }
h2 { font-size: 1.55rem; line-height: 1.25; margin: 1.6em 0 0.45em; font-weight: 600; }
h3 { font-size: 1.2rem; margin: 1.2em 0 0.35em; }

.skip {
  position: absolute;
  left: -999px;
  top: 0;
}
.skip:focus {
  left: 12px;
  top: 12px;
  background: var(--ink);
  color: var(--white);
  padding: 8px 12px;
  z-index: 50;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(243, 238, 228, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner, .wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 22px;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--nav-h);
  gap: 18px;
}
.brand {
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand-name { font-size: 1.15rem; font-weight: 620; }
.brand-tag { font-size: 0.72rem; color: var(--ink-soft); letter-spacing: 0.08em; text-transform: uppercase; font-family: "Source Sans 3", sans-serif; }

.nav-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--white);
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
}
.nav {
  display: flex;
  align-items: center;
  gap: 18px;
}
.nav a {
  text-decoration: none;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
}
.nav a[aria-current="page"] { color: var(--terracotta); }

.lang {
  display: flex;
  gap: 6px;
  margin-left: 8px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}
.lang a {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--ink-soft);
  padding: 2px 5px;
}
.lang a[aria-current="true"] {
  color: var(--white);
  background: var(--ink);
}

.hero {
  padding: 48px 0 28px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(180deg, #e7efe8 0%, transparent 42%),
    radial-gradient(circle at 88% 10%, #d7e4e8 0%, transparent 36%);
}
.kicker {
  color: var(--terracotta);
  font-size: 0.95rem;
  margin: 0 0 10px;
}
.lead {
  font-size: 1.22rem;
  max-width: 42rem;
  color: var(--ink-soft);
  margin: 0 0 22px;
}
.hero-art {
  margin-top: 28px;
  height: 220px;
  background:
    linear-gradient(180deg, #7ea8b0 0%, #1d4a56 38%, #3c4c38 39%, #3c4c38 62%, #9f4324 63%, #c4a574 100%);
  clip-path: polygon(0 48%, 8% 40%, 16% 52%, 28% 22%, 40% 44%, 52% 16%, 64% 38%, 76% 10%, 88% 36%, 100% 24%, 100% 100%, 0 100%);
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 28px 0 8px;
}
.card {
  background: var(--white);
  border: 1px solid var(--line);
  padding: 18px 18px 16px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 44px;
}
.card:hover { border-color: var(--sea); }
.card h3 { margin: 0 0 8px; }
.card p { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }
.card .meta { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--terracotta); margin-bottom: 8px; font-weight: 700; }

.section { padding: 42px 0; }
.section + .section { border-top: 1px solid var(--line); }

.crumbs {
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin: 22px 0 18px;
}
.crumbs a { color: var(--ink-soft); }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 32px;
  padding: 8px 0 56px;
}
article.post {
  max-width: 720px;
}
article.post p {
  max-width: 40rem;
}
article.post h2:first-of-type {
  margin-top: 0.4em;
}
.hub-index {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
  margin: 1.2em 0 1.6em;
  padding: 0;
  list-style: none;
}
.hub-index a {
  display: flex;
  align-items: center;
  padding: 10px 0;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
article p { margin: 0 0 1.05em; }
article ul { padding-left: 1.15em; }
article li { margin: 0.35em 0; }
article h2 {
  font-size: clamp(1.2rem, 4vw, 1.5rem);
  scroll-margin-top: 84px;
}
.nav a, .lang a, .site-footer a, button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.nav a { display: flex; }
.cluster {
  max-height: min(70vh, 640px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.hub-index {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  margin: 1.2em 0 1.6em;
  padding: 0;
  list-style: none;
}
.hub-index a {
  display: block;
  padding: 10px 0;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.toc, .related, .cluster {
  background: var(--white);
  border: 1px solid var(--line);
  padding: 16px;
  margin-bottom: 16px;
}
.toc h2, .related h2, .cluster h2 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 10px;
  font-family: "Source Sans 3", sans-serif;
}
.toc a, .related a, .cluster a {
  display: flex;
  align-items: center;
  text-decoration: none;
  margin: 0;
  padding: 8px 0;
  min-height: 44px;
  color: var(--sea);
  font-size: 0.95rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--ink);
  color: #efe8dc;
  padding: 36px 0 24px;
  font-size: 0.95rem;
}
.site-footer a { color: #f0d2c4; text-decoration: none; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 22px;
}
.site-footer h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--sand);
  margin: 0 0 10px;
  font-family: "Source Sans 3", sans-serif;
}
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin: 0.28em 0; }
.legal { margin-top: 28px; color: #b7aea0; font-size: 0.82rem; }

.updated { color: var(--ink-soft); font-size: 0.88rem; margin-bottom: 18px; }

@media (max-width: 900px) {
  body { font-size: 17px; }
  .header-inner, .wrap { padding-left: 16px; padding-right: 16px; }
  .grid-cards, .footer-grid, .layout, .hub-index { grid-template-columns: 1fr; }
  .hero { padding: 28px 0 18px; }
  .hero-art { height: 140px; }
  h1 { font-size: 1.85rem; }
  .nav-toggle { display: block; min-height: 44px; }
  .nav {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 22px 18px;
    gap: 12px;
  }
  .nav.is-open { display: flex; }
  .lang { border: 0; margin: 8px 0 0; padding: 0; }
  .lang a { min-width: 44px; justify-content: center; }
}

@media (max-width: 600px) {
  body { font-size: 16px; line-height: 1.65; }
  h1 { font-size: 1.55rem; }
  .header-inner { min-height: 56px; }
  .nav a, .lang a, .toc a, .related a, .cluster a, .hub-index a {
    width: 100%;
    min-height: 44px;
  }
  article.post, article.post p {
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: normal;
  }
  .card h3, .card .meta, h1, h2, h3 {
    overflow-wrap: normal;
    word-break: keep-all;
    hyphens: none;
  }
  .hero-art { height: 110px; }
  .cluster { max-height: 50vh; }
}

iframe, video, table { max-width: 100%; }
table { display: block; overflow-x: auto; }
