/* ==========================================================================
   Azim Afifi · personal site
   Design tokens + editorial component styles.
   Tokens below are the single source of truth for color. Tailwind reads
   them through assets/js/tailwind-config.js. Change a color HERE, nowhere else.
   Values are space-separated RGB so Tailwind can apply alpha (rgb(var(--x)/.5)).
   ========================================================================== */

:root {
  --c-bg: 250 249 246;      /* warm paper */
  --c-surface: 255 255 255; /* cards, raised panels */
  --c-ink: 18 28 46;        /* deep blue-black text */
  --c-muted: 82 96 116;     /* slate secondary text */
  --c-line: 223 226 232;    /* hairline borders */
  --c-accent: 15 118 110;   /* rich teal */
  --c-navy: 24 48 84;       /* deep blue, decorative */
  color-scheme: light;
}

[data-theme="dark"] {
  --c-bg: 10 15 26;
  --c-surface: 17 24 39;
  --c-ink: 230 234 241;
  --c-muted: 146 158 176;
  --c-line: 37 47 66;
  --c-accent: 45 212 191;
  --c-navy: 141 168 210;
  color-scheme: dark;
}

/* Theme transition: the .theme-anim class is added by theme.js AFTER first
   paint, so page load never animates but toggling always does. */
html.theme-anim body,
html.theme-anim *,
html.theme-anim *::before,
html.theme-anim *::after {
  transition:
    background-color 0.35s ease,
    color 0.35s ease,
    border-color 0.35s ease,
    box-shadow 0.35s ease,
    transform 0.3s ease;
}

/* ---------- base ---------- */

html { scroll-behavior: smooth; }

body {
  background-color: rgb(var(--c-bg));
  color: rgb(var(--c-ink));
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background-color: rgb(var(--c-accent) / 0.25); }

:focus-visible {
  outline: 2px solid rgb(var(--c-accent));
  outline-offset: 2px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: rgb(var(--c-accent));
  color: rgb(var(--c-bg));
  border-radius: 0 0 0.5rem 0;
}
.skip-link:focus { left: 0; }

/* ---------- shared components ---------- */

.eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgb(var(--c-accent));
  display: flex;
  align-items: center;
  gap: 0.9rem;
}
.eyebrow::before {
  content: "";
  width: 2.5rem;
  border-top: 1px solid rgb(var(--c-accent) / 0.6);
}

.nav-link { color: rgb(var(--c-muted)); }
.nav-link:hover { color: rgb(var(--c-accent)); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 9999px;
  border: 1px solid rgb(var(--c-line));
  color: rgb(var(--c-muted));
  background: rgb(var(--c-surface) / 0.6);
}
.theme-toggle:hover { border-color: rgb(var(--c-accent)); color: rgb(var(--c-accent)); }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border-radius: 9999px;
  padding: 0.8rem 1.6rem;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
}
.btn-primary {
  background: rgb(var(--c-accent));
  color: rgb(var(--c-bg));
  box-shadow: 0 8px 22px -10px rgb(var(--c-accent) / 0.7);
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.06); }
.btn-ghost {
  border: 1px solid rgb(var(--c-ink) / 0.25);
  color: rgb(var(--c-ink));
}
.btn-ghost:hover { border-color: rgb(var(--c-accent)); color: rgb(var(--c-accent)); }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  border: 1px solid;
  padding: 0.28rem 0.7rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-live    { color: rgb(var(--c-accent)); border-color: rgb(var(--c-accent) / 0.4); background: rgb(var(--c-accent) / 0.08); }
.badge-planned { color: rgb(var(--c-muted));  border-color: rgb(var(--c-muted) / 0.4);  background: rgb(var(--c-muted) / 0.08); }
.badge-concept { color: rgb(var(--c-navy));   border-color: rgb(var(--c-navy) / 0.4);   background: rgb(var(--c-navy) / 0.08); }

.tag {
  display: inline-flex;
  border-radius: 9999px;
  border: 1px solid rgb(var(--c-line));
  background: rgb(var(--c-surface));
  padding: 0.3rem 0.75rem;
  font-size: 0.72rem;
  color: rgb(var(--c-muted));
}

