/* ==========================================================================
   aricohen.org – single stylesheet
   Mobile-first: base styles are for small screens; the @media (min-width)
   blocks near the bottom adjust the layout for wider screens.
   To change the look, start with the colour and size tokens in :root.
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  /* Light theme (default). All text colours meet WCAG AA on their background. */
  --bg: #ffffff;
  --text: #17202e;        /* ~15:1 on white */
  --muted: #4b5567;       /* ~7.5:1 on white – meta lines, dates */
  --accent: #1d4ed8;      /* blue-700, ~8.3:1 on white – links, buttons */
  --accent-hover: #1e40af;
  --accent-contrast: #ffffff; /* text on accent-filled buttons */
  --accent-soft: #eef2fd; /* chip / highlight tint */
  --accent-soft-text: #1e40af; /* text on --accent-soft, ~8.7:1 */
  --amber: #b45309;       /* warm highlight for kickers and rules, AA on white */
  --border: #e2e6ee;
  --surface: #f4f6fc;     /* tinted section background */
  --card-shadow: 0 1px 2px rgb(23 32 46 / 0.06), 0 4px 14px rgb(23 32 46 / 0.06);
  --card-shadow-hover: 0 2px 4px rgb(23 32 46 / 0.08), 0 10px 28px rgb(29 78 216 / 0.14);
  --focus: #1d4ed8;

  /* Hero gradient band */
  --hero-from: #172554;
  --hero-via: #1e40af;
  --hero-to: #2563eb;
  --hero-text: #ffffff;
  --hero-muted: #c7d6fb;  /* ~7.6:1 on --hero-via */

  /* Footer band */
  --footer-bg: #101c3a;
  --footer-text: #dbe4f5;
  --footer-muted: #9fb0d0;
  --footer-link: #9dbcff;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --max-width: 46rem;     /* ~736px reading column */
  --gutter: 1.25rem;
  --radius: 10px;
}

/* Dark theme follows the visitor's OS setting. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10151c;
    --text: #e7e9ec;
    --muted: #a6aeba;     /* ~8:1 on --bg */
    --accent: #93b4ff;    /* ~8.9:1 on --bg */
    --accent-hover: #bcd0ff;
    --accent-contrast: #0c1424;
    --accent-soft: #1a2440;
    --accent-soft-text: #a9c2ff; /* ~8:1 on --accent-soft */
    --amber: #f0b35c;     /* ~8.5:1 on --bg */
    --border: #2b3340;
    --surface: #151b26;
    --card-shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 4px 14px rgb(0 0 0 / 0.3);
    --card-shadow-hover: 0 2px 4px rgb(0 0 0 / 0.4), 0 10px 28px rgb(147 180 255 / 0.12);
    --focus: #93b4ff;

    --hero-from: #0d1734;
    --hero-via: #14255c;
    --hero-to: #1d3a8f;
    --hero-text: #f2f5fc;
    --hero-muted: #b9c9f2;

    --footer-bg: #0b1120;
    --footer-text: #d5deee;
    --footer-muted: #93a3c2;
    --footer-link: #9dbcff;
  }
}

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

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

/* Respect users who ask for less motion (disables smooth scrolling). */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;   /* 17px */
  line-height: 1.6;
}

h1, h2, h3 {
  line-height: 1.25;
  margin: 0;
  font-weight: 650;
}

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }

/* Visible keyboard focus for every interactive element. */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Offset anchor jumps so headings aren't flush with the top edge. */
section[id], footer[id] { scroll-margin-top: 1rem; }

/* ---------- Utilities ---------- */
.container {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Hidden visually but still read by screen readers. */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* "Skip to content" link: hidden until focused with the keyboard. */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 10;
  padding: 0.5rem 0.9rem;
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 1rem; color: var(--accent-contrast); }

/* Small tinted label used for tech stacks and skill lists. */
.chip {
  display: inline-block;
  padding: 0.08rem 0.55rem 0.14rem;
  margin-block: 0.1rem;
  background: var(--accent-soft);
  color: var(--accent-soft-text);
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0.75rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
  font-size: 0.9375rem;
}

.nav-list a {
  display: inline-block;
  padding: 0.3rem 0;      /* larger tap target without visual bulk */
  color: var(--muted);
  text-decoration: none;
}
.nav-list a:hover { color: var(--accent); text-decoration: underline; }

/* ---------- Sections ---------- */
main > section {
  padding-block: 2.5rem;
}
main > section:not(.hero) {
  border-top: 1px solid var(--border);
}

/* Alternate tinted bands give the page rhythm without adding noise. */
main > section:nth-of-type(odd):not(.hero) {
  background: var(--surface);
  /* Stretch the tint to the viewport edges while keeping the column width. */
  box-shadow: 0 0 0 100vmax var(--surface);
  clip-path: inset(0 -100vmax);
}

h2 {
  font-size: 1.375rem;
  margin-bottom: 1.25rem;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Accent tick before each section heading. */
h2::before {
  content: "";
  width: 0.55rem;
  height: 1.3rem;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent), var(--amber));
  flex-shrink: 0;
}

h3 { font-size: 1.0625rem; }

.meta {
  color: var(--muted);
  font-size: 0.9375rem;
  margin: 0.4rem 0 0.6rem;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding-block: 3.5rem 3rem;
  color: var(--hero-text);
  isolation: isolate;
}

