/* ============================================================
   AHMED FADL — "The Operator's Ledger"
   paper #f5f1e8 · ink #17150f · signal red #b5301b
   Instrument Serif / Newsreader / Archivo / IBM Plex Mono
   ============================================================ */

:root {
  --paper: #f5f1e8;
  --paper-2: #ede8db;
  --paper-3: #e5dfcf;
  --ink: #17150f;
  --ink-soft: #55503f;
  --ink-faint: #8a8270;
  --red: #b5301b;
  --red-soft: rgba(181, 48, 27, 0.08);
  --line: rgba(23, 21, 15, 0.22);
  --line-soft: rgba(23, 21, 15, 0.11);
  --serif: "Instrument Serif", Georgia, serif;
  --body: "Newsreader", Georgia, serif;
  --label: "Archivo", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --maxw: 1140px;
  --pad: clamp(20px, 4vw, 52px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

.mono { font-family: var(--mono); }
.ar { direction: rtl; unicode-bidi: isolate; }

a { color: inherit; }

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

/* ---------- paper grain ---------- */
.grain {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 240 240' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E");
}

/* ---------- masthead ---------- */
.masthead {
  position: sticky; top: 0; z-index: 100;
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
}
.mast-top {
  max-width: var(--maxw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: baseline;
  padding: 16px var(--pad) 12px;
  border-bottom: 1px solid var(--line);
}
.mast-date { font-size: 11.5px; color: var(--ink-soft); letter-spacing: 0.06em; }
.mast-est { font-size: 11.5px; color: var(--ink-soft); letter-spacing: 0.14em; text-align: right; }
.mark {
  font-family: var(--serif); font-size: clamp(24px, 3vw, 30px);
  letter-spacing: 0.01em; text-decoration: none; white-space: nowrap;
  padding: 0 18px;
}
.mark::after { content: "."; color: var(--red); }

.mast-nav {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex; justify-content: center; gap: clamp(14px, 2.6vw, 30px);
  padding: 9px var(--pad);
}
.mast-nav a {
  font-size: 11.5px; letter-spacing: 0.08em; text-transform: lowercase;
  color: var(--ink-soft); text-decoration: none;
  transition: color 0.18s;
}
.mast-nav a:hover { color: var(--red); }

/* ---------- hero ---------- */
.hero {
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(64px, 9vw, 120px) var(--pad) clamp(48px, 6vw, 80px);
}
.hero-inner { max-width: 900px; }

.eyebrow {
  font-size: 12px; color: var(--ink-soft);
  letter-spacing: 0.16em; text-transform: uppercase;
  margin-bottom: 30px;
}
.eyebrow::before { content: "— "; color: var(--red); }

.hero-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(52px, 10.5vw, 128px);
  line-height: 0.99;
  letter-spacing: -0.015em;
  margin-bottom: 40px;
}
.red-ink { font-style: italic; color: var(--red); position: relative; }
.hero-dot { color: var(--red); }

/* pillars */
.pillars {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--line);
  margin-bottom: 34px;
}
.pillars li {
  padding: 18px 18px 20px 0;
  border-right: 1px solid var(--line-soft);
  display: grid;
  gap: 4px;
}
.pillars li + li { padding-left: 18px; }
.pillars li:last-child { border-right: none; }
.pill-no { font-size: 11px; color: var(--red); letter-spacing: 0.1em; }
.pillars b {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(19px, 2.4vw, 25px);
}
.pillars span:not(.pill-no) { font-size: 13.5px; color: var(--ink-soft); font-style: italic; }

.hero-sign {
  font-size: clamp(17px, 2vw, 21px);
  color: var(--ink-soft);
  max-width: 44ch;
  margin-bottom: 26px;
}
.hero-sign em { color: var(--ink); }

/* dispatch (current entry) */
.dispatch {
  display: flex; align-items: center; gap: 14px;
  border-left: 3px solid var(--red);
  background: var(--red-soft);
  padding: 12px 16px;
  width: fit-content; max-width: 100%;
  margin-bottom: 36px;
}
.dispatch-label {
  font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--red); white-space: nowrap;
}
.dispatch-text { font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; }
.caret {
  display: inline-block; width: 8px; height: 15px;
  background: var(--red); margin-left: 2px; vertical-align: -2px;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* buttons */
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.btn {
  font-family: var(--label); font-weight: 600;
  font-size: 13px; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 15px 28px;
  text-decoration: none;
  border: 1px solid var(--ink);
  transition: all 0.2s ease;
  cursor: pointer;
}
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover { background: var(--red); border-color: var(--red); transform: translateY(-2px); }
.btn-rule { background: transparent; color: var(--ink); }
.btn-rule:hover { border-color: var(--red); color: var(--red); transform: translateY(-2px); }
.arr { display: inline-block; transition: transform 0.2s; }
.btn:hover .arr { transform: translateY(2px); }

/* stamp */
.stamp {
  position: absolute;
  right: clamp(8px, 6vw, 90px);
  top: clamp(70px, 11vw, 150px);
  border: 2.5px solid var(--red);
  outline: 1px solid var(--red);
  outline-offset: 3px;
  color: var(--red);
  padding: 12px 16px;
  font-family: var(--label); font-weight: 700;
  text-transform: uppercase;
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
  letter-spacing: 0.08em;
  transform: rotate(7deg);
  opacity: 0.85;
  pointer-events: none;
}

/* ---------- wire ---------- */
.wire {
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  background: var(--paper-2);
  overflow: hidden;
  padding: 11px 0;
}
.wire-track {
  display: flex; align-items: center; gap: 26px;
  width: max-content;
  animation: wire 42s linear infinite;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
}
.wire-track i { color: var(--red); font-style: normal; font-size: 8px; }
@keyframes wire { to { transform: translateX(-50%); } }
.wire:hover .wire-track { animation-play-state: paused; }

/* ---------- sections ---------- */
.sec {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(64px, 9vw, 120px) var(--pad) 0;
}
.sec-head {
  display: flex; align-items: baseline; gap: 20px;
  margin-bottom: clamp(30px, 4vw, 48px);
}
.sec-no {
  font-size: 11.5px; color: var(--red);
  letter-spacing: 0.16em;
  border-bottom: 2px solid var(--red);
  padding-bottom: 4px;
}
.sec-head h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(34px, 5.4vw, 60px);
  letter-spacing: -0.01em; line-height: 1;
}
.sec-tag {
  margin-left: auto;
  font-size: 11.5px; color: var(--ink-faint);
  letter-spacing: 0.06em; font-style: italic;
  white-space: nowrap;
}

