/* ==========================================================================
   Mike Noel — site styles
   1. Tokens (color, type, spacing)
   2. Base
   3. Layout
   4. Header, nav, footer
   5. Components
   6. Page sections
   ========================================================================== */

/* 1. Tokens
   -------------------------------------------------------------------------- */
:root {
  color-scheme: light;

  /* Color — light theme */
  --bg: #fafaf8;
  --surface: #ffffff;
  --text: #1b1d20;
  --muted: #535960;
  --border: #e2e2dd;
  --accent: #0a6b61;
  --accent-hover: #07524a;
  --accent-soft: #e3f2ef;
  --on-accent: #ffffff;
  --focus: #0a6b61;
  --todo-bg: #fff4d6;
  --todo-text: #5c4300;

  /* Type */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.5rem;
  --step-3: clamp(1.75rem, 1.4rem + 1.5vw, 2.25rem);
  --step-4: clamp(2.1rem, 1.6rem + 2.6vw, 3.25rem);

  /* Space */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;

  --radius: 10px;
  --measure: 42rem;
  --wide: 68rem;
}

/* Dark theme: follows the system unless the visitor picked light */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121416;
    --surface: #1a1d21;
    --text: #e8e9eb;
    --muted: #a7adb4;
    --border: #2d3238;
    --accent: #5ccab9;
    --accent-hover: #86dccf;
    --accent-soft: #173431;
    --on-accent: #0b1f1c;
    --focus: #86dccf;
    --todo-bg: #3a2f10;
    --todo-text: #f5dc9a;
  }
}

/* Dark theme: chosen with the toggle */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121416;
  --surface: #1a1d21;
  --text: #e8e9eb;
  --muted: #a7adb4;
  --border: #2d3238;
  --accent: #5ccab9;
  --accent-hover: #86dccf;
  --accent-soft: #173431;
  --on-accent: #0b1f1c;
  --focus: #86dccf;
  --todo-bg: #3a2f10;
  --todo-text: #f5dc9a;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Keep anchor targets (#contact, #main) and focused elements clear of the sticky header */
  scroll-padding-top: 7rem;
}

@media (min-width: 40em) {
  html {
    scroll-padding-top: 5.5rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

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

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 var(--space-4);
  text-wrap: balance;
}

h1 {
  font-size: var(--step-4);
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--step-3);
  letter-spacing: -0.01em;
}

h3 {
  font-size: var(--step-1);
}

p,
ul,
ol {
  margin: 0 0 var(--space-4);
}

ul,
ol {
  padding-left: 1.25rem;
}

li + li {
  margin-top: var(--space-2);
}

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

a:hover {
  color: var(--accent-hover);
  text-decoration-thickness: 2px;
}

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

img,
svg {
  max-width: 100%;
  height: auto;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* 3. Layout
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--wide);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

@media (min-width: 40em) {
  .container {
    padding-inline: var(--space-6);
  }
}

.prose {
  max-width: var(--measure);
}

main {
  flex: 1;
}

.section {
  padding-block: var(--space-7);
}

.section + .section {
  border-top: 1px solid var(--border);
}

.section-intro {
  color: var(--muted);
  max-width: var(--measure);
  margin-bottom: var(--space-6);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* 4. Header, nav, footer
   -------------------------------------------------------------------------- */
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -10rem;
  z-index: 10;
  padding: var(--space-2) var(--space-4);
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius);
  font-weight: 600;
}

.skip-link:focus {
  top: var(--space-4);
  color: var(--on-accent);
}

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

.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  padding-block: var(--space-3);
}

.site-name {
  font-weight: 700;
  font-size: var(--step-1);
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

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

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav li + li {
  margin-top: 0;
}

.site-nav a {
  display: inline-block;
  padding-block: var(--space-2);
  color: var(--muted);
  text-decoration: none;
  font-size: var(--step--1);
  font-weight: 500;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
}

.site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.4em;
}

.theme-toggle {
  display: none;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-left: var(--space-2);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.js .theme-toggle {
  display: inline-grid;
}

.theme-toggle:hover {
  border-color: var(--accent);
}

.theme-toggle svg {
  width: 1.15rem;
  height: 1.15rem;
}

/* Show the icon for the theme you would switch to */
.theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: block;
  }

  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }
}

.site-footer {
  border-top: 1px solid var(--border);
  padding-block: var(--space-6);
  color: var(--muted);
  font-size: var(--step--1);
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-4);
}

.site-footer p {
  margin: 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links li + li {
  margin-top: 0;
}

.footer-links a {
  color: var(--muted);
}

.footer-links a:hover {
  color: var(--accent);
}

/* 5. Components
   -------------------------------------------------------------------------- */
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.875rem;
  padding: var(--space-2) var(--space-5);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
}

.button-primary {
  background: var(--accent);
  color: var(--on-accent);
}

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

.button-secondary {
  background: transparent;
  color: var(--accent);
}

.button-secondary:hover {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

/* Project cards */
.card-grid {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}

.card-grid > li + li {
  margin-top: 0;
}

.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--space-6) var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card h2,
.card h3 {
  font-size: var(--step-2);
  margin-bottom: var(--space-2);
}

.card h2 a,
.card h3 a {
  color: var(--text);
  text-decoration: none;
}

.card h2 a:hover,
.card h3 a:hover {
  color: var(--accent);
}

