/* ==========================================================================
   AbdallaWeb — hand-written CSS, no build step, no framework.

   Palette: Swift orange (#F05138) as the single accent, on warm-tinted
   neutrals so the greys don't fight the orange. Light and dark are the same
   scale inverted, not two separate designs.
   ========================================================================== */

:root {
  /* Accent scale */
  --orange-50:  #fff5f2;
  --orange-100: #ffe6de;
  --orange-200: #ffc8b7;
  --orange-300: #ffa48b;
  --orange-400: #fa7d5c;
  --orange-500: #f05138; /* Swift orange — the brand colour */
  --orange-600: #d63d22;
  --orange-700: #af2e17;
  --orange-800: #872413;
  --orange-900: #571708;

  /* Semantic — light */
  --bg:         #ffffff;
  --surface:    #faf7f5;
  --raised:     #f4efec;
  --border:     #e7e0db;
  --border-strong: #d5cac3;
  --text:       #17120f;
  --text-soft:  #4a403b;
  --text-muted: #786a63;
  --accent:     var(--orange-500);
  --accent-hover: var(--orange-600);
  --on-accent:  #ffffff;
  --accent-wash: var(--orange-50);

  /* Terminals stay dark in both themes — that's what a terminal is */
  --term-bg:    #16110e;
  --term-bar:   #221a15;
  --term-text:  #f0e7e1;
  --term-muted: #9c8b81;

  --radius:    14px;
  --radius-sm: 9px;
  --max-width: 62rem;
  --header-h:  4rem;
  --strip-h:   7.25rem;

  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text",
               "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:         #0d0a09;
    --surface:    #17110e;
    --raised:     #201813;
    --border:     #322620;
    --border-strong: #48372e;
    --text:       #f5f0ec;
    --text-soft:  #d3c7c0;
    --text-muted: #a3948b;
    --accent:     var(--orange-400);
    --accent-hover: var(--orange-300);
    --on-accent:  #2b0d05;
    --accent-wash: #24140f;
  }
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

.human-dash {
  /* containing block for the note, which sits directly above the dash */
  position: relative;
  color: inherit;
  cursor: help;
  border-bottom: 1px dotted var(--border-strong);
}

.human-dash::after {
  content: attr(data-note);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.625rem);
  width: max-content;
  max-width: min(18rem, 70vw);
  padding: 0.75rem 0.875rem;
  border-radius: var(--radius-sm);
  background: var(--term-bg);
  color: var(--term-text);
  font-size: 0.8125rem;
  line-height: 1.5;
  text-align: left;
  white-space: normal;
  box-shadow: 0 10px 28px rgb(0 0 0 / 0.3);
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  z-index: 100;
}

/* Slides up, holds ~2s, fades out on its own.
   `.is-showing` is the unprompted appearance on load, added by site.js;
   hover and focus replay it afterwards. */
.human-dash.is-showing::after,
.human-dash:hover::after,
.human-dash:focus::after {
  animation: dash-note 2.6s ease-out forwards;
}

@keyframes dash-note {
  0%   { opacity: 0; transform: translate(-50%, 8px); }
  10%  { opacity: 1; transform: translate(-50%, 0); }
  78%  { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, 8px); }
}

/* Your global reduced-motion rule would collapse the animation to nothing,
   so give those visitors a plain tooltip that stays while hovered. */
