/* samuelhaddad.com — one stylesheet, no framework.
   Colors live in the variables below; change them here and everything follows.
   Dark mode is set by <html data-theme="dark"> (see theme.js), falling back to the OS setting. */

@font-face { font-family: "Inter"; src: url("/fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("/fonts/newsreader.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("/fonts/newsreader-italic.woff2") format("woff2"); font-weight: 200 800; font-style: italic; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/fonts/jetbrains-mono.woff2") format("woff2"); font-weight: 100 800; font-style: normal; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #ffffff;
  --glass: rgba(255, 255, 255, 0.8);
  --surface: #f6f6f7;
  --text: #111113;
  --muted: #5f6068;
  --line: #e7e7ea;
  --accent: #c25100;      /* orange used for small text; passes contrast on white */
  --accent-soft: #fff0e3;
  --pop: #f26a0A;         /* brighter orange for the dot and big headline words */
  --on-accent: #ffffff;
  --str: #2f7d46;         /* code strings */

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0c0e;
  --glass: rgba(12, 12, 14, 0.8);
  --surface: #151518;
  --text: #f2f2f3;
  --muted: #a1a1aa;
  --line: #26262b;
  --accent: #ff8a3d;
  --accent-soft: #2a1a0f;
  --pop: #ff8a3d;
  --on-accent: #0c0c0e;
  --str: #8fd19e;
}

/* No-JS fallback: follow the OS until theme.js sets data-theme */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #0c0c0e;
    --glass: rgba(12, 12, 14, 0.8);
    --surface: #151518;
    --text: #f2f2f3;
    --muted: #a1a1aa;
    --line: #26262b;
    --accent: #ff8a3d;
    --accent-soft: #2a1a0f;
    --pop: #ff8a3d;
    --on-accent: #0c0c0e;
    --str: #8fd19e;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
a:hover { color: var(--accent); }

.container { max-width: 1120px; margin: 0 auto; padding: 0 32px; }
.mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); }
.accent { color: var(--accent); }

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding-top: 8px; padding-bottom: 8px; }

.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 17px; font-weight: 600; letter-spacing: -0.02em; text-decoration: none; }

.beacon { width: 10px; height: 10px; border-radius: 50%; background: var(--pop); animation: beacon 2.4s ease-in-out infinite; }
@keyframes beacon {
  0% { opacity: 1; box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.55); }
  50% { opacity: 0.45; }
  70% { box-shadow: 0 0 0 10px rgba(249, 115, 22, 0); }
  100% { opacity: 1; box-shadow: 0 0 0 0 rgba(249, 115, 22, 0); }
}
@media (prefers-reduced-motion: reduce) { .beacon { animation: none; } }

.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 15px; font-weight: 500; }
.nav-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; text-decoration: none; }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; margin-left: 4px; padding: 0;
  border: 1px solid var(--line); border-radius: 999px;
  background: transparent; color: var(--text); cursor: pointer;
}
.theme-toggle:hover { border-color: var(--accent); }
.icon-sun { display: none; }
[data-theme="dark"] .icon-sun { display: inline; }
[data-theme="dark"] .icon-moon { display: none; }

/* ---------- hero / page head ---------- */

.hero { padding: 72px 0 40px; }
.hero h1 { margin: 0; max-width: 860px; font-size: clamp(40px, 7vw, 68px); line-height: 1.02; font-weight: 700; letter-spacing: -0.04em; }
.pop { color: var(--pop); }
.tagline { margin: 24px 0 0; font-family: var(--mono); font-size: 15px; line-height: 1.6; letter-spacing: 0.01em; color: var(--muted); }
.tagline a { color: var(--text); }

.page-head { padding: 72px 0 24px; }
main > .page-head:last-child { padding-bottom: 96px; }
.page-head h1 { margin: 0; font-size: clamp(36px, 6vw, 56px); line-height: 1.05; font-weight: 700; letter-spacing: -0.04em; }

/* ---------- cards ---------- */

.card { display: block; border: 1px solid var(--line); border-radius: 16px; text-decoration: none; color: var(--text); }
.card:hover { border-color: var(--accent); color: var(--text); }

.featured-wrap { padding-bottom: 24px; }
.featured { padding: 44px; border-radius: 20px; background: var(--surface); }
.featured-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.featured h2 { margin: 20px 0 0; max-width: 820px; font-size: clamp(26px, 4vw, 38px); line-height: 1.15; font-weight: 600; letter-spacing: -0.03em; }
.featured p { margin: 16px 0 0; max-width: 680px; font-size: 18px; line-height: 1.65; color: var(--muted); }

.pill { display: inline-block; padding: 3px 12px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 600; }
.tag { font-size: 13px; font-weight: 600; color: var(--accent); }
a.tag { text-decoration: none; }
.tag-pill { display: inline-block; padding: 3px 12px; border-radius: 999px; background: var(--accent-soft); }
a.tag-pill { display: inline-flex; align-items: center; min-height: 44px; }
.tag-index { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 0; }

.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