.card-tagline {
  color: var(--muted);
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  margin-top: auto;
  padding-top: var(--space-5);
  font-weight: 600;
  font-size: var(--step--1);
}

/* Stack tags and status */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  list-style: none;
  margin: 0 0 var(--space-4);
  padding: 0;
}

.tags li + li {
  margin-top: 0;
}

.tags li {
  padding: 0.125rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: var(--step--1);
  color: var(--muted);
  background: var(--bg);
}

.status {
  display: inline-block;
  align-self: flex-start;
  margin-bottom: var(--space-3);
  padding: 0.125rem 0.625rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-size: var(--step--1);
  font-weight: 600;
}

:root[data-theme="dark"] .status {
  color: var(--accent);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .status {
    color: var(--accent);
  }
}

/* "How I work" points */
.points {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: point;
}

.points li + li {
  margin-top: 0;
}

.points li {
  counter-increment: point;
  padding-top: var(--space-4);
  border-top: 3px solid var(--accent);
}

.points h3 {
  margin-bottom: var(--space-2);
}

.points p {
  color: var(--muted);
  margin: 0;
}

/* Experience timeline */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-5);
}

.timeline > li + li {
  margin-top: 0;
}

.timeline > li {
  display: grid;
  gap: var(--space-2) var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
}

.timeline > li:first-child {
  padding-top: 0;
  border-top: 0;
}

@media (min-width: 52em) {
  .timeline > li {
    grid-template-columns: 18rem 1fr;
  }
}

.timeline h3 {
  margin-bottom: var(--space-1);
}

.timeline-meta {
  margin: 0;
  color: var(--muted);
  font-size: var(--step--1);
}

.timeline p:last-child {
  margin-bottom: 0;
  max-width: var(--measure);
}

.section-more {
  margin: var(--space-6) 0 0;
  font-weight: 600;
}

/* Contact list */
.contact-list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-5);
  display: grid;
  gap: var(--space-3);
}

.contact-list li + li {
  margin-top: 0;
}

.contact-list span {
  display: inline-block;
  min-width: 6rem;
  color: var(--muted);
}

/* Placeholder marker for content Mike still needs to supply */
.todo {
  display: inline;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  background: var(--todo-bg);
  color: var(--todo-text);
  font-size: 0.95em;
}

p.todo,
div.todo {
  display: block;
  padding: var(--space-3) var(--space-4);
}

/* 6. Page sections
   -------------------------------------------------------------------------- */
.hero {
  padding-block: var(--space-8) var(--space-7);
}

.hero h1 {
  max-width: 18ch;
}

.hero-name {
  margin-bottom: var(--space-3);
  color: var(--accent);
  font-weight: 600;
  font-size: var(--step-1);
}

.hero-sub {
  max-width: 38rem;
  font-size: var(--step-1);
  color: var(--muted);
  margin: 0;
}

.page-header {
  padding-block: var(--space-8) var(--space-6);
}

.page-header p {
  max-width: var(--measure);
  font-size: var(--step-1);
  color: var(--muted);
}

/* Case study */
.case-header {
  padding-block: var(--space-7) var(--space-6);
  border-bottom: 1px solid var(--border);
}

.breadcrumb {
  margin-bottom: var(--space-4);
  font-size: var(--step--1);
}

.case-header .tagline {
  max-width: var(--measure);
  font-size: var(--step-1);
  color: var(--muted);
}

.case-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  list-style: none;
  margin: 0 0 var(--space-5);
  padding: 0;
  font-weight: 600;
}

.case-links li + li {
  margin-top: 0;
}

.case-body {
  padding-block: var(--space-6) var(--space-7);
}

.case-body section + section {
  margin-top: var(--space-7);
}

.case-links .note {
  font-weight: 400;
  color: var(--muted);
}

.case-body h2 {
  font-size: var(--step-2);
}

.hard-problem {
  margin-top: var(--space-5);
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.hard-problem h3 {
  margin-bottom: var(--space-3);
}

.hard-problem dl {
  margin: 0;
}

.hard-problem dt {
  font-weight: 600;
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.hard-problem dd {
  margin: 0 0 var(--space-3);
}

.hard-problem dd:last-child {
  margin-bottom: 0;
}

.roadmap-note {
  padding: var(--space-3) var(--space-4);
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.case-nav {
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
}

/* Resume */
.resume-section {
  margin-top: var(--space-7);
}

.resume-item {
  margin-top: var(--space-5);
}

.resume-item h3 {
  margin-bottom: var(--space-1);
}

.resume-item ul {
  margin-bottom: var(--space-4);
}

.skills {
  display: grid;
  gap: var(--space-1) var(--space-5);
  margin: 0;
}

.skills dt {
  font-weight: 600;
}

.skills dd {
  margin: 0 0 var(--space-3);
  color: var(--muted);
}

@media (min-width: 40em) {
  .skills {
    grid-template-columns: 11rem 1fr;
  }

  .skills dd {
    margin-bottom: var(--space-2);
  }
}

.resume-meta {
  color: var(--muted);
  font-size: var(--step--1);
  margin-bottom: var(--space-2);
}

.page-end {
  margin-bottom: var(--space-8);
}

.resume-section:first-child {
  margin-top: 0;
}

/* 404 */
.not-found {
  padding-block: var(--space-8);
}

/* Print: clean resume and case studies */
@media print {
  .site-header,
  .site-footer,
  .skip-link,
  .button-row,
  .theme-toggle {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }
}
