@import url("./tokens.css");

/* ============================================================
   magedaitabbi.com — Direction B: modern minimal.
   Manrope carries almost everything; Newsreader is reserved for
   taglines and essay prose, where reading actually happens.
   No hand-drawn motifs. Colour comes only from tokens.css, so
   light and dark are one codebase.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--step-0);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 54rem; margin: 0 auto; padding: 0 1.75rem; }

/* ---- Nav ---------------------------------------------------- */

.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 2.4rem 0;
}
.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav a {
  font-size: var(--step--1);
  font-weight: 500;
  color: var(--ink-faint);
  text-decoration: none;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); }

.theme-toggle {
  flex: none;
  background: none;
  border: 1px solid var(--edge);
  border-radius: 99px;
  width: 2rem; height: 2rem;
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--ink-faint);
  padding: 0;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-faint); }
.theme-toggle svg { width: 15px; height: 15px; }
/* One icon per theme: the sun offers light, the moon offers dark. */
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: none; }
}

/* ---- Type --------------------------------------------------- */

h1, h2, h3 {
  font-family: var(--font-ui);
  font-weight: 700;
  letter-spacing: -0.028em;
  line-height: var(--lh-tight);
  margin: 0 0 0.7rem;
}
h1 { font-size: var(--step-3); font-weight: 800; letter-spacing: -0.04em; }
h2 { font-size: var(--step-1); margin-top: 3rem; letter-spacing: -0.022em; }
h3 { font-size: var(--step-0); margin-top: 1.8rem; letter-spacing: -0.014em; }

p { margin: 0 0 1.2rem; max-width: 38rem; }

a { color: var(--acc); text-underline-offset: 3px; }
a:hover { color: var(--acc-hover); }

.lede {
  font-family: var(--font-read);
  font-size: var(--step-1);
  line-height: 1.45;
  color: var(--ink-soft);
  max-width: 34rem;
}
.lede em, .lede .accent {
  font-style: normal;
  color: var(--ink);
  box-shadow: inset 0 -.5em 0 var(--acc-wash);
}

.eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--acc);
  margin: 0 0 1.1rem;
}

.meta { font-size: var(--step--1); color: var(--ink-faint); }

/* Section labels sit above their content in small caps. */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin: 3.2rem 0 1.2rem;
}
.section-head h2 {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0;
}
.section-head a { font-size: var(--step--1); font-weight: 500; text-decoration: none; }

/* ---- Layout blocks ------------------------------------------ */

main { padding: 1.5rem 0 1rem; }
.hero { padding: 2.5rem 0 1rem; }
.hero h1 { font-size: var(--step-4); margin-bottom: 1.4rem; }

hr.rule { border: 0; border-top: 1px solid var(--edge); margin: 3rem 0; }

/* Three doors — flat, bordered, no tilt */
.doors {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1rem;
  margin: 2.5rem 0 1rem;
}
.door {
  display: block;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 1.3rem;
  text-decoration: none;
  color: var(--ink);
  transition: border-color .15s ease, transform .15s ease;
}
.door:hover { border-color: var(--acc); transform: translateY(-2px); color: var(--ink); }
.door strong {
  display: block;
  font-size: var(--step-0);
  font-weight: 700;
  letter-spacing: -.015em;
  margin-bottom: .35rem;
}
.door span { color: var(--ink-soft); font-size: var(--step--1); line-height: 1.5; }

/* ---- Row lists: the workhorse for writing, work and books ---- */

.entries { list-style: none; margin: 1.4rem 0 0; padding: 0; }
.entries li { padding: 1.1rem 0; border-top: 1px solid var(--edge); }
.entries li:last-child { border-bottom: 1px solid var(--edge); }
.entries h3 { margin: 0 0 .2rem; font-size: var(--step-0); font-weight: 700; }
.entries h3 a { text-decoration: none; color: var(--ink); }
.entries h3 a:hover { color: var(--acc); }
.entries p {
  margin: .2rem 0 .4rem;
  font-size: var(--step--1);
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 40rem;
}
h2[id] { scroll-margin-top: 1.5rem; }

.theme-index {
  font-size: var(--step--1);
  line-height: 2;
  color: var(--ink-faint);
  max-width: 40rem;
  margin-top: 1.4rem;
}
.theme-index a { text-decoration: none; }
.theme-index a:hover { text-decoration: underline; }

/* ---- Stat row ----------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 1.6rem 1.2rem;
  margin: 3rem 0 1rem;
  padding: 1.7rem 0;
  border-top: 1px solid var(--edge);
  border-bottom: 1px solid var(--edge);
}
.stat b {
  display: block;
  font-size: var(--step-2);
  font-weight: 700;
  letter-spacing: -.035em;
  line-height: 1.1;
  color: var(--ink);
}
.stat span { font-size: 0.8rem; color: var(--ink-faint); }

/* ---- Portrait ------------------------------------------------ */

/* Sized for the photo that actually exists — a 3:2 landscape frame, not the
   4:5 card the slot was originally cut for. */
.portrait { max-width: 100%; margin: 2.2rem 0 2.8rem; }
.portrait img {
  display: block; width: 100%; height: auto;
  border-radius: var(--radius);
  background: var(--surface);
}
.portrait figcaption { margin-top: .6rem; font-size: var(--step--1); color: var(--ink-faint); }