/* ---------- signals ledger ---------- */
.ledger { border-top: 1px solid var(--ink); }
.ledger .row {
  display: grid;
  grid-template-columns: minmax(150px, 220px) 1fr;
  gap: 26px;
  align-items: baseline;
  padding: 26px 0;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.25s, padding-left 0.25s;
}
.ledger .row:hover { background: var(--paper-2); padding-left: 14px; }
.fig {
  font-family: var(--serif);
  font-size: clamp(52px, 7vw, 88px);
  line-height: 0.9;
  color: var(--red);
  font-feature-settings: "lnum";
}
.fig .unit { font-size: 0.55em; }
.ledger p { font-size: clamp(16px, 1.8vw, 19px); color: var(--ink-soft); max-width: 58ch; }
.ledger p em { color: var(--ink); font-style: italic; }
.ledger .src { font-size: 11px; color: var(--ink-faint); letter-spacing: 0.06em; }

/* ---------- practice (services) ---------- */
.practice { border-top: 1px solid var(--ink); }
.entry {
  padding: 30px 0 34px;
  border-bottom: 1px solid var(--line-soft);
  display: grid;
  grid-template-columns: minmax(190px, 260px) 1fr;
  gap: 26px;
  transition: background 0.25s, padding-left 0.25s;
}
.entry:hover { background: var(--paper-2); padding-left: 14px; }
.entry-head { display: grid; gap: 6px; align-content: start; }
.entry-no { font-size: 11px; color: var(--red); letter-spacing: 0.14em; }
.entry h3 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(24px, 3vw, 33px);
  line-height: 1.05;
}
.entry dl { display: grid; gap: 13px; }
.entry dl > div {
  display: grid; grid-template-columns: 86px 1fr; gap: 14px;
  align-items: baseline;
}
.entry dt {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--ink-faint);
}
.entry dd { font-size: 15.5px; color: var(--ink-soft); }
.entry dd strong { color: var(--red); font-weight: 500; }

