/* abdelrahmanibrahim.com: the home page, /anki/ and the 404 page.
   (The AMMSA 2026 paper has its own stylesheet and doesn't use this.)

   The look follows AIbrahimv2's Anki add-ons (anki-addon-kit's tokens.css):
   the system font, neutral greys from Anki's own light and dark themes, a
   blue accent, soft rounded panels and quiet shadows. Light and dark follow
   the system setting. */

:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --text: #020202;
  /* The kit's #737373 is a little light for small text on #f5f5f5 (4.3:1);
     this is 4.7:1. */
  --text-2: #6b6b6b;
  --text-3: #a3a3a3;
  --ink: #0a0a0a;
  --accent: #2563eb;
  --accent-soft: color-mix(in srgb, var(--accent) 11%, transparent);
  --good: #16a34a;

  --line: color-mix(in srgb, var(--ink) 9%, transparent);
  --line-strong: color-mix(in srgb, var(--ink) 15%, transparent);
  --hover: color-mix(in srgb, var(--ink) 4.5%, transparent);
  --sunken: color-mix(in srgb, var(--ink) 3.5%, var(--surface));
  --focus: color-mix(in srgb, #3b82f6 60%, transparent);

  --radius: 14px;
  --radius-md: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 2px 12px rgb(0 0 0 / 0.04);
  --shadow-pop: 0 1px 2px rgb(0 0 0 / 0.06), 0 12px 32px -6px rgb(0 0 0 / 0.16);
  --shot-edge: rgb(0 0 0 / 0.10);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --page: 1000px;
  --gutter: 24px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #2c2c2c;
    --surface: #363636;
    --text: #fcfcfc;
    /* Mixed from the text and panel colours, as in the kit, so small text
       stays readable on the panels. */
    --text-2: color-mix(in srgb, var(--text) 74%, var(--surface));
    --text-3: color-mix(in srgb, var(--text) 52%, var(--surface));
    --ink: #ffffff;
    --accent: #60a5fa;
    --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
    --good: #4ade80;
    --line: rgb(255 255 255 / 0.08);
    --line-strong: rgb(255 255 255 / 0.14);
    --hover: rgb(255 255 255 / 0.05);
    --sunken: rgb(0 0 0 / 0.16);
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3);
    --shadow-pop: 0 0 0 1px rgb(255 255 255 / 0.06), 0 16px 40px -8px rgb(0 0 0 / 0.6);
    --shot-edge: rgb(255 255 255 / 0.08);
  }
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

img { display: block; max-width: 100%; height: auto; }

.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.page {
  width: min(100% - 2 * var(--gutter), var(--page));
  margin: 0 auto;
}
.page.narrow { --page: 720px; }

svg.i { width: 16px; height: 16px; flex: none; }

/* ---------- Top bar ---------- */

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 64px;
}
.brand {
  color: var(--text);
  font-weight: 650; font-size: 15px; letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; color: var(--text); }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 10px; border-radius: 8px;
  color: var(--text-2); font-size: 14.5px; font-weight: 500;
  transition: background 0.12s, color 0.12s;
}
.nav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--text); }
.nav .icon-link { width: 32px; padding: 0; justify-content: center; }
.nav .icon-link svg { width: 17px; height: 17px; }

/* ---------- Page heads ---------- */

.hero { padding: 64px 0 40px; }
.hero h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 46px; line-height: 1.08; font-weight: 700; letter-spacing: -0.03em;
  text-wrap: balance;
}
.lede {
  margin: 16px 0 0;
  max-width: 34em;
  font-size: 19px; line-height: 1.5; color: var(--text-2);
  text-wrap: pretty;
}
.affil { margin: 10px 0 0; font-size: 15px; color: var(--text-3); }

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

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px; border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text);
  font: 600 14.5px/1 var(--font);
  white-space: nowrap;
  transition: background 0.12s, opacity 0.12s, border-color 0.12s;
}
.btn:hover { background: color-mix(in srgb, var(--ink) 4%, var(--surface)); text-decoration: none; }
.btn:active { background: color-mix(in srgb, var(--ink) 8%, var(--surface)); }
.btn.primary { background: var(--text); color: var(--surface); border-color: transparent; }
.btn.primary:hover { opacity: 0.86; }
.btn .i-arrow { width: 14px; height: 14px; opacity: 0.7; }

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

