/*
  style.css — how the site looks.

  How dark mode works:
  1. The colours are stored in "variables" (the lines starting with --) on :root.
  2. If the device is set to dark mode and the visitor has not chosen, the
     @media (prefers-color-scheme: dark) block swaps in dark colours.
  3. If the visitor pressed the button, script.js sets data-theme="light" or
     data-theme="dark" on the <html> tag, and that choice wins.
*/

/* ---------- 1. Colours and sizes (light mode is the default) ---------- */
:root {
  --bg: #ffffff;            /* page background */
  --surface: #f5f5f7;       /* cards and the header strip */
  --text: #1d1d1f;          /* main text, near-black */
  --muted: #5f5f64;         /* secondary text, grey (4.9:1 contrast on the card colour) */
  --line: #d2d2d7;          /* thin borders */
  --accent: #0066cc;        /* links (Apple-style blue, darker so it passes contrast on grey cards) */
  --button: #0071e3;        /* filled buttons */
  --button-text: #ffffff;
  --ill: #8e8e93;           /* grey lines in the drawings */
  --ill-accent: #0071e3;    /* blue lines in the drawings */
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
  --radius: 20px;
  --max: 980px;             /* widest the content gets */
  color-scheme: light;
}

/* Dark colours, used when the device is in dark mode and no choice was saved */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --surface: #1c1c1e;
    --text: #f5f5f7;
    --muted: #a1a1a6;
    --line: #38383a;
    --accent: #2997ff;
    --button: #0071e3;
    --button-text: #ffffff;
    --ill: #8e8e93;
    --ill-accent: #2997ff;
    --shadow: none;
    color-scheme: dark;
  }
}

/* Dark colours, used when the visitor pressed the button for dark mode */
:root[data-theme="dark"] {
  --bg: #000000;
  --surface: #1c1c1e;
  --text: #f5f5f7;
  --muted: #a1a1a6;
  --line: #38383a;
  --accent: #2997ff;
  --button: #0071e3;
  --button-text: #ffffff;
  --ill: #8e8e93;
  --ill-accent: #2997ff;
  --shadow: none;
  color-scheme: dark;
}

/* ---------- 2. Basics ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 72px; } /* leaves room for the sticky header */

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  /* The system font: San Francisco on Apple devices, Segoe UI on Windows */
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

/* A clear outline when someone moves through the page with the Tab key */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* Text that screen readers say but sighted visitors don't see */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* The "Skip to content" link only appears when it gets keyboard focus */
.skip-link { position: absolute; left: 12px; top: -48px; padding: 8px 14px; background: var(--button); color: var(--button-text); border-radius: 8px; z-index: 20; }
.skip-link:focus { top: 12px; }

/* ---------- 3. Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  /* Slightly see-through with a blur, like Apple's top bar */
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: var(--max); margin: 0 auto; padding: 12px 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { color: var(--text); font-weight: 600; font-size: 17px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
nav { display: flex; align-items: center; gap: 20px; }
nav a { color: var(--text); font-size: 14px; }

/* The round light/dark button */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: transparent; color: var(--text);
  cursor: pointer;
}
.theme-toggle:hover { background: var(--surface); }
/* Show the moon in light mode, the sun in dark mode */
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

/* ---------- 4. Sections ---------- */
main { max-width: var(--max); margin: 0 auto; padding: 0 22px; }
section { padding: 72px 0 0; }

h1, h2, h3 { letter-spacing: -0.02em; line-height: 1.1; margin: 0; }
h2 { font-size: 40px; margin-bottom: 28px; }
h3 { font-size: 24px; line-height: 1.2; margin-bottom: 14px; }

/* Intro */
.intro { padding-top: 96px; padding-bottom: 8px; }
.intro-name { color: var(--muted); font-size: 21px; font-weight: 600; margin: 0 0 10px; }
.intro h1 { font-size: 64px; max-width: 14ch; }
.intro-sub { color: var(--muted); font-size: 21px; max-width: 36em; margin: 22px 0 32px; }
.intro-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* Buttons (pill shaped, like Apple's) */
.button {
  display: inline-block; padding: 10px 20px; border-radius: 980px;
  font-size: 15px; font-weight: 500; line-height: 1.3;
}
.button:hover { text-decoration: none; }
.button-primary { background: var(--button); color: var(--button-text); }
.button-primary:hover { filter: brightness(1.08); }
.button-secondary { color: var(--accent); border: 1px solid var(--accent); }
.button-secondary:hover { background: var(--bg); }

/* ---------- 5. Project cards ---------- */
.card {
  display: grid;
  grid-template-columns: 220px 1fr;   /* drawing on the left, text on the right */
  gap: 36px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
  margin-bottom: 24px;
}
.card-art svg { width: 100%; height: auto; display: block; }
.card-body p { margin: 0 0 12px; }
.card-body strong { font-weight: 600; }
.card-note { color: var(--muted); font-size: 15px; margin-top: 18px !important; }
.card-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* Drawing styles: grey lines, blue lines, and a fill that matches the card */
.card-art .ill-line   { fill: none; stroke: var(--ill); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.card-art .ill-accent { fill: none; stroke: var(--ill-accent); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.card-art .ill-fill   { fill: var(--surface); }
.card-art .ill-dash   { stroke-dasharray: 4 6; }
.card-art .ill-thick  { stroke-width: 7; }
.card-art .ill-dot    { fill: var(--ill-accent); }
.card-art .ill-dot-grey { fill: var(--ill); }

/* About and contact */
.about p { font-size: 21px; max-width: 36em; margin: 0; }
.contact-list { list-style: none; padding: 0; margin: 0; font-size: 19px; }
.contact-list li { padding: 14px 0; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 4px 24px; }
.contact-list li:last-child { border-bottom: 1px solid var(--line); }
.contact-label { color: var(--muted); min-width: 90px; }

/* ---------- 6. Footer ---------- */
.site-footer {
  max-width: var(--max); margin: 96px auto 0; padding: 24px 22px 48px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 13px;
}
.site-footer p { margin: 0 0 6px; }

/* ---------- 7. Fade-in effect ---------- */
/* Only hide cards when JavaScript is running, so the page still works without it */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s ease, transform 0.7s ease; }
.js .reveal.is-visible { opacity: 1; transform: none; }
/* Visitors who asked their device for less motion get no animation */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- 8. Phones and small tablets ---------- */
@media (max-width: 760px) {
  .intro { padding-top: 64px; }
  .intro h1 { font-size: 44px; }
  .intro-sub { font-size: 19px; }
  h2 { font-size: 32px; }
  h3 { font-size: 21px; }
  .card { grid-template-columns: 1fr; gap: 20px; padding: 26px 22px; }  /* drawing above the text */
  .card-art { max-width: 220px; }
  section { padding-top: 56px; }
}
@media (max-width: 420px) {
  .header-inner { padding: 10px 16px; }
  nav { gap: 12px; }
  nav a { font-size: 13px; }
  .brand { font-size: 15px; }
  main { padding: 0 16px; }
  .intro h1 { font-size: 38px; }
}
