/* ============================================================
   Becoming a Bibby — styles
   Aesthetic: deadpan corporate meets letterpress resume.
   Tweak the variables below to re-skin the whole site.
   ============================================================ */

:root {
  --ink:        #1a1a2e;   /* near-black navy text */
  --ink-soft:   #4a4a63;
  --ink-faint:  #6f6f88;
  --paper:      #fbfaf7;   /* warm off-white */
  --paper-2:    #f3f1ea;
  --card:       #ffffff;
  --line:       #e3e0d6;
  --accent:     #b3402f;   /* muted brick red — "stamp" color */
  --accent-2:   #1a1a2e;
  --gold:       #b08d57;

  /* themeable surface tokens (overridden in dark mode below) */
  --bar-bg:     rgba(251,250,247,.82);  /* sticky top bar */
  --cta-bg:     #1a1a2e;                /* apply section bg (stays dark in both modes) */
  --cta-fg:     #fbfaf7;
  --no-bg:      #fbf2f0;                /* "dealbreakers" card */
  --no-border:  #eccfc9;

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans:  "Inter", system-ui, -apple-system, sans-serif;
  --mono:  "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --maxw: 880px;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(26,26,46,.04), 0 12px 32px rgba(26,26,46,.08);
}

/* ---------- Dark theme ----------
   Values live in one custom-property block, applied via two selectors:
   1) system preference is dark AND the user hasn't forced light
   2) the user explicitly chose dark (data-theme="dark")
   Explicit light (data-theme="light") always wins by being excluded from #1. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink:        #ece9e3;
    --ink-soft:   #b3afbe;
    --ink-faint:  #807c92;
    --paper:      #14141f;
    --paper-2:    #1d1d2b;
    --card:       #191923;
    --line:       #2c2c3a;
    --accent:     #e0654f;
    --gold:       #c9a368;
    --bar-bg:     rgba(20,20,31,.82);
    --cta-bg:     #0d0d15;
    --cta-fg:     #ece9e3;
    --no-bg:      #241a1a;
    --no-border:  #3d2a28;
    --shadow:     0 1px 2px rgba(0,0,0,.3), 0 14px 40px rgba(0,0,0,.45);
  }
}
:root[data-theme="dark"] {
  --ink:        #ece9e3;
  --ink-soft:   #b3afbe;
  --ink-faint:  #807c92;
  --paper:      #14141f;
  --paper-2:    #1d1d2b;
  --card:       #191923;
  --line:       #2c2c3a;
  --accent:     #e0654f;
  --gold:       #c9a368;
  --bar-bg:     rgba(20,20,31,.82);
  --cta-bg:     #0d0d15;
  --cta-fg:     #ece9e3;
  --no-bg:      #241a1a;
  --no-border:  #3d2a28;
  --shadow:     0 1px 2px rgba(0,0,0,.3), 0 14px 40px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }

:root { color-scheme: light dark; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 24px; }

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

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-weight: 600;
  font-size: .98rem;
  letter-spacing: .01em;
  padding: 14px 26px;
  border-radius: 999px;
  text-decoration: none;
  border: 1.5px solid var(--ink);
  transition: transform .12s ease, background .2s ease, color .2s ease, box-shadow .2s ease;
  cursor: pointer;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(26,26,46,.22); }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: var(--ink); color: var(--paper); }
.btn--small { padding: 9px 18px; font-size: .85rem; }
.btn--big { font-size: 1.1rem; padding: 18px 38px; background: var(--accent); border-color: var(--accent); }
.btn--big:hover { box-shadow: 0 10px 30px rgba(179,64,47,.35); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--bar-bg);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner { display: flex; align-items: center; gap: 24px; height: 62px; }
.brand { font-family: var(--mono); font-weight: 500; font-size: .95rem; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.brand__dot { color: var(--accent); }
.topnav { display: flex; gap: 22px; margin-left: auto; }
.topnav a { color: var(--ink-soft); text-decoration: none; font-size: .9rem; font-weight: 500; }
.topnav a:hover { color: var(--accent); }

/* Theme toggle */
.theme-toggle {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; margin-left: 10px; padding: 0;
  background: transparent; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 999px;
  cursor: pointer; transition: border-color .2s, color .2s, transform .12s;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.theme-toggle svg { width: 18px; height: 18px; display: block; }
/* Icon reflects the *effective* theme: moon in light mode, sun in dark mode. */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
@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; }
}
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---------- Hero ---------- */
.hero { background:
    radial-gradient(120% 80% at 80% -10%, rgba(176,141,87,.10), transparent 60%),
    linear-gradient(180deg, var(--paper-2), var(--paper));
  border-bottom: 1px solid var(--line);
  padding: 86px 0 72px;
}
.kicker {
  font-family: var(--mono); font-size: .78rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 18px;
}
.kicker--light { color: rgba(255,255,255,.7); }
.hero__title {
  font-family: var(--serif); font-weight: 600; font-size: clamp(3rem, 9vw, 6.2rem);
  line-height: .92; letter-spacing: -.02em; margin: 0;
}
.hero__title-em { font-style: italic; color: var(--accent); font-weight: 500; }
.hero__lede { max-width: 56ch; font-size: 1.18rem; color: var(--ink-soft); margin: 26px 0 32px; }
.hero__lede strong { color: var(--ink); }
.hero__cta { display: flex; flex-wrap: wrap; gap: 14px; }