@media (prefers-reduced-motion: reduce) {
  .human-dash:hover::after,
  .human-dash:focus::after {
    animation: none;
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

main.container { flex: 1 0 auto; padding-bottom: 5rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

h1, h2, h3 { line-height: 1.18; margin: 0 0 0.5rem; letter-spacing: -0.022em; }
h1 { font-size: clamp(2.25rem, 6vw, 3.25rem); font-weight: 700; }
h2 { font-size: clamp(1.375rem, 3vw, 1.75rem); font-weight: 650; }
h3 { font-size: 1.0625rem; font-weight: 620; }
p  { margin: 0 0 1rem; }

code, pre { font-family: var(--font-mono); font-size: 0.875em; }

.muted { color: var(--text-muted); }
.small { font-size: 0.8125rem; }
.prose-narrow { max-width: 40rem; color: var(--text-soft); }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.lede { font-size: 1.125rem; color: var(--text-soft); max-width: 40rem; }

/* --------------------------------------------------------------------------
   Header / nav
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5625rem;
  color: var(--text);
  font-weight: 650;
  letter-spacing: -0.015em;
}

.brand:hover { text-decoration: none; }
.brand:hover .brand-name { color: var(--accent); }
.brand-name { transition: color 140ms ease; }

.am-mark {
  display: inline-grid;
  place-items: center;
  border-radius: 30%;
  background: linear-gradient(160deg, var(--orange-400), var(--orange-600));
  color: #fff;
  flex: 0 0 auto;
}

.am-mark-text {
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.nav-links { display: flex; gap: 1.375rem; list-style: none; margin: 0; padding: 0; }

.nav-links a {
  display: inline-block;
  color: var(--text-muted);
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: color 140ms ease;
}

.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links a.is-active { color: var(--text); border-bottom-color: var(--accent); }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero { padding: 4.5rem 0 3rem; }
.hero-tight { padding-bottom: 2rem; }
.hero-app { text-align: center; padding-top: 3.5rem; }
.hero-app .eyebrow, .hero-app .lede { justify-content: center; margin-inline: auto; }

.app-icon {
  width: 128px;
  height: 128px;
  display: block;
  margin: 0 auto 1.5rem;
  filter: drop-shadow(0 10px 24px rgb(240 81 56 / 0.28));
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.button {
  display: inline-block;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  border: 1px solid var(--accent);
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.button:hover {
  text-decoration: none;
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.button:active { transform: translateY(1px); }

.button-large { padding: 0.875rem 2rem; font-size: 1.0625rem; border-radius: var(--radius); }

.button-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.button-ghost:hover { background: var(--raised); border-color: var(--text-muted); }

/* A button that exists before the thing it downloads does. Clickable, does nothing. */
.button.is-pending { cursor: default; opacity: 0.7; }
.button.is-pending:hover { background: var(--accent); border-color: var(--accent); }
.button.is-pending:active { transform: none; }

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

.section { padding: 3.5rem 0 0; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.1875rem 0.5rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  white-space: nowrap;
}

.tags { display: flex; flex-wrap: wrap; gap: 0.375rem; list-style: none; margin: 0 0 1.25rem; padding: 0; }

.tag {
  font-size: 0.75rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 0.1875rem 0.625rem;
}

/* --------------------------------------------------------------------------
   Timeline — the horizontally scrolling strip of dates
   -------------------------------------------------------------------------- */

.timeline {
  position: sticky;
  top: var(--header-h);
  z-index: 10;
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 2rem 0 0;
  padding: 1.125rem 0 0.75rem;
  /* break out of the container's padding so the strip scrolls edge to edge */
  margin-inline: -1.25rem;
}

.timeline-track {
  display: flex;
  align-items: flex-start;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  padding: 0 1.25rem 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.timeline-track::-webkit-scrollbar { height: 6px; }
.timeline-track::-webkit-scrollbar-track { background: transparent; }
.timeline-track::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }

.stop {
  position: relative;
  flex: 0 0 auto;
  width: 8.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  scroll-snap-align: center;
  color: var(--text-muted);
  padding-top: 0.25rem;
}

.stop:hover { text-decoration: none; }

/* the connecting rail, drawn behind the dots */
.stop::before {
  content: "";
  position: absolute;
  top: 1.625rem;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.stop:first-child::before { left: 50%; }
.stop:last-child::before  { right: 50%; }

.stop-dot {
  position: relative;
  z-index: 1;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg);
  border: 2px solid var(--border-strong);
  color: var(--text-muted);
  transition: transform 160ms ease, border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.stop-year { font-size: 0.6875rem; font-weight: 700; letter-spacing: -0.01em; }

.stop-name {
  margin-top: 0.625rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  /* keep long project names from stretching the rail */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.stop-date { font-size: 0.6875rem; color: var(--text-muted); }

.stop:hover .stop-dot,
.stop:focus-visible .stop-dot {
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.1);
}

.stop:hover .stop-name { color: var(--accent); }

.stop.is-current .stop-dot {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

/* --------------------------------------------------------------------------
   Project sections
   -------------------------------------------------------------------------- */

.projects { display: flex; flex-direction: column; gap: 4.5rem; padding-top: 3.5rem; }

.project {
  /* clear the sticky header + timeline strip when jumped to */
  scroll-margin-top: calc(var(--header-h) + var(--strip-h));
}

.project-head { position: relative; margin-bottom: 0.75rem; }
.project-head h2 { transition: color 200ms ease; }

.project:target .project-head h2 { color: var(--accent); }

.project-count {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.project-summary { color: var(--text-soft); max-width: 42rem; }

.project-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.25rem; }

/* --------------------------------------------------------------------------
   Video
   -------------------------------------------------------------------------- */

.project-video { margin: 1.5rem 0 0; }

.video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #000;
}

.project-video figcaption { margin-top: 0.5rem; }

.video-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  aspect-ratio: 16 / 9;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  text-align: center;
  padding: 1rem;
}

.video-empty p { margin: 0; }

.video-empty-glyph {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--accent-wash);
  color: var(--accent);
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.video-empty-path {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--raised);
  border-radius: 6px;
  padding: 0.125rem 0.5rem;
}

/* --------------------------------------------------------------------------
   API page — terminal and code blocks
   -------------------------------------------------------------------------- */

.terminal, .code-block {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--term-bg);
  margin-top: 1.75rem;
}

.terminal-bar, .code-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--term-bar);
  border-bottom: 1px solid rgb(255 255 255 / 0.06);
}