/* ---------- timeline: years down the left, dates beside each post ---------- */

.timeline { padding: 72px 0 96px; }
.timeline .eyebrow { margin: 0 0 24px; font-size: 13px; }
.year-group { display: flex; flex-wrap: wrap; column-gap: 40px; }
.year { flex: 0 0 140px; align-self: flex-start; padding-top: 28px; font-size: 32px; line-height: 1; font-weight: 700; letter-spacing: -0.03em; }
.rows { flex: 1 1 480px; min-width: 0; }
.row { display: grid; grid-template-columns: 72px minmax(0, 1fr); column-gap: 24px; padding: 28px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--text); }
.row:hover { color: var(--text); }
.row:hover h3 { color: var(--accent); }
.row-date { padding-top: 6px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.row h3 { margin: 0; font-size: 24px; line-height: 1.25; font-weight: 600; letter-spacing: -0.02em; }
.row p { margin: 10px 0 12px; max-width: 640px; font-size: 16px; line-height: 1.6; color: var(--muted); }

.archive-link { margin-top: 16px; padding-top: 32px; border-top: 1px solid var(--line); }
.button { display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; font-weight: 500; text-decoration: none; }
.button:hover { border-color: var(--accent); color: var(--text); }

/* ---------- post / page ---------- */

.post { padding-top: 56px; padding-bottom: 96px; }
.back { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; font-weight: 500; color: var(--muted); text-decoration: none; }
.post-title { margin: 16px 0 0; max-width: 900px; font-size: clamp(32px, 5vw, 56px); line-height: 1.05; font-weight: 700; letter-spacing: -0.04em; }
.post-layout { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 48px; margin-top: 48px; padding-top: 40px; border-top: 1px solid var(--line); }
.post-meta { flex: 0 0 240px; display: flex; flex-direction: column; gap: 24px; font-size: 14px; }
.post-meta .eyebrow { margin-bottom: 6px; }

.prose { flex: 1 1 520px; min-width: 0; max-width: 720px; font-family: var(--serif); font-size: 21px; line-height: 1.75; }
.prose > :last-child { margin-bottom: 0; }
.prose p, .prose ul, .prose ol, .prose pre, .prose table, .prose blockquote, .prose figure { margin: 0 0 28px; }
.prose h2, .prose h3, .prose h4 { font-family: var(--sans); font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; }
.prose h2 { margin: 56px 0 16px; font-size: 28px; scroll-margin-top: 5rem; }
.prose h3 { margin: 40px 0 12px; font-size: 22px; scroll-margin-top: 5rem; }
.prose h4 { margin: 32px 0 8px; font-size: 18px; scroll-margin-top: 5rem; }
.prose a { color: var(--accent); text-underline-offset: 3px; }
.prose .heading-anchor { color: inherit; text-decoration: none; }
.prose .heading-anchor:hover { color: var(--accent); }
.prose a:hover { text-decoration-thickness: 2px; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin-bottom: 8px; }
.prose blockquote { padding: 0 0 0 24px; font-style: italic; color: var(--muted); }
.prose hr { margin: 48px 0; border: 0; border-top: 1px solid var(--line); }
.prose picture { display: block; margin: 0 0 28px; }
.prose img { display: block; max-width: 100%; height: auto; border-radius: 12px; }
.prose img.about-photo { width: 211px; max-width: 100%; border-radius: 50%; }
.prose picture img { margin: 0; }
.prose table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 16px; }
.prose th, .prose td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }

.prose code { padding: 2px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-family: var(--mono); font-size: 0.8em; }
.prose pre { padding: 24px 20px; overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); font-size: 15px; line-height: 1.75; }
.prose pre code { padding: 0; border: 0; background: none; font-size: inherit; color: var(--text); }

.token.keyword, .token.literal, .token.number, .token.selector, .token.tag, .token.function, .token.deleted { color: var(--accent); }
.token.string, .token.attr-value, .token.regex, .token.inserted { color: var(--str); }
.token.comment, .token.prolog { color: var(--muted); font-style: italic; }

.pager { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; margin-top: 72px; }
.pager-card { padding: 28px; }
.pager-title { display: block; margin-top: 10px; font-size: 20px; line-height: 1.3; font-weight: 600; letter-spacing: -0.02em; }

/* ---------- footer ---------- */

.site-footer { border-top: 1px solid var(--line); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-top: 28px; padding-bottom: 56px; font-size: 14px; color: var(--muted); }
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--accent); }

.search-ui { max-width: 720px; padding-bottom: 96px; }

/* ---------- small screens ---------- */

@media (max-width: 640px) {
  .container { padding: 0 20px; }
  .hero { padding-top: 48px; }
  .page-head { padding-top: 48px; }
  .featured { padding: 28px; }
  .year { flex-basis: 100%; padding-top: 24px; padding-bottom: 16px; }
  .row { grid-template-columns: 64px minmax(0, 1fr); column-gap: 16px; }
  .prose { font-size: 19px; }
  .post-meta { flex-basis: 100%; }
}