/* Full-bleed gradient band behind the hero content. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0 calc(50% - 50vw);
  z-index: -2;
  background:
    radial-gradient(60rem 30rem at 85% -10%, rgb(255 255 255 / 0.14), transparent 60%),
    linear-gradient(128deg, var(--hero-from) 0%, var(--hero-via) 55%, var(--hero-to) 100%);
}

.hero h1 {
  font-size: 2.5rem;
  letter-spacing: -0.02em;
}

.tagline {
  font-size: 1.1875rem;
  font-weight: 600;
  color: var(--hero-muted);
  margin: 0.5rem 0 1.25rem;
}

.lead { max-width: 38rem; color: var(--hero-text); }

.actions {
  list-style: none;
  margin: 1.75rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.button {
  display: inline-block;
  padding: 0.6rem 1.05rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9688rem;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.button:hover {
  background: var(--accent);
  color: var(--accent-contrast);
  text-decoration: none;
}

.button-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}
.button-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* Hero buttons read against the dark gradient. */
.hero .button {
  border-color: rgb(255 255 255 / 0.55);
  color: var(--hero-text);
}
.hero .button:hover {
  background: rgb(255 255 255 / 0.14);
  color: var(--hero-text);
}
.hero .button-primary {
  background: #ffffff;
  border-color: #ffffff;
  color: var(--hero-via);
}
.hero .button-primary:hover {
  background: #dbe6ff;
  border-color: #dbe6ff;
  color: var(--hero-from);
}

.file-type { font-weight: 400; }

/* ---------- Projects ---------- */
.project {
  position: relative;
  padding: 1.15rem 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.project::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: var(--radius) 0 0 var(--radius);
  background: linear-gradient(180deg, var(--accent), var(--amber));
  opacity: 0;
  transition: opacity 0.18s ease;
}
.project:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
}
.project:hover::before { opacity: 1; }

.project + .project { margin-top: 0.9rem; }

.project h3 { font-size: 1.125rem; letter-spacing: -0.005em; }

.project-links {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
}
.project-links a { display: inline-block; padding: 0.2rem 0; }

.plain-list {
  margin: 0;
  padding-left: 1.1rem;
}
.plain-list li + li { margin-top: 0.35rem; }

/* ---------- Experience / education entries ---------- */
.entry + .entry { margin-top: 1.6rem; }

.entry-head {
  display: flex;
  flex-direction: column;  /* stacked on phones; side by side on wider screens */
  gap: 0.1rem;
  margin-bottom: 0.4rem;
}

/* Organisation shown on its own line under the role/institution. */
.org {
  display: block;
  font-weight: 400;
  color: var(--muted);
  font-size: 0.9688rem;
  margin-top: 0.1rem;
}

.dates {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}

/* Entries with no body text (e.g. an award) need no gap below the heading. */
.entry-head:last-child { margin-bottom: 0; }

/* ---------- Skills ---------- */
.skills { margin: 0; }
.skills div + div { margin-top: 0.9rem; }
.skills dt { font-weight: 600; }
.skills dd { margin: 0.1rem 0 0; }

/* ---------- Footer / contact ---------- */
.site-footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  padding-block: 2.5rem 2rem;
}
.site-footer h2 { color: var(--footer-text); }
.site-footer a { color: var(--footer-link); }
.site-footer a:hover { color: var(--footer-text); }

.contact-list {
  list-style: none;
  margin: 1.25rem 0 1.5rem;
  padding: 0;
}
.contact-list li { padding-block: 0.3rem; overflow-wrap: anywhere; }

.contact-label {
  display: inline-block;
  min-width: 5.5rem;
  color: var(--footer-muted);
  font-size: 0.9375rem;
}

.aside { font-size: 0.9375rem; color: var(--footer-muted); }
.copyright {
  margin-top: 1.5rem;
  font-size: 0.875rem;
  color: var(--footer-muted);
}

/* ---------- Wider screens ---------- */
@media (min-width: 40rem) {
  :root { --gutter: 2rem; }

  .hero { padding-block: 5.5rem 4.5rem; }
  .hero h1 { font-size: 3.25rem; }

  main > section { padding-block: 3rem; }

  /* Put dates on the right of the role/institution. */
  .entry-head {
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
    gap: 1.5rem;
  }
  .dates { white-space: nowrap; flex-shrink: 0; }

  /* Skills as a two-column label/value grid. */
  .skills div {
    display: grid;
    grid-template-columns: 12.5rem 1fr;
    gap: 1rem;
  }
  .skills dd { margin: 0; }
}

/* ---------- Print: a clean, link-free printout ---------- */
@media print {
  .site-header, .skip-link, .actions { display: none; }
  body { font-size: 11pt; color: #000; background: #fff; }
  a { color: #000; }
  main > section:nth-of-type(odd):not(.hero) { background: none; box-shadow: none; }
  .hero { color: #000; }
  .hero::before { display: none; }
  .tagline, .lead { color: #000; }
  .project { border-color: #bbb; box-shadow: none; break-inside: avoid; }
  .project::before { display: none; }
  .chip { border: 1px solid #999; background: none; color: #000; }
  .site-footer { background: none; color: #000; }
  .site-footer h2, .site-footer a { color: #000; }
  .contact-label, .copyright, .aside { color: #333; }
}