.hero__stats {
  list-style: none; display: flex; flex-wrap: wrap; gap: 40px;
  margin: 54px 0 0; padding: 28px 0 0; border-top: 1px solid var(--line);
}
.hero__stats li { display: flex; flex-direction: column; }
.stat__num { font-family: var(--serif); font-weight: 600; font-size: 2.4rem; line-height: 1; color: var(--ink); }
.stat__label { font-size: .85rem; color: var(--ink-faint); margin-top: 6px; }

/* ---------- The resume document ---------- */
.doc {
  background: var(--card);
  margin: -40px auto 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 56px 60px 40px;
  position: relative;
}
.doc::before { /* faint "received" stamp vibe */
  content: "RECEIVED"; position: absolute; top: 30px; right: 34px;
  font-family: var(--mono); font-size: .7rem; letter-spacing: .25em;
  color: var(--accent); opacity: .25; border: 1.5px solid var(--accent);
  padding: 4px 10px; border-radius: 4px; transform: rotate(8deg);
}

.resume-head { display: flex; gap: 28px; align-items: center; padding-bottom: 26px; border-bottom: 2px solid var(--ink); }
.resume-head__main { flex: 1; }
.name { font-family: var(--serif); font-size: clamp(2rem, 5vw, 2.9rem); font-weight: 600; margin: 0; letter-spacing: -.02em; }
.title { color: var(--accent); font-weight: 600; margin: 4px 0 14px; }
.contactline { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0; padding: 0; font-size: .9rem; color: var(--ink-soft); }

.resume-head__photo { flex-shrink: 0; }
.resume-head__photo img { width: 110px; height: 130px; object-fit: cover; border-radius: 8px; }

/* Blocks */
.block { padding: 30px 0; border-bottom: 1px solid var(--line); }
.block:last-child { border-bottom: 0; }
.block__h {
  font-family: var(--mono); font-size: .82rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink); margin: 0 0 18px; padding-bottom: 0;
}
.block__sub, .block__h .block__sub { color: var(--ink-faint); text-transform: none; letter-spacing: 0; font-weight: 400; }
.block p { margin: 0 0 12px; color: var(--ink-soft); }
.block p:last-child { margin-bottom: 0; }
.objective { font-family: var(--serif); font-size: 1.22rem; font-style: italic; color: var(--ink) !important; line-height: 1.55; }

