/* ==========================================================================
   jevell.acebedo.us — "Runbook" design
   1. Fonts   2. Tokens   3. Base   4. Layout   5. Components   6. Sections
   7. Motion  8. Print
   ========================================================================== */

/* 1. Fonts — self-hosted, Latin subset. Licences: fonts/OFL-*.txt
   ========================================================================== */
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
}

/* 2. Tokens — every colour, size and space used below is defined here, once.
   Colours are light-dark(<light>, <dark>) pairs; which side applies is decided
   by `color-scheme` on <html> (see "Theme" just below).
   Contrast (WCAG) on bg / surface — text 15.9/14.9 · 15.0/13.8,
   muted 6.2/5.8 · 7.4/6.8, accent 6.4/6.0 · 8.1/7.4, status 5.8/5.4 · 8.4/7.7,
   border-strong 3.7/3.4 · 4.3/3.9, on-accent 6.7 · 8.1.
   ========================================================================== */
:root {
  --color-bg:            light-dark(#FAFBFC, #0F1419);
  --color-surface:       light-dark(#F1F4F7, #171D24);
  --color-border:        light-dark(#D5DBE2, #2B343F); /* decorative rules */
  --color-border-strong: light-dark(#7A8491, #6F7B89); /* control outlines */
  --color-text:          light-dark(#16202B, #E3E8ED);
  --color-muted:         light-dark(#55606E, #9AA5B1);
  --color-accent:        light-dark(#0B5CAD, #6CB0F2); /* links, focus, primary button */
  --color-on-accent:     light-dark(#FFFFFF, #0F1419);
  --color-status:        light-dark(#17714A, #4CC38A); /* "current" marker */

  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;

  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-md:   1.125rem;
  --text-lg:   1.375rem;
  --text-xl:   1.75rem;
  --text-2xl:  clamp(2.25rem, 1.6rem + 2.6vw, 3.25rem);

  --leading-tight:  1.2;
  --leading-normal: 1.6;

  --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: 4rem;
  --space-9: 6rem;

  --radius-sm: 3px;
  --radius-md: 6px;

  --measure:  44rem;   /* main column, about 68 characters of body text */
  --page-max: 67.5rem; /* 1080px */
  --sidebar:  13.75rem;
  --gutter:   clamp(1rem, 4vw, 2rem);
  --topbar-h: 3.5rem;

  --dur-fast: 120ms;
}

/* Theme. No attribute = follow the operating system, live. The toggle sets
   data-theme, which pins one side. Works without JavaScript. */
:root                     { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }

/* Browsers from before 2024 without light-dark(): light theme only. */
@supports not (color: light-dark(#000, #fff)) {
  :root {
    --color-bg: #FAFBFC;
    --color-surface: #F1F4F7;
    --color-border: #D5DBE2;
    --color-border-strong: #7A8491;
    --color-text: #16202B;
    --color-muted: #55606E;
    --color-accent: #0B5CAD;
    --color-on-accent: #FFFFFF;
    --color-status: #17714A;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-h) + var(--space-5));
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
h1, h2, h3, h4 { line-height: var(--leading-tight); font-weight: 600; text-wrap: balance; }
ul, ol { padding: 0; }
img { max-width: 100%; height: auto; display: block; }

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

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

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

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -10rem;
  z-index: 20;
  padding: var(--space-2) var(--space-4);
  background: var(--color-accent);
  color: var(--color-on-accent);
  border-radius: var(--radius-md);
  font-weight: 600;
}
.skip-link:focus { top: var(--space-2); outline-offset: 3px; }

/* 4. Layout
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}
.topbar-inner {
  max-width: var(--page-max);
  min-height: var(--topbar-h);
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.brand {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  padding-block: var(--space-2);
}
.brand:hover { text-decoration: underline; }

.page {
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
main { max-width: var(--measure); min-width: 0; }

.sidebar { display: none; }

@media (min-width: 60rem) {
  .page {
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    column-gap: var(--space-8);
  }
  .sidebar {
    display: block;
    position: sticky;
    top: var(--topbar-h);
    align-self: start;
    max-height: calc(100vh - var(--topbar-h));
    overflow-y: auto;
    padding-block: var(--space-8) var(--space-6);
  }
  .menu { display: none; }
}

/* 5. Components
   ========================================================================== */

/* Small monospace label: section numbers, sidebar heading, card badges */
.label,
.toc-title,
.section-title::before,
.card-badge,
.facts dt {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* "On this page" list — shared by the sidebar and the small-screen menu */
.toc-title { margin-bottom: var(--space-3); }
.toc-list { list-style: none; }
.toc-list a {
  display: block;
  padding: 0.3rem var(--space-3);
  border-left: 2px solid var(--color-border);
  color: var(--color-muted);
  font-size: var(--text-sm);
  text-decoration: none;
  transition: color var(--dur-fast), border-color var(--dur-fast);
}
.toc-list a:hover { color: var(--color-text); border-left-color: var(--color-border-strong); }
.toc-list a[aria-current] {
  color: var(--color-text);
  font-weight: 600;
  border-left-color: var(--color-accent);
}
.toc-list .toc-external { margin-top: var(--space-3); }

/* Small-screen menu: a native <details>, so it works without JavaScript */
.menu { position: relative; }
.menu > summary,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 2.25rem;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background-color var(--dur-fast);
}
.menu > summary { list-style: none; user-select: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:hover,
.theme-toggle:hover { background: var(--color-surface); }
.menu[open] > summary { background: var(--color-surface); }
.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + var(--space-2));
  width: min(16rem, calc(100vw - 2 * var(--gutter)));
  padding: var(--space-3);
  background: var(--color-bg);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
}
.menu-panel .toc-list a { padding-block: var(--space-2); }

/* Theme toggle: a real button; aria-pressed="true" means dark is on */
.theme-toggle[hidden] { display: none; }
.toggle-track {
  position: relative;
  width: 1.75rem;
  height: 1rem;
  border: 1px solid var(--color-border-strong);
  border-radius: 1rem;
  flex-shrink: 0;
}
.toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1rem - 6px);
  height: calc(1rem - 6px);
  border-radius: 50%;
  background: var(--color-text);
  transition: transform var(--dur-fast);
}
.theme-toggle[aria-pressed="true"] .toggle-track::after { transform: translateX(0.75rem); }

/* Buttons */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0 var(--space-5);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  transition: background-color var(--dur-fast), border-color var(--dur-fast);
}
.btn:hover { background: var(--color-surface); border-color: var(--color-text); }
.btn-primary {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-on-accent);
}
.btn-primary:hover {
  background: var(--color-accent);
  border-color: var(--color-text);
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

/* Record: one role, project or volunteer post */
.entry + .entry {
  margin-top: var(--space-7);
  padding-top: var(--space-7);
  border-top: 1px solid var(--color-border);
}
.entry-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: var(--space-5);
  row-gap: var(--space-1);
  align-items: baseline;
  margin-bottom: var(--space-4);
}
.entry-title { font-size: var(--text-md); }
.entry-date {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-muted);
  white-space: nowrap;
}
.entry-date.is-current::before {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: var(--space-2);
  border-radius: 50%;
  background: var(--color-status);
}
.entry-org {
  grid-column: 1 / -1;
  color: var(--color-muted);
}
.entry-org .sep { margin-inline: var(--space-1); }
.entry-note {
  margin-top: var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-muted);
}

@media (max-width: 40rem) {
  .entry-head { grid-template-columns: minmax(0, 1fr); }
  .entry-date { grid-row: 3; }
}

.bullets { padding-left: 1.15rem; }
.bullets li { padding-left: var(--space-1); }
.bullets li + li { margin-top: var(--space-2); }
.bullets li::marker { color: var(--color-muted); }

/* Bordered card: contact facts, education */
.card {
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-2) var(--space-5);
  align-items: baseline;
}

/* Skill tags */
.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.tags li {
  padding: 0.2rem 0.55rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.4;
}

/* 6. Sections
   ========================================================================== */
main > section { padding-block: var(--space-8); }
main > section + section { border-top: 1px solid var(--color-border); }

main { counter-reset: section; }
.section-title {
  font-size: var(--text-xl);
  margin-bottom: var(--space-6);
}
.section-title::before {
  counter-increment: section;
  content: counter(section, decimal-leading-zero);
  content: counter(section, decimal-leading-zero) / "";
  display: block;
  margin-bottom: var(--space-2);
}

/* Hero */
#hero { padding-top: var(--space-8); }
.hero-photo {
  width: 7rem;
  height: 7rem;
  margin-bottom: var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  object-fit: cover;
}
.hero-eyebrow { margin-bottom: var(--space-3); }
h1 {
  font-size: var(--text-2xl);
  letter-spacing: -0.015em;
}
.hero-role {
  margin-top: var(--space-3);
  font-size: var(--text-lg);
  line-height: var(--leading-tight);
  color: var(--color-muted);
}
.hero-bio {
  margin-top: var(--space-5);
  font-size: var(--text-md);
}
#hero .btn-row { margin-top: var(--space-6); }

/* About */
.prose p + p { margin-top: var(--space-4); }
.prose strong { font-weight: 600; }
#about .card { margin-top: var(--space-6); }

/* Skills */
.skill-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
}
.skill-group + .skill-group {
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
}
.skill-cat { font-size: var(--text-base); }
.skill-sub + .skill-sub { margin-top: var(--space-5); }
.skill-sub h4 {
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--color-muted);
}
@media (min-width: 40rem) {
  .skill-group {
    grid-template-columns: 11rem minmax(0, 1fr);
    column-gap: var(--space-5);
  }
  .skill-cat { padding-top: 0.2rem; }
}

/* Education */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: var(--space-4);
}
.card-badge { display: block; margin-bottom: var(--space-3); }
.card-title { font-size: var(--text-md); }
.card-org { margin-top: var(--space-1); color: var(--color-muted); }
.card-date {
  margin-top: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-muted);
}

/* Contact */
#contact .lead { margin-bottom: var(--space-6); font-size: var(--text-md); }

/* Footer */
.site-footer {
  margin-top: var(--space-7);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}
.footer-inner {
  max-width: var(--page-max);
  margin-inline: auto;
  padding: var(--space-7) var(--gutter);
}
.footer-name { font-weight: 600; }
.footer-sub { color: var(--color-muted); font-size: var(--text-sm); }
.footer-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  margin-top: var(--space-4);
  font-size: var(--text-sm);
}
.footer-links a { display: inline-block; padding-block: var(--space-1); }
/* Document-control strip: revision and date are stamped by the deploy job */
.docmeta {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-muted);
}

/* 7. Motion — colour and border transitions only, and none if the visitor
   has asked for reduced motion.
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0s !important;
    animation-duration: 0s !important;
  }
}

/* 8. Print — reads as a plain document
   ========================================================================== */
@media print {
  :root { color-scheme: light; }
  .topbar, .sidebar, .skip-link, .btn-row { display: none; }
  .page { display: block; max-width: none; padding: 0; }
  main { max-width: none; }
  main > section { padding-block: var(--space-5); }
  .entry { break-inside: avoid; }
  a { color: inherit; }
}