.terminal-dots { display: flex; gap: 0.375rem; }

.terminal-dot {
  width: 0.6875rem;
  height: 0.6875rem;
  border-radius: 50%;
  background: #4a3a32;
}

.terminal-dot:first-child { background: #ff5f57; }
.terminal-dot:nth-child(2) { background: #febc2e; }
.terminal-dot:nth-child(3) { background: #28c840; }

.terminal-title, .code-lang {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--term-muted);
  margin-right: auto;
}

.code-lang { text-transform: uppercase; letter-spacing: 0.06em; }

.terminal-body, .code-body {
  margin: 0;
  padding: 1.125rem 1rem;
  color: var(--term-text);
  font-size: 0.8125rem;
  line-height: 1.65;
  overflow-x: auto;
  tab-size: 2;
}

.terminal-body { font-size: 0.9375rem; }
.code-body { max-height: 30rem; overflow-y: auto; }
.terminal-prompt { color: var(--orange-400); user-select: none; }

.copy {
  font: inherit;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.25rem 0.625rem;
  border-radius: 6px;
  border: 1px solid rgb(255 255 255 / 0.14);
  background: rgb(255 255 255 / 0.06);
  color: var(--term-text);
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}

.copy:hover { background: rgb(255 255 255 / 0.12); border-color: rgb(255 255 255 / 0.24); }
.copy.is-copied { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* Endpoints */

.endpoints { display: flex; flex-direction: column; gap: 0.625rem; margin-top: 1.5rem; }

.endpoint {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 0.875rem 1rem;
}

.endpoint-head { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

.method {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.1875rem 0.5rem;
  border-radius: 5px;
  background: var(--accent-wash);
  color: var(--accent);
  border: 1px solid var(--orange-200);
}

@media (prefers-color-scheme: dark) {
  .method { border-color: transparent; }
}

.endpoint-path { font-size: 0.875rem; color: var(--text); margin-right: auto; }
.endpoint-summary { margin: 0.5rem 0 0; color: var(--text-muted); font-size: 0.875rem; }

.endpoint .copy {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-muted);
}

.endpoint .copy:hover { background: var(--raised); color: var(--text); }
.endpoint .copy.is-copied { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.live-dot-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4375rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.live-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #28c840;
  box-shadow: 0 0 0 3px rgb(40 200 64 / 0.18);
}

.notes { color: var(--text-soft); padding-left: 1.125rem; max-width: 42rem; }
.notes li { margin-bottom: 0.4375rem; }

/* --------------------------------------------------------------------------
   Download
   -------------------------------------------------------------------------- */

.download { margin: 2rem 0 1rem; }
.download-meta { margin: 0.75rem 0 0; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.requirement { color: var(--text-muted); }
.cross-links { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.5rem; }

/* --------------------------------------------------------------------------
   Notices
   -------------------------------------------------------------------------- */

.notice {
  border-radius: var(--radius);
  padding: 1.125rem;
  border: 1px solid var(--border);
  background: var(--surface);
  max-width: 42rem;
  margin-inline: auto;
}

.notice p:last-child { margin-bottom: 0; }
.notice-empty { text-align: center; color: var(--text-muted); border-style: dashed; }
.notice-quiet { text-align: center; }

.notice-error {
  background: var(--accent-wash);
  border-color: var(--orange-200);
  color: var(--orange-800);
}

@media (prefers-color-scheme: dark) {
  .notice-error { border-color: var(--orange-800); color: var(--orange-200); }
}

.error-page { text-align: center; padding-top: 5rem; }
.error-page .lede { margin: 0 auto 2rem; }
.error-page .eyebrow { justify-content: center; font-size: 3rem; letter-spacing: -0.02em; }

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

.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-inner p { margin: 0; }
.footer-links { display: flex; gap: 1.125rem; list-style: none; margin: 0; padding: 0; }
.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--accent); }

/* --------------------------------------------------------------------------
   Narrow screens
   -------------------------------------------------------------------------- */

@media (max-width: 40rem) {
  :root { --strip-h: 6.75rem; }

  .nav { padding-block: 0.625rem; }
  .nav-links { gap: 1rem; }
  .brand-name { display: none; }
  .hero { padding-top: 3rem; }
  .stop { width: 7.25rem; }
  .project-count { position: static; display: block; margin-bottom: 0.25rem; }
}