.section { margin: 0 0 48px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  margin: 0 0 14px;
}
.section-head h2 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: -0.01em; }
.section-head a { font-size: 14.5px; font-weight: 500; white-space: nowrap; }

/* An add-on's emoji, just before its name. */
.emoji { margin-right: 0.3em; }

/* "macOS only", after the name of an add-on that only works on a Mac. */
.badge {
  display: inline-block;
  margin-left: 0.15em; padding: 3px 9px 4px;
  border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font: 650 12.5px/1.2 var(--font); letter-spacing: 0;
  vertical-align: 0.2em;
  white-space: nowrap;
}
.tile .badge { margin-left: 0.1em; padding: 2px 8px 3px; font-size: 12px; vertical-align: 0.1em; }

/* The add-ons on the home page, as panels you can click. */
.tiles {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.tile {
  display: flex; align-items: center; gap: 14px;
  height: 100%;
  padding: 14px 16px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.tile:hover {
  text-decoration: none;
  border-color: var(--line-strong);
  box-shadow: var(--shadow-pop);
  transform: translateY(-1px);
}
/* With an odd number of add-ons, AnkiGlass, the most used, takes the top row
   on its own, so Stepwise and Skim stay side by side under it. */
.tiles .wide { grid-column: 1 / -1; }
.tile b { display: block; font-size: 15.5px; font-weight: 650; line-height: 1.3; }
.tile small { display: block; margin-top: 2px; font-size: 14px; line-height: 1.4; color: var(--text-2); }

/* Ownus: one wider panel, with its mark (no tile behind it). */
.tile.feature { gap: 16px; padding: 18px 20px; }
.tile.feature .mark { flex: none; width: 40px; height: 40px; }
.tile.feature b { font-size: 16.5px; }
.tile.feature small { font-size: 14.5px; }


/* ---------- Anki add-ons ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 26px 0 0; padding: 0; list-style: none; }
.chips a {
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 14px 0 11px; border-radius: 999px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line);
  font-size: 14.5px; font-weight: 550;
  transition: border-color 0.12s, background 0.12s;
}
.chips a:hover { text-decoration: none; border-color: var(--line-strong); }
.chips span { font-size: 17px; line-height: 1; }

.addons { display: grid; gap: 20px; margin: 0 0 56px; }

.addon {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow);
  scroll-margin-top: 20px;
  overflow: hidden;
}
/* A wide screenshot goes under the text. Above it, the name and the pitch on
   the left, and the install panel on the right, as tall as they are, with
   its code and links centred in it. */
.addon.wide { grid-template-columns: minmax(0, 1fr); }
.addon.wide .addon-text {
  display: grid; column-gap: 32px;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  grid-template-rows: auto 1fr;
}
.addon.wide .addon-head, .addon.wide .pitch { grid-column: 1; }
.addon.wide .install {
  grid-column: 2; grid-row: 1 / span 2; margin: 0;
  display: flex; flex-direction: column; justify-content: center;
}
.addon.wide .addon-shot { padding: 0 14px 14px; }

.addon-text { padding: 28px 28px 26px; display: flex; flex-direction: column; }
.addon h2 { margin: 0; font-size: 22px; line-height: 1.2; font-weight: 700; letter-spacing: -0.015em; }
.tagline { margin: 3px 0 0; font-size: 14.5px; line-height: 1.35; color: var(--text-2); }
.pitch { margin: 18px 0 0; font-size: 16px; line-height: 1.55; text-wrap: pretty; }
/* Beside a screenshot, the install panel sits at the bottom of the text. */
.addon:not(.wide) .pitch { margin-bottom: 22px; }
.addon:not(.wide) .install { margin-top: auto; }

.install {
  margin: 20px 0 0;
  padding: 16px;
  background: var(--sunken);
  border-radius: 12px;
}
.install p { margin: 10px 0 0; font-size: 14px; line-height: 1.5; color: var(--text-2); }
.install b { color: var(--text); font-weight: 600; white-space: nowrap; }

/* The code, which copies itself when pressed. Without JavaScript it's just
   the code. */
.code {
  appearance: none; -webkit-appearance: none;
  display: inline-flex; align-items: center; gap: 10px;
  margin: 0; padding: 0 10px 0 13px; height: 40px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-md);
  background: var(--surface); color: var(--text);
  font: 600 18px/1 var(--mono); letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.code-state {
  display: none; align-items: center; gap: 5px;
  padding-left: 10px; border-left: 1px solid var(--line);
  font: 600 13px/1 var(--font); letter-spacing: 0; color: var(--text-2);
}
.code-state svg { width: 15px; height: 15px; }
.code-state > span { display: inline-flex; align-items: center; gap: 5px; }
.code-state > .done { display: none; }
.js .code { cursor: pointer; }
.js .code-state { display: inline-flex; }
.js .code:hover { border-color: var(--text-3); }
.js .code:hover .code-state { color: var(--text); }
.code.copied, .code.copied:hover { border-color: color-mix(in srgb, var(--good) 55%, transparent); }
.code.copied .code-state { color: var(--good); }
.code.copied .code-state > .copy { display: none; }
.code.copied .code-state > .done { display: inline-flex; }

.install .links {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 16px 0 0; padding-top: 16px;
  border-top: 1px solid var(--line);
}

.addon-shot { margin: 0; padding: 14px 14px 14px 0; align-self: center; }
.addon-shot img {
  width: 100%;
  border-radius: 12px;
  background: #15161c;
  box-shadow: 0 0 0 1px var(--shot-edge);
}
.addon-shot figcaption { margin: 10px 4px 0; font-size: 13.5px; line-height: 1.45; color: var(--text-2); }
.addon-shot kbd {
  padding: 1px 6px; border-radius: 5px;
  border: 1px solid var(--line-strong); background: var(--surface);
  font: 600 12.5px/1.4 var(--mono); color: var(--text);
}

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

.foot {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 40px 0 56px;
  border-top: 1px solid var(--line);
  font-size: 14px; color: var(--text-2); text-align: center;
}
.foot p { margin: 0; }
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; }
.foot-links a { color: var(--text-2); white-space: nowrap; }
.foot-links a:hover { color: var(--text); }

/* The signature, as at the end of the add-ons' About tab: it writes itself on
   when it comes into view (site.js), or is simply there. */
.sig { width: 168px; height: auto; color: var(--text); }
.sig-wait .sig path { stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0; }

/* ---------- Narrower screens ---------- */

@media (max-width: 899px) {
  .addon, .addon.wide { grid-template-columns: minmax(0, 1fr); }
  .addon.wide .addon-text { display: flex; }
  .addon.wide .install { margin-top: 20px; }
  .addon:not(.wide) .pitch { margin-bottom: 0; }
  .addon:not(.wide) .install { margin-top: 20px; }
  .addon-shot, .addon.wide .addon-shot { padding: 0 14px 14px; }
}

@media (max-width: 640px) {
  :root { --gutter: 18px; }
  .top { height: 56px; }
  .nav .icon-link { display: none; }
  .nav a { padding: 0 8px; }
  .hero { padding: 40px 0 28px; }
  .hero h1 { font-size: 36px; }
  .lede { font-size: 17.5px; }
  .tiles { grid-template-columns: 1fr; }
  .section { margin-bottom: 40px; }
  .addons { gap: 14px; }
  .addon { border-radius: 16px; }
  .addon-text { padding: 22px 18px 20px; }
  .addon h2 { font-size: 21px; }
  .install { padding: 14px; }
  .addon-shot, .addon.wide .addon-shot { padding: 0 10px 10px; }
  .addon-shot img { border-radius: 9px; }
  .links .btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
