/* articles.hamzawi.dev — the same tokens and voice as hamzawi.dev's landing page. */
:root {
  color-scheme: dark;
  --bg: #0a0c0b;
  --panel: #101512;
  --ink: #e8e6e0;
  --muted: #a0aaa4;
  --accent: #7ef0b2;
  --accent-soft: rgba(126, 240, 178, 0.12);
  --rule: rgba(232, 230, 224, 0.18);
  --rule-soft: rgba(232, 230, 224, 0.09);
  --serif: "Instrument Serif", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --text: "Newsreader", Charter, Georgia, serif; /* lesson prose; mono stays for labels and code */
  --gutter: clamp(22px, 4.8vw, 80px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { scroll-padding-top: 24px; scrollbar-gutter: stable; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--mono); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button, input { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
[hidden] { display: none !important; }
.accent { color: var(--accent); }
.dot { color: var(--accent); font-style: normal; }
.shell { width: min(100% - var(--gutter) * 2, 1240px); margin-inline: auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: fixed; top: 12px; left: var(--gutter); z-index: 30; padding: 14px 20px; background: var(--accent); color: var(--bg); transform: translateY(-160%); }
.skip-link:focus { transform: none; color: var(--bg); }
.grain {
  position: fixed;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  opacity: 0.028;
  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='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

.masthead { min-height: 86px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--rule); }
.brand { font-size: 12px; font-weight: 500; letter-spacing: 0.27em; padding-block: 14px; }
.brand-sub { color: var(--accent); }
.masthead-link { font-size: 11px; padding-block: 14px; color: #c2c9c4; }

.eyebrow { display: flex; align-items: center; gap: 18px; margin: 0 0 22px; color: var(--accent); font-size: 10px; letter-spacing: 0.2em; }
.eyebrow::after { content: ""; width: 36px; height: 1px; background: var(--accent); opacity: 0.55; }
.section-heading { display: flex; align-items: center; gap: 16px; margin: 0 0 26px; font-size: 10px; line-height: 1.5; font-weight: 400; letter-spacing: 0.22em; text-transform: uppercase; }
.section-heading::after { content: ""; height: 1px; flex: 1; background: var(--rule); }
.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border: 1px solid var(--rule); border-radius: 2px; color: #c2c9c4; font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap; }
.text-link { border-bottom: 1px solid rgba(126, 240, 178, 0.65); color: var(--accent); }

/* Archive */
.intro { padding-block: clamp(48px, 7vw, 96px) clamp(40px, 5vw, 64px); }
.intro-title { margin: 0; font: 400 clamp(64px, 9.5vw, 148px)/0.86 var(--serif); letter-spacing: -0.045em; }
.intro-title em { display: block; margin-top: 6px; }
.intro-text { max-width: 560px; margin: 28px 0 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
.intro-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 26px 0 0; color: #c2c9c4; font-size: 11px; }
.intro-meta span + span::before { content: "·"; margin-right: 22px; color: var(--accent); }

.today { padding-bottom: 56px; }
.feature {
  position: relative;
  display: grid;
  gap: 16px;
  padding: clamp(26px, 3.4vw, 46px);
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--rule);
  transition: border-color 0.35s, transform 0.45s var(--ease);
}
.feature::before { content: ""; position: absolute; top: -1px; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--accent)); transform: scaleX(0.25); transform-origin: right; transition: transform 0.7s var(--ease); }
.feature::after { content: ""; position: absolute; inset: auto -20% -60% 40%; height: 120%; background: radial-gradient(ellipse at center, rgba(126, 240, 178, 0.09), transparent 65%); opacity: 0; transition: opacity 0.6s; pointer-events: none; }
.feature:hover { color: inherit; border-color: rgba(126, 240, 178, 0.45); transform: translateY(-2px); }
.feature:hover::before { transform: scaleX(1); }
.feature:hover::after { opacity: 1; }
.feature-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; color: var(--muted); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; }
.feature-title { max-width: 18ch; font: 400 clamp(40px, 5.4vw, 80px)/0.95 var(--serif); letter-spacing: -0.035em; }
.feature-dek { max-width: 40ch; color: var(--accent); font: italic 400 clamp(22px, 2.4vw, 32px)/1.2 var(--serif); }
.feature-summary { max-width: 70ch; color: var(--muted); font-size: 13px; line-height: 1.8; }
.feature-cta { display: inline-flex; align-items: center; gap: 12px; justify-self: start; margin-top: 6px; padding-bottom: 6px; border-bottom: 1px solid rgba(126, 240, 178, 0.65); color: var(--accent); font-size: 12px; }
.feature-cta span { transition: transform 0.3s var(--ease); }
.feature:hover .feature-cta span { transform: translate(3px, -3px); }

.archive { padding-bottom: 72px; }
.filters { display: grid; gap: 18px; margin-bottom: 18px; }
.search input {
  width: 100%;
  min-height: 50px;
  padding: 0 18px;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 2px;
  font-size: 13px;
  transition: border-color 0.2s;
}
.search input::placeholder { color: #6f7a73; }
.search input:focus { outline: none; border-color: var(--accent); }
.topics { display: flex; flex-wrap: wrap; gap: 8px; }
.topic { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 14px; background: transparent; border: 1px solid var(--rule); border-radius: 2px; font-size: 11px; cursor: pointer; transition: border-color 0.2s, color 0.2s, background 0.2s; }
.topic span { color: var(--muted); font-size: 10px; }
.topic:hover { border-color: rgba(126, 240, 178, 0.6); color: var(--accent); }
.topic[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.topic[aria-pressed="true"] span { color: rgba(10, 12, 11, 0.65); }
.result-count { margin: 0; color: var(--muted); font-size: 10px; letter-spacing: 0.08em; }
.month { margin-top: 30px; }
.month-label { margin: 0 0 6px; color: var(--accent); font-size: 10px; font-weight: 400; letter-spacing: 0.2em; text-transform: uppercase; }
.rows { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.row { border-bottom: 1px solid var(--rule-soft); }
.row-link {
  position: relative;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto 20px;
  align-items: center;
  gap: 24px;
  padding: 20px 6px 20px 0;
  transition: padding 0.35s var(--ease), background 0.35s;
}
.row-link::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 2px; background: var(--accent); transform: scaleY(0); transition: transform 0.35s var(--ease); }
.row-link:hover, .row-link:focus-visible { padding-left: 18px; background: linear-gradient(90deg, var(--accent-soft), transparent 70%); color: inherit; }
.row-link:hover::before, .row-link:focus-visible::before { transform: scaleY(1); }
.row-date { color: var(--muted); font-size: 10px; letter-spacing: 0.06em; }
.row-main { display: grid; gap: 6px; min-width: 0; }
.row-title { font: 400 clamp(23px, 2.2vw, 30px)/1.1 var(--serif); letter-spacing: -0.015em; transition: color 0.25s; }
.row-dek { overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.6; text-overflow: ellipsis; white-space: nowrap; }
.row-arrow { color: var(--accent); opacity: 0; transform: translate(-6px, 6px); transition: opacity 0.25s, transform 0.35s var(--ease); }
.row-link:hover .row-title { color: var(--accent); }
.row-link:hover .row-arrow, .row-link:focus-visible .row-arrow { opacity: 1; transform: none; }
.empty { padding: 40px 0; color: var(--muted); font-size: 12px; }

/* Lesson */
.lesson { padding-bottom: 72px; }
.crumbs { padding-block: 26px 0; font-size: 11px; }
.crumbs a { color: #c2c9c4; }
.lesson-article { width: min(100%, 640px); margin-inline: auto; }
.lesson-head { padding-block: clamp(40px, 6vw, 80px) 36px; border-bottom: 1px solid var(--rule); }
.lesson-meta { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0 0 22px; color: var(--accent); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; }
.lesson-title { margin: 0; font: 400 clamp(46px, 7vw, 92px)/0.92 var(--serif); letter-spacing: -0.04em; text-wrap: balance; }
.lesson-dek { margin: 20px 0 0; color: #c2c9c4; font: italic 400 clamp(22px, 2.6vw, 30px)/1.25 var(--serif); }
.lesson-domain { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 26px 0 0; color: var(--muted); font-size: 10px; }

.lesson-body { padding-top: 12px; font: 400 20px/1.65 var(--text); font-optical-sizing: auto; }
.lesson-body p { margin: 0 0 18px; }
.lesson-body strong { color: #fff; font-weight: 600; }
.lesson-body em { font-style: italic; color: #d8dcd6; }
.lesson-body a { color: var(--accent); border-bottom: 1px solid rgba(126, 240, 178, 0.45); overflow-wrap: anywhere; }
.lesson-body code { padding: 1px 6px; background: rgba(232, 230, 224, 0.07); border-radius: 2px; font-family: var(--mono); font-size: 0.78em; overflow-wrap: anywhere; }
.lesson-body pre {
  margin: 4px 0 20px;
  padding: 18px 20px;
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-left: 2px solid var(--accent);
  font: 13px/1.7 var(--mono);
  tab-size: 2;
}
.lesson-body pre code { padding: 0; background: none; font-size: inherit; overflow-wrap: normal; }
/* Code keeps the old 760px width on wide screens, so the narrower prose column doesn't make it scroll. */
@media (min-width: 900px) { .lesson-body > pre, .part:not([data-tone]) > pre { margin-inline: -60px; } }
.lesson-body ul, .lesson-body ol { margin: 0 0 18px; padding: 0; list-style: none; }
.lesson-body li { position: relative; margin-bottom: 10px; padding-left: 28px; }
.lesson-body ul > li::before { content: ""; position: absolute; left: 6px; top: 0.82em; width: 8px; height: 1px; background: var(--accent); }
.lesson-body ol { counter-reset: item calc(var(--start, 1) - 1); }
.lesson-body ol > li { counter-increment: item; }
.lesson-body ol > li::before { content: counter(item, decimal-leading-zero); position: absolute; left: 0; top: 0.2em; color: var(--accent); font: 10px/1.6 var(--mono); }

.part { position: relative; margin-top: 34px; }
.part h2 { display: flex; align-items: baseline; gap: 12px; margin: 0 0 14px; font: 400 clamp(26px, 2.8vw, 34px)/1.15 var(--serif); letter-spacing: -0.015em; }
.part-mark { flex: none; font-size: 0.62em; transform: translateY(-0.08em); }
.part[data-tone] { padding: 24px 26px 10px; background: var(--panel); border: 1px solid var(--rule); }
.part[data-tone]::before { content: ""; position: absolute; top: -1px; left: 0; right: 0; height: 1px; }
.part[data-tone="myth"] { border-style: dashed; }
.part[data-tone="myth"] h2 { color: #c9b3ad; }
.part[data-tone="myth"] p { color: #b9bfba; }
.part[data-tone="truth"]::before { background: linear-gradient(90deg, var(--accent), transparent); }
.part[data-tone="truth"] h2 { color: var(--accent); }
.part[data-tone="trap"]::before { background: linear-gradient(90deg, #f0c27e, transparent); }
.part[data-tone="exercise"] { background: linear-gradient(135deg, rgba(126, 240, 178, 0.08), var(--panel) 55%); border-color: rgba(126, 240, 178, 0.35); }
.part[data-tone="exercise"]::before { background: var(--accent); }
.part[data-tone] + .part[data-tone] { margin-top: 18px; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: min(100%, 640px); margin: 56px auto 0; }
.pager-link { display: grid; gap: 8px; min-height: 110px; padding: 20px 22px; border: 1px solid var(--rule); transition: border-color 0.25s, background 0.25s; }
.pager-link:last-child { text-align: right; }
.pager-link:not(.is-empty):hover { border-color: rgba(126, 240, 178, 0.55); background: var(--accent-soft); color: inherit; }
.pager-link.is-empty { border-color: transparent; }
.pager-label { color: var(--accent); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; }
.pager-title { font: 400 22px/1.15 var(--serif); }

.not-found { min-height: 50vh; }

.colophon { padding-block: 28px 26px; border-top: 1px solid var(--rule); }
.colophon p { max-width: 560px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.8; }
.colophon-meta { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 22px; color: var(--muted); font-size: 9px; }
.colophon-meta span { margin-right: auto; }

@media (max-width: 760px) {
  .masthead { min-height: 72px; }
  .brand { font-size: 10px; letter-spacing: 0.18em; }
  .brand-sub { display: block; margin-top: 4px; }
  .row-link { grid-template-columns: minmax(0, 1fr) 16px; gap: 6px 14px; padding-block: 18px; }
  .row-date { grid-column: 1; grid-row: 1; }
  .row-main { grid-column: 1; grid-row: 2; }
  .row-link .chip { grid-column: 1; grid-row: 3; justify-self: start; }
  .row-arrow { grid-column: 2; grid-row: 2; opacity: 1; transform: none; }
  .row-dek { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .lesson-body { font-size: 17.5px; }
  .lesson-body pre { margin-inline: calc(var(--gutter) * -1); border-inline: 0; border-left: 2px solid var(--accent); font-size: 12px; }
  .part[data-tone] { padding: 20px 18px 8px; }
  .pager { grid-template-columns: 1fr; }
  .pager-link:last-child { text-align: left; }
  .pager-link.is-empty { display: none; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  .intro, .lesson-head { animation: arrive 0.85s ease-out both; }
  @keyframes arrive { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Archive rows outside the 200px observer margin skip rendering (see archive.js). */
.archive.is-lazy .row:not(.is-near) { content-visibility: hidden; contain-intrinsic-size: auto 98px; }
@media (max-width: 760px) { .archive.is-lazy .row:not(.is-near) { contain-intrinsic-size: auto 159px; } }

/* Page background (see cipher.js). Dimmed behind the reading column. */
.cipher {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(50% - 520px), rgba(0, 0, 0, 0.3) calc(50% - 400px), rgba(0, 0, 0, 0.3) calc(50% + 400px), #000 calc(50% + 520px));
  mask-image: linear-gradient(90deg, #000 calc(50% - 520px), rgba(0, 0, 0, 0.3) calc(50% - 400px), rgba(0, 0, 0, 0.3) calc(50% + 400px), #000 calc(50% + 520px));
}
