/* ==========================================================================
   jrsenobio.com — single stylesheet, mobile-first, no dependencies
   ========================================================================== */

/* ---- Tokens ------------------------------------------------------------ */
:root {
  color-scheme: light dark;
  --bg: #fafaf7;
  --surface: #f2f1ec;
  --surface-elevated: #ffffff;
  --ink: #1d1d1b;
  --muted: #5b5a55;
  --rule: #dfddd5;
  --accent: #24573d;
  --accent-soft: #e4efe8;
  --accent-border: #b6d3c1;
  --status-dot: #1f8a4c;
  --shadow: 0 2px 10px rgb(0 0 0 / 0.04);
  --shadow-hover: 0 8px 24px rgb(0 0 0 / 0.08);

  --serif: "Iowan Old Style", Charter, "Bitstream Charter", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --measure: 72rem;
  /* ~1152px widescreen container */
  --gap: clamp(1.25rem, 4vw, 3rem);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141413;
    --surface: #1c1c1a;
    --surface-elevated: #22221f;
    --ink: #eae8e1;
    --muted: #a19f96;
    --rule: #2d2c28;
    --accent: #8cc0a0;
    --accent-soft: #1d2d23;
    --accent-border: #325440;
    --status-dot: #4ade80;
    --shadow: 0 2px 12px rgb(0 0 0 / 0.28);
    --shadow-hover: 0 8px 24px rgb(0 0 0 / 0.42);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141413;
  --surface: #1c1c1a;
  --surface-elevated: #22221f;
  --ink: #eae8e1;
  --muted: #a19f96;
  --rule: #2d2c28;
  --accent: #8cc0a0;
  --accent-soft: #1d2d23;
  --accent-border: #325440;
  --status-dot: #4ade80;
  --shadow: 0 2px 12px rgb(0 0 0 / 0.28);
  --shadow-hover: 0 8px 24px rgb(0 0 0 / 0.42);
}

:root[data-theme="light"] {
  color-scheme: light;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 1.03125rem/1.65 var(--sans);
  font-kerning: normal;
}

h1,
h2,
h3,
h4,
p,
ul,
dl,
dd {
  margin: 0;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3,
.wordmark {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
  transition: color 0.15s ease, text-decoration-color 0.15s ease, text-decoration-thickness 0.15s ease;
}

a:hover {
  text-decoration-color: currentColor;
  text-decoration-thickness: 2px;
}

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

.wrap {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--gap);
}

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

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

.skip-link {
  position: absolute;
  left: var(--gap);
  top: -3rem;
  padding: 0.4rem 0.75rem;
  background: var(--ink);
  color: var(--bg);
  z-index: 60;
}

.skip-link:focus {
  top: 0.75rem;
}

/* ---- Header / Navigation / Mobile Burger ------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
}

.header-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding-block: 0.95rem;
}

.wordmark {
  color: var(--ink);
  font-size: 1.2rem;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.65rem 1.25rem;
}

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

.nav-list a {
  color: var(--muted);
  text-decoration-color: transparent;
  font-weight: 500;
}

.nav-list a:hover {
  color: var(--ink);
  text-decoration-color: var(--accent);
}

.theme-toggle {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

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

/* Burger button (hidden on desktop, shown on mobile) */
.burger-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

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

.burger-box {
  position: relative;
  width: 1.1rem;
  height: 0.85rem;
  display: inline-block;
}

.burger-line {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.2s ease, opacity 0.2s ease, top 0.2s ease;
}

.burger-line:nth-child(1) {
  top: 0;
}

.burger-line:nth-child(2) {
  top: calc(50% - 1px);
}

.burger-line:nth-child(3) {
  top: calc(100% - 2px);
}

.burger-toggle[aria-expanded="true"] .burger-line:nth-child(1) {
  top: calc(50% - 1px);
  transform: rotate(45deg);
}

.burger-toggle[aria-expanded="true"] .burger-line:nth-child(2) {
  opacity: 0;
}

.burger-toggle[aria-expanded="true"] .burger-line:nth-child(3) {
  top: calc(50% - 1px);
  transform: rotate(-45deg);
}