/* ---- Country board ------------------------------------------ */

.countries {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: .7rem;
  margin: 2.2rem 0 1rem;
  padding: 0;
  list-style: none;
}
.countries li {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: .75rem .9rem;
}
.countries .flag { font-size: 1.1rem; line-height: 1; margin-right: .5rem; }
.countries .name { font-size: var(--step--1); font-weight: 600; }
.countries li.told { border-left: 2px solid var(--acc); }
.countries .note {
  display: block;
  margin-top: .45rem;
  font-size: var(--step--1);
  line-height: 1.5;
  color: var(--ink-soft);
}

/* ---- Timeline: tabular, not decorative ----------------------- */

.timeline { list-style: none; margin: 1.4rem 0 0; padding: 0; }
.timeline li {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 1.5rem;
  padding: 1.1rem 0;
  border-top: 1px solid var(--edge);
  align-items: baseline;
}
.timeline li:last-child { border-bottom: 1px solid var(--edge); }
.timeline .when {
  font-size: var(--step--1);
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.timeline strong { font-weight: 700; letter-spacing: -.015em; }
.timeline li.mark strong { color: var(--acc); }
.timeline p {
  margin: .25rem 0 0;
  font-size: var(--step--1);
  line-height: 1.55;
  color: var(--ink-soft);
}

/* ---- Quotes -------------------------------------------------- */

.quote {
  margin: 1.6rem 0;
  padding: 1.3rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  max-width: 40rem;
}
.quote p {
  font-family: var(--font-read);
  font-size: var(--step-0);
  line-height: 1.6;
  margin-bottom: .8rem;
}
.quote cite { font-size: var(--step--1); font-style: normal; color: var(--ink-faint); }

/* ---- Reading list -------------------------------------------- */

.books {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.5rem;
  margin: 1.8rem 0;
  padding: 0;
  list-style: none;
}
.books li { max-width: 24rem; }
.books h3 { margin: 0 0 .1rem; font-size: var(--step-0); }
.books .author { font-size: var(--step--1); color: var(--ink-faint); }
.books p { margin: .4rem 0 0; font-size: var(--step--1); line-height: 1.55; color: var(--ink-soft); }

/* ---- Essay pages: where the serif earns its place ------------ */

.essay-header { margin-bottom: 2.6rem; }
.essay-header h1 { font-size: var(--step-3); margin-bottom: .8rem; max-width: 32rem; }
.essay-header .subtitle {
  font-family: var(--font-read);
  font-size: var(--step-1);
  line-height: 1.45;
  color: var(--ink-soft);
  max-width: 34rem;
  margin-bottom: .9rem;
}

.essay { font-family: var(--font-read); }
.essay p { font-size: 1.15rem; line-height: 1.72; max-width: 36rem; }
.essay p:first-of-type { font-size: var(--step-1); line-height: 1.55; }
.essay h2 {
  font-family: var(--font-ui);
  font-size: var(--step-2);
  margin-top: 3rem;
  letter-spacing: -.028em;
}
.essay strong { font-weight: 600; color: var(--ink); }
.essay h3 {
  font-family: var(--font-ui);
  font-size: var(--step-1);
  margin-top: 2.4rem;
  letter-spacing: -.022em;
}
.essay ul { max-width: 36rem; margin: 0 0 1.2rem; padding-left: 1.4rem; }
/* Wider than the ul: a two-digit marker like "10." overflows 1.4rem and clips. */
.essay ol { max-width: 36rem; margin: 0 0 1.2rem; padding-left: 2.1rem; }
.essay li { font-size: 1.15rem; line-height: 1.72; margin-bottom: .7rem; }
.essay li::marker { color: var(--ink-faint); }
.essay .question {
  font-family: var(--font-ui);
  font-size: var(--step-1);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.32;
  color: var(--ink);
  border-left: 2px solid var(--acc);
  padding-left: 1.1rem;
  margin: 1.9rem 0 .5rem;
  max-width: 34rem;
}
.essay .question + p { margin-left: 1.1rem; color: var(--ink-soft); font-size: var(--step-0); }

.essay-footer {
  margin-top: 3rem;
  padding: 1.5rem 1.7rem;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
}
.essay-footer p { margin: 0; font-size: var(--step-0); }

.back-link {
  display: inline-block;
  margin-top: 2.4rem;
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-weight: 500;
  text-decoration: none;
}

/* ---- Footer -------------------------------------------------- */

.site-footer {
  margin-top: 4.5rem;
  padding: 1.8rem 0 3rem;
  border-top: 1px solid var(--edge);
  font-size: var(--step--1);
  color: var(--ink-faint);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
}
.site-footer a { color: var(--ink-soft); text-decoration: none; }
.site-footer a:hover { color: var(--acc); }

/* ---- Small screens ------------------------------------------- */

@media (max-width: 44rem) {
  :root { --step-3: 2rem; --step-4: 2.4rem; }
  .site-nav { flex-wrap: wrap; padding: 1.8rem 0; }
  .timeline li { grid-template-columns: 1fr; gap: .2rem; }
  .essay p { font-size: 1.08rem; }
}