/* Skills */
.skills { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 36px; }
.skill__row { display: flex; justify-content: space-between; font-size: .92rem; font-weight: 500; margin-bottom: 6px; }
.skill__pct { font-family: var(--mono); color: var(--accent); }
.bar { height: 8px; background: var(--paper-2); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--gold)); border-radius: 999px; transition: width 1.1s cubic-bezier(.2,.7,.2,1); }
.bar.is-in i { width: var(--w); }
/* Fill widths set here (not inline) so a strict style-src 'self' CSP allows them. */
.bar[data-fill="42"]  { --w: 42%; }
.bar[data-fill="71"]  { --w: 71%; }
.bar[data-fill="88"]  { --w: 88%; }
.bar[data-fill="90"]  { --w: 90%; }
.bar[data-fill="94"]  { --w: 94%; }
.bar[data-fill="100"] { --w: 100%; }
.skills__note { margin-top: 18px !important; font-size: .92rem; }

/* Experience */
.exp-note { font-family: var(--serif); font-style: italic; font-size: 1.08rem; color: var(--ink) !important; margin-bottom: 6px !important; }
.job { padding: 16px 0; }
.job + .job { border-top: 1px dashed var(--line); }
.job__head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.job__title { font-family: var(--serif); font-size: 1.18rem; font-weight: 600; margin: 0; }
.job__co { color: var(--ink-faint); font-weight: 400; font-size: .95rem; font-family: var(--sans); }
.job__date { font-family: var(--mono); font-size: .8rem; color: var(--ink-faint); white-space: nowrap; }
.job__bullets { margin: 10px 0 0; padding-left: 20px; color: var(--ink-soft); }
.job__bullets li { margin-bottom: 5px; }

/* Certs */
.certs { margin: 0; padding-left: 20px; color: var(--ink-soft); }
.certs li { margin-bottom: 8px; }
.certs strong { color: var(--ink); }

/* Requirements */
.reqs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.reqs__col { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 18px 20px; }
.reqs__col h4 { margin: 0 0 10px; font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink); }
.reqs__col ul { margin: 0; padding-left: 18px; font-size: .92rem; color: var(--ink-soft); }
.reqs__col li { margin-bottom: 6px; }
.reqs__col--no { background: var(--no-bg); border-color: var(--no-border); }
.reqs__col--no h4 { color: var(--accent); }

/* Benefits */
.benefits__intro { margin-bottom: 20px !important; }
.benefits { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.benefit { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 20px; transition: transform .15s ease, box-shadow .15s ease; }
.benefit:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.benefit__ic { font-size: 1.6rem; display: block; margin-bottom: 8px; }
.benefit h4 { margin: 0 0 6px; font-size: 1rem; font-family: var(--serif); }
.benefit p { font-size: .9rem; margin: 0; }

/* FAQ */
.faq details { border-bottom: 1px solid var(--line); padding: 4px 0; }
.faq summary { cursor: pointer; font-weight: 600; font-family: var(--serif); font-size: 1.1rem; padding: 12px 0; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--sans); color: var(--accent); font-weight: 400; font-size: 1.5rem; transition: transform .2s ease; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 0 16px; margin: 0; }

.references { font-family: var(--serif); font-style: italic; font-size: 1.1rem; color: var(--ink) !important; }

/* ---------- Apply ---------- */
.apply { background:
    radial-gradient(100% 120% at 50% -20%, rgba(176,141,87,.18), transparent 60%),
    var(--cta-bg);
  color: var(--cta-fg); text-align: center; padding: 90px 0; margin-top: 70px;
}
.apply__title { font-family: var(--serif); font-size: clamp(2.2rem, 6vw, 3.4rem); font-weight: 600; margin: 0 0 18px; letter-spacing: -.02em; }
.apply__lede { max-width: 50ch; margin: 0 auto 32px; color: rgba(251,250,247,.78); font-size: 1.1rem; }
.apply__fine { margin-top: 24px; font-size: .85rem; color: rgba(251,250,247,.5); }

/* ---------- Footer ---------- */
.footer { background: var(--paper-2); border-top: 1px solid var(--line); padding: 34px 0; }
.footer__inner { text-align: center; }
.footer p { margin: 0 0 6px; font-size: .88rem; color: var(--ink-faint); }
.footer__fine { font-size: .82rem; }