/* Mobile navigation drawer */
@media (max-width: 47.99em) {
  .burger-toggle {
    display: inline-flex;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding: 0.75rem var(--gap) 1.1rem;
    background: var(--surface-elevated);
    border-bottom: 1px solid var(--rule);
    box-shadow: var(--shadow-hover);
  }

  .site-header.nav-open .site-nav {
    display: block;
  }

  .nav-list {
    flex-direction: column;
    gap: 0.15rem;
  }

  .nav-list a {
    display: block;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    color: var(--ink);
    font-size: 1rem;
  }

  .nav-list a:hover {
    background: var(--surface);
    text-decoration-color: transparent;
  }
}

/* ---- Intro / Hero ------------------------------------------------------ */
.intro {
  padding-block: 2.5rem 3.25rem;
}

.intro-grid {
  display: grid;
  gap: 2rem;
  align-items: center;
}

.intro-head {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.portrait {
  width: 136px;
  height: 146px;
  object-fit: cover;
  object-position: center 28%;
  border-radius: 10px;
  border: 1px solid var(--rule);
  box-shadow: var(--shadow);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
}

.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--status-dot);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-dot) 25%, transparent);
  flex-shrink: 0;
}

h1 {
  font-size: clamp(1.95rem, 1.45rem + 2vw, 2.7rem);
  letter-spacing: -0.015em;
}

.title {
  margin-top: 0.35rem;
  font-size: 1.15rem;
  font-weight: 500;
}

.meta {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.9375rem;
}

.lede {
  max-width: 44rem;
  font-size: 1.05rem;
}

/* ---- Buttons / CTAs ---------------------------------------------------- */
.cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-top: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.52rem 1.1rem;
  border-radius: 6px;
  border: 1px solid transparent;
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.btn-primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, var(--ink));
}