/* case-study card: markup is generated by assets/js/main.js */
.cs-card { position: relative; }
.cs-card .cs-link { color: inherit; text-decoration: none; }
.cs-card .cs-link::after { content: ""; position: absolute; inset: 0; } /* whole card clickable */
.cs-card:hover .cs-link { color: rgb(var(--c-accent)); }

/* ---------- article (case-study detail pages) ---------- */

.article { max-width: 44rem; margin-inline: auto; }

.article .lede {
  font-size: 1.28rem;
  line-height: 1.7;
  color: rgb(var(--c-ink) / 0.92);
}
.article p {
  font-size: 1.04rem;
  line-height: 1.85;
  color: rgb(var(--c-ink) / 0.86);
  margin-top: 1.35rem;
}

/* full justification with auto hyphenation for all article running text */
.article p,
.article li {
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}

.article h2 {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.25;
  margin-top: 3.2rem;
}
.article h2::before {
  content: "";
  display: block;
  width: 2.6rem;
  border-top: 2px solid rgb(var(--c-accent));
  margin-bottom: 1rem;
}

.article ul, .article ol {
  margin-top: 1.35rem;
  padding-left: 1.4rem;
  display: grid;
  gap: 0.7rem;
  font-size: 1.02rem;
  line-height: 1.7;
  color: rgb(var(--c-ink) / 0.86);
}
.article ul { list-style: disc; }
.article ol { list-style: decimal; }
.article li::marker { color: rgb(var(--c-accent)); }

.article strong { color: rgb(var(--c-ink)); }

.pullquote {
  margin-top: 2.6rem;
  border-left: 3px solid rgb(var(--c-accent));
  padding-left: 1.6rem;
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  font-size: 1.5rem;
  line-height: 1.55;
  color: rgb(var(--c-ink));
}
.pullquote cite {
  display: block;
  margin-top: 0.9rem;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-style: normal;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgb(var(--c-muted));
}

/* dashed blocks that mark content still to be written */
.placeholder {
  margin-top: 1.6rem;
  border: 1.5px dashed rgb(var(--c-muted) / 0.5);
  border-radius: 0.8rem;
  background: rgb(var(--c-surface) / 0.55);
  padding: 1.2rem 1.4rem;
  font-size: 0.95rem;
  line-height: 1.65;
  color: rgb(var(--c-muted));
}
.placeholder::before {
  content: "Placeholder";
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgb(var(--c-accent));
}

.figure-ph {
  margin-top: 2.4rem;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  border: 1.5px dashed rgb(var(--c-muted) / 0.5);
  border-radius: 1rem;
  background: rgb(var(--c-surface) / 0.55);
  color: rgb(var(--c-muted));
  font-size: 0.85rem;
  text-align: center;
  padding: 1rem;
}

/* footnotes: markers, popover (built by footnotes.js), and the Notes list */
sup.fn { line-height: 0; }
a.fn-ref {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.74em;
  font-weight: 600;
  color: rgb(var(--c-accent));
  text-decoration: none;
  padding: 0 0.18em;
  border-radius: 0.3em;
}
a.fn-ref:hover,
a.fn-ref[aria-expanded="true"] {
  background: rgb(var(--c-accent) / 0.14);
}

.fn-pop {
  position: absolute;
  z-index: 60;
  background: rgb(var(--c-surface));
  border: 1px solid rgb(var(--c-line));
  border-radius: 0.8rem;
  box-shadow: 0 18px 44px -14px rgb(var(--c-ink) / 0.35);
  padding: 0.9rem 1.05rem;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.85rem;
  line-height: 1.6;
  color: rgb(var(--c-ink) / 0.88);
}

.article ol.fn-list {
  font-size: 0.9rem;
  line-height: 1.65;
  color: rgb(var(--c-ink) / 0.78);
}
.fn-list li:target {
  background: rgb(var(--c-accent) / 0.1);
  border-radius: 0.4rem;
  padding: 0.2rem 0.4rem;
}
a.fn-back {
  color: rgb(var(--c-accent));
  text-decoration: none;
  margin-left: 0.35rem;
}

.stat-tile {
  border: 1px solid rgb(var(--c-line));
  border-radius: 1rem;
  background: rgb(var(--c-surface));
  padding: 1.4rem 1.5rem;
}
.stat-tile .stat-value {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: rgb(var(--c-accent));
  line-height: 1;
}
.stat-tile .stat-label {
  margin-top: 0.6rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: rgb(var(--c-muted));
}