/* ---------- Reveal-on-scroll ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .topnav { display: none; }
  .theme-toggle { margin-left: auto; }
  .doc { padding: 36px 22px 28px; margin-top: -24px; border-radius: 0; border-left: 0; border-right: 0; }
  .doc::before { display: none; }
  .resume-head { flex-direction: column-reverse; align-items: flex-start; }
  .skills, .reqs, .benefits { grid-template-columns: 1fr; }
  .hero__stats { gap: 26px; }
  .job__head { flex-direction: column; gap: 2px; }
}

/* ---------- Accessibility ---------- */
/* Visually hidden but read by screen readers (labels for emoji facts, etc.) */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Shown only on the printed resume (e.g. the contact email) */
.print-only { display: none; }

.skip-link {
  position: absolute; left: 12px; top: -50px; z-index: 100;
  background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 8px;
  font-size: .9rem; font-weight: 600; text-decoration: none; transition: top .2s ease;
}
.skip-link:focus { top: 12px; }

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

/* ---------- Anchor scroll offset (sticky top bar is ~62px) ---------- */
:where(#top, #summary, #experience, #skills, #benefits, #faq, #apply) {
  scroll-margin-top: 78px;
}

/* ---------- Scroll-spy active nav link ---------- */
.topnav a { position: relative; }
.topnav a.is-active { color: var(--accent); }
.topnav a.is-active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px;
  height: 2px; background: var(--accent); border-radius: 2px;
}

/* ---------- Smooth theme cross-fade (applied briefly on toggle) ---------- */
:root.theme-transition, :root.theme-transition * {
  transition: background-color .35s ease, color .35s ease, border-color .35s ease, fill .35s ease !important;
}

/* ---------- Apply: compose chooser ---------- */
.apply__compose { position: relative; display: inline-block; }
.compose-menu {
  position: absolute; left: 50%; transform: translateX(-50%);
  top: calc(100% + 12px); z-index: 30;
  min-width: 250px; padding: 8px;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 2px;
  text-align: left;
}
.compose-menu[hidden] { display: none; }
.compose-opt {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 11px 14px; border-radius: 8px;
  font: inherit; font-size: .95rem; font-weight: 500; line-height: 1.2;
  color: var(--ink); text-decoration: none; text-align: left;
  background: transparent; border: 0; cursor: pointer;
}
.compose-opt:hover, .compose-opt:focus-visible { background: var(--paper-2); color: var(--accent); }
.compose-opt__ic { font-size: 1.1rem; flex-shrink: 0; }

/* ---------- 404 page (retro) ---------- */
.nf-body { display: grid; min-height: 100vh; place-items: center; }
.nf {
  text-align: center; padding: 40px 24px; max-width: 600px;
}
.nf__code {
  font-family: var(--mono); font-size: .8rem; letter-spacing: .3em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 14px;
}
.nf__title {
  font-family: var(--serif); font-weight: 600; font-size: clamp(2.4rem, 8vw, 4rem);
  line-height: 1; letter-spacing: -.02em; margin: 0 0 22px;
}
.nf__cursor { color: var(--accent); font-family: var(--mono); animation: nf-blink 1.05s steps(1) infinite; }
@keyframes nf-blink { 50% { opacity: 0; } }
.nf__msg { color: var(--ink-soft); font-size: 1.12rem; margin: 0 auto 30px; max-width: 46ch; }
.nf__cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.nf__fine { margin-top: 34px; font-family: var(--mono); font-size: .78rem; color: var(--ink-faint); }

/* ---------- Print: it should actually print like a resume ---------- */
@media print {
  .topbar, .hero__cta, .apply, .footer, .doc::before, .skip-link { display: none !important; }
  .print-only { display: initial; }
  body { background: #fff; font-size: 11pt; }
  .hero { padding: 20px 0; border: 0; background: #fff; }
  .doc { box-shadow: none; border: 0; margin: 0; padding: 0; }
  .block { padding: 14px 0; }
  a { color: inherit; text-decoration: none; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .bar.is-in i, .bar i { width: var(--w) !important; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