.btn-secondary {
  background: var(--surface-elevated);
  color: var(--ink);
  border-color: var(--rule);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-disabled {
  background: var(--surface);
  color: var(--muted);
  border-color: var(--rule);
  border-style: dashed;
  cursor: default;
  font-size: 0.875rem;
}

.btn-disabled:hover {
  transform: none;
}

/* ---- Highlights Grid (Hero Right / Bottom) ----------------------------- */
.highlights {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}

.highlights>div {
  padding: 1rem 1.1rem;
  background: var(--surface-elevated);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--accent);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.highlights dt {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.highlights dd {
  margin-top: 0.3rem;
  font-size: 0.925rem;
  font-weight: 500;
  line-height: 1.45;
}

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

section[id] {
  scroll-margin-top: 4.5rem;
}

.section-head {
  margin-bottom: 1.75rem;
}

h2 {
  margin-bottom: 1.25rem;
  font-size: 1.6rem;
  letter-spacing: -0.01em;
}

.section-head h2 {
  margin-bottom: 0.3rem;
}

.section-sub {
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.subhead {
  margin: 2.25rem 0 1rem;
  font-size: 1.15rem;
}

.subhead:first-of-type {
  margin-top: 0;
}

/* ---- Entries & Project Cards (2-Column Grid on Desktop) ---------------- */
.project-list {
  display: grid;
  gap: 1.25rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  padding: 1.45rem 1.55rem;
  background: var(--surface-elevated);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.project-card:hover {
  border-color: var(--accent-border);
  border-left-color: var(--accent);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.entry-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
}

.entry-head h3 {
  font-size: 1.225rem;
}

.date {
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  background: var(--surface);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.role {
  margin: 0.2rem 0 0.65rem;
  color: var(--accent);
  font-size: 0.925rem;
  font-weight: 500;
}

.summary {
  font-weight: 500;
}

.bullets {
  margin-top: 0.65rem;
  padding-left: 1.15rem;
  color: color-mix(in srgb, var(--ink) 90%, var(--muted));
  font-size: 0.96875rem;
}

.bullets li+li {
  margin-top: 0.35rem;
}

.bullets li::marker {
  color: var(--accent);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: auto;
  padding: 1.15rem 0 0;
  list-style: none;
}

.tags li {
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
}

/* ---- Experience Timeline ----------------------------------------------- */
.timeline {
  position: relative;
  padding-left: 1.5rem;
  border-left: 2px solid var(--rule);
}

.timeline-item {
  position: relative;
  padding: 1.25rem 1.4rem;
  background: var(--surface-elevated);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.timeline-item+.timeline-item {
  margin-top: 1.25rem;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: calc(-1.5rem - 7px);
  top: 1.55rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--accent);
}

/* ---- Skills Grid ------------------------------------------------------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr));
  gap: 1rem;
}

.skill-card {
  padding: 1.15rem 1.3rem;
  background: var(--surface-elevated);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.skill-card dt {
  margin-bottom: 0.4rem;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.skill-card dd {
  font-size: 0.95rem;
  line-height: 1.55;
}

/* ---- Education & Certifications ---------------------------------------- */
.plain {
  padding: 0;
  list-style: none;
}

.edu-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 0.85rem;
}

.edu {
  padding: 1.05rem 1.25rem;
  background: var(--surface-elevated);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.cert-list {
  display: grid;
  gap: 1.25rem;
}

.cert {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 1.25rem;
  align-items: start;
  padding: 1.3rem;
  background: var(--surface-elevated);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.cert h4 {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
}

.cert-date {
  display: inline-block;
  margin-top: 0.4rem;
}

.thumb {
  position: relative;
  display: block;
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.thumb:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
}

.thumb img {
  width: 100%;
}

.thumb-hint {
  display: block;
  padding: 0.2rem 0.35rem;
  background: var(--surface);
  border-top: 1px solid var(--rule);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.6875rem;
  text-align: center;
}

.badges {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9rem;
}

.badges dt {
  font-weight: 600;
  color: var(--ink);
}

.badges dd {
  margin-top: 0.15rem;
  color: var(--muted);
}

/* ---- Contact Card ------------------------------------------------------ */
.contact-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem 2rem;
  padding: 2.25rem;
  background: var(--surface);
  border: 1px solid var(--accent-border);
  border-radius: 10px;
}

.contact-card .cta-row {
  margin-top: 0;
}

.contact-card h2 {
  margin-bottom: 0.45rem;
}

.contact-copy {
  max-width: 36rem;
}

/* ---- Footer ------------------------------------------------------------ */
.site-footer {
  padding-block: 2rem 3rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  text-align: center;
  font-size: 0.875rem;
}

/* ---- Lightbox & Resume Modal ------------------------------------------- */
.lightbox {
  max-width: min(64rem, 94vw);
  max-height: 94vh;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  box-shadow: var(--shadow-hover);
}

.lightbox::backdrop {
  background: rgb(0 0 0 / 0.78);
}

.lightbox-bar {
  display: flex;
  justify-content: flex-end;
  padding: 0.5rem;
}

.lightbox-bar button {
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
  cursor: pointer;
}

.lightbox-bar button:hover {
  border-color: var(--accent);
}

.lightbox img {
  width: auto;
  max-height: calc(94vh - 3.5rem);
  margin-inline: auto;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
}

.resume-modal {
  width: min(64rem, 94vw);
  height: min(56rem, 90vh);
}

.resume-modal[open] {
  display: flex;
  flex-direction: column;
}

.resume-modal-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.65rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}

.resume-modal-title {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 600;
}

.resume-modal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.resume-modal-body {
  flex: 1;
  min-height: 0;
  background: var(--surface-elevated);
}

.resume-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---- Tablet & Up (>= 560px) -------------------------------------------- */
@media (min-width: 35em) {
  .intro {
    padding-top: 3.5rem;
  }

  .intro-head {
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 1.5rem;
  }
}

/* ---- Desktop Widescreen Layout (>= 928px) ------------------------------ */
@media (min-width: 58em) {

  /* 2-column Hero: Bio on left, 2x2 Core Focus grid on right */
  .intro-grid {
    grid-template-columns: 1.35fr 1fr;
    gap: 3rem;
  }

  /* 2x2 Bento Grid for Selected Projects */
  .project-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  /* Asymmetric 2-column sections (Sticky Title on left, Content on right) */
  .split-section {
    display: grid;
    grid-template-columns: 16rem 1fr;
    gap: 2.5rem;
    align-items: start;
  }

  .split-section>.section-head {
    position: sticky;
    top: 5.25rem;
    margin-bottom: 0;
  }
}

/* ---- Small Phones (< 560px) -------------------------------------------- */
@media (max-width: 34.99em) {
  .highlights {
    grid-template-columns: 1fr;
  }

  .cert {
    grid-template-columns: 1fr;
  }

  .thumb {
    max-width: 9rem;
  }

  .contact-card {
    padding: 1.35rem;
  }
}

/* ---- Motion preferences ------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}