/* ---------- record ---------- */
.record-note {
  font-family: var(--serif);
  font-size: clamp(22px, 3vw, 32px);
  max-width: 24ch;
  margin-bottom: clamp(30px, 4vw, 46px);
}
.record-note em { color: var(--red); }
.record { list-style: none; border-top: 1px solid var(--ink); }
.record li {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 26px;
  padding: 26px 0;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.25s, padding-left 0.25s;
}
.record li:hover { background: var(--paper-2); padding-left: 14px; }
.yr { font-size: clamp(19px, 2.2vw, 24px); color: var(--ink); }
.yr span { color: var(--red); font-size: 0.72em; }
.record h3 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(19px, 2.3vw, 25px);
  margin-bottom: 6px;
}
.org { font-size: 11px; color: var(--ink-faint); letter-spacing: 0.08em; margin-left: 8px; }
.record p { color: var(--ink-soft); font-size: 15.5px; max-width: 60ch; }

/* ---------- entries (work) ---------- */
.entries {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
}
.card {
  background: var(--paper);
  padding: clamp(26px, 3vw, 36px);
  transition: background 0.25s;
}
.card:hover { background: var(--paper-2); }
.card-lead { background: linear-gradient(160deg, var(--red-soft), transparent 60%), var(--paper); }
.chip {
  display: inline-block;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--red);
  border: 1px solid var(--red);
  padding: 5px 10px;
  transform: rotate(-1.2deg);
  margin-bottom: 16px;
}
.card h3 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(23px, 2.8vw, 30px);
  margin-bottom: 10px;
}
.card p { color: var(--ink-soft); font-size: 15.5px; }
.card-meta { margin-top: 12px; font-size: 12px !important; color: var(--ink) !important; }

/* ---------- story ---------- */
.story { max-width: 700px; display: grid; gap: 24px; }
.story p { font-size: clamp(17px, 2vw, 20px); color: var(--ink-soft); }
.story .drop::first-letter {
  font-family: var(--serif);
  font-size: 3.4em;
  float: left;
  line-height: 0.82;
  padding: 6px 12px 0 0;
  color: var(--red);
}
.punch {
  font-family: var(--serif);
  font-size: clamp(22px, 3vw, 30px) !important;
  color: var(--ink) !important;
  border-left: 3px solid var(--red);
  padding-left: 22px;
}
.punch strong { color: var(--red); font-weight: 400; font-style: italic; }

/* ---------- proof ---------- */
.langs-line {
  font-size: 14px; color: var(--ink);
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--line-soft);
  padding: 18px 0;
  margin-bottom: 36px;
  line-height: 2;
}
.langs-line span { color: var(--ink-faint); font-size: 11px; letter-spacing: 0.06em; }
.certs {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
}
.cert { background: var(--paper); padding: 24px 20px; }
.cert b {
  display: block;
  font-family: var(--serif); font-weight: 400;
  font-size: 30px; color: var(--red);
  margin-bottom: 6px;
}
.cert span { font-size: 13px; color: var(--ink-soft); }

/* ---------- contact ---------- */
.contact { padding-bottom: clamp(60px, 8vw, 100px); }
.contact-lead {
  font-family: var(--serif);
  font-size: clamp(32px, 5.6vw, 62px);
  line-height: 1.12;
  max-width: 16ch;
  margin-bottom: 36px;
}
.contact-lead em { color: var(--red); }
.contact-meta { margin-top: 26px; font-size: 12px; color: var(--ink-faint); letter-spacing: 0.06em; }

/* ---------- footer ---------- */
.foot { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad) 30px; }
.foot-rule {
  border-top: 1px solid var(--ink);
  border-bottom: 3px double var(--ink);
  height: 5px;
  margin-bottom: 18px;
}
.foot-row {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--ink-soft);
}
.foot-row .ar { color: var(--ink); }

/* ---------- reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.85s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.85s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .wire-track, .caret { animation: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .pillars { grid-template-columns: 1fr; }
  .pillars li { border-right: none; border-bottom: 1px solid var(--line-soft); padding: 14px 0; }
  .pillars li + li { padding-left: 0; }
  .pillars li:last-child { border-bottom: none; }
  .entries, .certs { grid-template-columns: repeat(2, 1fr); }
  .stamp { display: none; }
}
@media (max-width: 680px) {
  .mast-top { grid-template-columns: 1fr; justify-items: center; gap: 2px; }
  .mast-date, .mast-est { display: none; }
  .mast-nav { overflow-x: auto; justify-content: flex-start; }
  .entries, .certs { grid-template-columns: 1fr; }
  .ledger .row, .entry, .record li { grid-template-columns: 1fr; gap: 10px; }
  .entry dl > div { grid-template-columns: 1fr; gap: 2px; }
  .sec-tag { display: none; }
  .dispatch { flex-direction: column; align-items: flex-start; gap: 6px; }
}
