/* ============================================================
   Theme tokens: light is default, dark via [data-theme="dark"]
   ============================================================ */
:root {
  --bg: #faf8f5;
  --bg-2: #f1ede7;
  --card: #ffffff;
  --rule: #ddd7ce;
  --text: #191919;
  --body: #3b3935;
  --muted: #6f6a63;
  --accent: #ad4d0c;       /* orange for text on light bg (passes WCAG AA 4.5:1) */
  --orange: #f47521;       /* Crunchyroll orange for fills/lines */
  --on-orange: #111;
  --blue: #1d428a;         /* Golden State blue */
  --placeholder: #c9c3ba;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px -12px rgba(0,0,0,.12);
  --max: 1040px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #151515;
  --bg-2: #1c1c1c;
  --card: #1c1c1c;
  --rule: #343434;
  --text: #ece8e1;
  --body: #cfcac2;
  --muted: #9c978f;
  --accent: #f47521;
  --blue: #5b8be0;
  --placeholder: #4a4a4a;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  background: var(--bg); color: var(--body);
  font-family: var(--sans); font-size: 18px; line-height: 1.7;
  transition: background .2s, color .2s;
}
img { max-width: 100%; display: block; }
a { color: var(--text); text-decoration-color: var(--orange); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
a:hover { color: var(--accent); }
strong, b { color: var(--text); font-weight: 600; }
::selection { background: var(--orange); color: #000; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 32px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } body { font-size: 17px; } }

h1, h2, h3, h4 { font-family: var(--serif); color: var(--text); font-weight: 500; line-height: 1.2; }
.label { font-size: 14px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
h3.label { font-family: var(--sans); line-height: 1.5; }

/* ---------- Accessibility helpers ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.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; }
.skip-link {
  position: absolute; left: 16px; top: -100px; z-index: 100; padding: 10px 16px;
  background: var(--text); color: var(--bg); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; color: var(--bg); }

/* ---------- Nav ---------- */
.nav { position: sticky; top: 0; z-index: 50; background: var(--bg); border-bottom: 1px solid var(--rule); transition: background .2s; }
.nav-inner { display: flex; align-items: center; gap: 16px; height: 64px; padding: 0 32px; }
@media (max-width: 600px) { .nav-inner { padding: 0 16px; } }
.logo { font-family: var(--serif); font-size: 20px; text-decoration: none; color: var(--text); margin-right: auto; }
.nav-links { display: flex; gap: 28px; list-style: none; align-items: center; align-self: stretch; }
.nav-links li { display: flex; }
.nav-links a { position: relative; display: flex; align-items: center; text-decoration: none; color: var(--muted); font-size: 15px; transition: color .15s; }
.nav-links a:hover { color: var(--text); }
/* section indicator */
.nav-links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px;
  background: var(--orange); border-radius: 3px 3px 0 0; transform: scaleX(0); transition: transform .25s ease;
}
.nav-links a.active { color: var(--text); }
.nav-links .resume-link { color: var(--accent); font-weight: 600; }
.nav-links .resume-link::after { display: none; }
.nav-links a.active::after { transform: scaleX(1); }
.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  background: none; border: 1px solid var(--rule); color: var(--text); cursor: pointer; transition: border-color .15s;
}
.icon-btn:hover { border-color: var(--orange); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .sun { display: none; }
[data-theme="dark"] .theme-toggle .sun { display: block; }
[data-theme="dark"] .theme-toggle .moon { display: none; }
.menu-btn { display: none; background: none; border: 1px solid var(--rule); color: var(--text); padding: 5px 12px; font: inherit; font-size: 15px; cursor: pointer; }
@media (max-width: 860px) {
  .menu-btn { display: block; }
  .nav-links { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; gap: 0; background: var(--bg-2); border-bottom: 1px solid var(--rule); }
  .nav-links.open { display: flex; }
  .nav-links li { width: 100%; }
  .nav-links a { width: 100%; padding: 14px 16px; }
  .nav-links a::after { left: 0; right: auto; top: 0; bottom: 0; width: 3px; height: auto; border-radius: 0; transform: scaleY(0); }
  .nav-links a.active::after { transform: scaleY(1); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; padding: 12px 22px; font-family: var(--sans); font-size: 16px; font-weight: 600;
  text-decoration: none; border: 1.5px solid var(--text); color: var(--text); transition: background .15s, color .15s;
}
.btn:hover { background: var(--text); color: var(--bg); }
.btn-primary { background: var(--orange); border-color: var(--orange); color: var(--on-orange); }
.btn-primary:hover { background: transparent; color: var(--accent); }
.btn.disabled { opacity: .4; pointer-events: none; }
.actions { display: flex; flex-wrap: wrap; gap: 14px; }

/* ---------- Hero ---------- */
.hero { padding: 64px 0 72px; border-bottom: 1px solid var(--rule); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 64px; align-items: center; }
.kicker { font-size: 15px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; color: var(--accent); margin-bottom: 18px; }
.hero h1 { font-size: clamp(44px, 6.4vw, 76px); line-height: 1; letter-spacing: -0.02em; margin-bottom: 20px; }
.hero .tagline { font-family: var(--sans); font-size: clamp(21px, 2.4vw, 26px); color: var(--text); line-height: 1.4; margin-bottom: 20px; font-weight: 400; max-width: 560px; }
.hero .tagline span { color: var(--accent); font-weight: 600; }
.hero p.intro { max-width: 600px; margin-bottom: 28px; }
.hero-photo { position: relative; z-index: 0; margin-right: 14px; width: 100%; max-width: 300px; justify-self: end; }
.portrait { position: relative; aspect-ratio: 4 / 5; background: var(--bg-2); border: 1px solid var(--rule); }
.portrait::after { content: ""; position: absolute; inset: 14px -14px -14px 14px; border: 1.5px solid var(--orange); z-index: -1; }
.portrait img { position: relative; width: 100%; height: 100%; object-fit: cover; }
.portrait .initials { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--serif); font-size: 80px; color: var(--placeholder); }
.photo-cap { margin-top: 28px; font-size: 15px; color: var(--muted); }
.photo-cap b { display: block; color: var(--text); }
@media (max-width: 820px) {
  .hero { padding: 40px 0 48px; }
  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .hero-photo { order: -1; max-width: 160px; justify-self: start; }
  .portrait::after { inset: 8px -8px -8px 8px; }
}

/* ---------- Sections ---------- */
section.block { padding: 96px 0; border-bottom: 1px solid var(--rule); }
.sec-head { display: grid; grid-template-columns: 200px 1fr; gap: 40px; margin-bottom: 48px; align-items: baseline; }
.sec-num { font-family: var(--serif); font-style: italic; color: var(--accent); font-size: 18px; }
.sec-head h2 { font-size: clamp(32px, 4.4vw, 46px); letter-spacing: -0.01em; }
.sec-head p { margin-top: 14px; color: var(--muted); max-width: 640px; }
.indent { margin-left: 240px; }
@media (max-width: 820px) {
  section.block { padding: 64px 0; }
  .sec-head { grid-template-columns: 1fr; gap: 6px; margin-bottom: 32px; }
  .indent { margin-left: 0; }
}

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.95fr); gap: 40px; }
.about-copy p { margin-bottom: 20px; }
.about-copy h3 { font-size: 22px; margin: 30px 0 10px; }
.about-copy h3:first-child { margin-top: 0; }
.facts { border-top: 3px solid var(--orange); padding-top: 20px; align-self: start; }
.facts dl > div { padding: 11px 0; border-bottom: 1px solid var(--rule); }
.facts dt { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.facts dd { color: var(--text); font-size: 15px; line-height: 1.5; margin-top: 2px; }
@media (max-width: 820px) { .about { grid-template-columns: 1fr; gap: 36px; } }

/* ---------- Experience ---------- */
.role { display: grid; grid-template-columns: 200px 1fr; gap: 40px; padding: 36px 0; border-top: 1px solid var(--rule); }
.role:last-of-type { border-bottom: 1px solid var(--rule); }
.role .when { font-size: 15px; color: var(--muted); line-height: 1.5; }
.role .when b { display: block; color: var(--text); font-weight: 600; }
.role h3 { font-size: 24px; margin-bottom: 2px; }
.role .org { color: var(--accent); font-size: 16px; margin-bottom: 14px; }
.role .role-summary { color: var(--text); margin-bottom: 14px; max-width: 680px; }
.role .tools { margin-top: 6px; font-size: 15px; color: var(--muted); }
.role .tools .label { font-size: 12px; margin-right: 8px; }
.role ul { padding-left: 20px; }
.role li { margin-bottom: 10px; }
.role li::marker { color: var(--muted); }
@media (max-width: 760px) { .role { grid-template-columns: 1fr; gap: 8px; padding: 28px 0; } }
.edu { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 48px; }
.edu p, .skills-list p { font-size: 16px; }
.edu .label, .skills-list .label { display: block; margin-bottom: 6px; font-size: 13px; }
.skills-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; margin-top: 32px; padding-top: 28px; border-top: 1px solid var(--rule); }
@media (max-width: 760px) { .skills-list { grid-template-columns: 1fr; gap: 20px; } }
@media (max-width: 760px) { .edu { grid-template-columns: 1fr; gap: 24px; } }

/* ---------- Selected work ---------- */
.work-list { display: grid; gap: 24px; }
.work-card {
  background: var(--card); border: 1px solid var(--rule); border-top: 3px solid var(--orange);
  padding: 32px 36px; box-shadow: var(--shadow);
}
.work-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; margin-bottom: 10px; }
.work-top .label { color: var(--accent); font-size: 13px; }
.work-meta { font-size: 15px; color: var(--muted); }
.work-card h3 { font-size: clamp(26px, 3.2vw, 34px); margin-bottom: 22px; }
.work-card h3 a { text-decoration: none; color: var(--text); }
.work-card h3 a:hover { color: var(--accent); }
.work-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 40px; margin-bottom: 26px; }
.work-facts div { border-top: 1px solid var(--rule); padding-top: 12px; }
.work-facts dt { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.work-facts dd { font-size: 16px; line-height: 1.6; color: var(--body); }
.work-link { font-weight: 600; color: var(--accent); text-decoration: none; }
.work-link:hover { text-decoration: underline; }
@media (max-width: 760px) {
  .work-card { padding: 24px 20px; }
  .work-facts { grid-template-columns: 1fr; gap: 14px; }
}

/* ---------- Case detail page ---------- */
.crumb { display: block; width: fit-content; margin-bottom: 28px; font-size: 15px; color: var(--muted); text-decoration: none; }
.crumb:hover { color: var(--accent); }
.case-head { padding: 72px 0 56px; border-bottom: 1px solid var(--rule); }
.case-head h1 { font-size: clamp(36px, 5.5vw, 58px); letter-spacing: -0.02em; margin: 10px 0 18px; max-width: 860px; }
.case-head .sub { font-size: 20px; color: var(--muted); max-width: 680px; }
.case-meta { display: flex; flex-wrap: wrap; gap: 12px 40px; margin-top: 32px; }
.case-meta div { font-size: 16px; color: var(--text); }
.case-meta .label { display: block; font-size: 12px; }
.question {
  font-family: var(--serif); font-size: clamp(22px, 2.8vw, 30px); line-height: 1.35; color: var(--text);
  border-left: 3px solid var(--orange); padding: 4px 0 4px 28px; margin-bottom: 28px; font-weight: 400;
}
.case-intro { max-width: 680px; margin-bottom: 52px; }
.initiatives { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; margin-bottom: 52px; }
.initiative { border-top: 3px solid var(--orange); padding-top: 22px; }
.initiative.blue { border-top-color: var(--blue); }
.initiative h3 { font-size: 26px; margin: 6px 0 14px; }
.initiative p { margin-bottom: 16px; }
.initiative .detail { font-size: 16px; color: var(--muted); margin-bottom: 8px; }
@media (max-width: 760px) { .initiatives { grid-template-columns: 1fr; gap: 40px; } }
.figures { width: 100%; border-collapse: collapse; margin-bottom: 40px; }
.figures caption { text-align: left; padding-bottom: 12px; }
.figures td { padding: 14px 0; border-top: 1px solid var(--rule); }
.figures td:last-child { text-align: right; font-family: var(--serif); color: var(--muted); font-style: italic; }
.figures tr:last-child td { border-bottom: 1px solid var(--rule); }
.materials { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.materials .note { font-size: 15px; color: var(--muted); font-style: italic; }
.aside { margin-top: 56px; padding: 28px 32px; background: var(--bg-2); border-left: 3px solid var(--blue); }
.aside h3 { font-size: 22px; margin-bottom: 10px; }
.aside p { font-size: 17px; }

/* ---------- Writing: video carousel ---------- */
.sub-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 20px; }
.sub-head h3 { font-size: 26px; }
.carousel-ctrls { display: flex; gap: 8px; }
.carousel { position: relative; }
.track {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  scrollbar-width: none; gap: 24px;
}
.track::-webkit-scrollbar { display: none; }
.slide {
  flex: 0 0 100%; scroll-snap-align: start;
  display: grid; grid-template-columns: 1.25fr 1fr; gap: 32px; align-items: center;
  background: var(--card); border: 1px solid var(--rule); padding: 24px; box-shadow: var(--shadow);
}
.thumb {
  display: block; aspect-ratio: 16 / 9; position: relative; background: var(--bg-2) center / cover no-repeat;
  border: 1px solid var(--rule); text-decoration: none;
}
.thumb-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s; }
.thumb-img.loaded { opacity: 1; }
.thumb-img:not([src]) { display: none; }
.thumb .play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 64px; height: 64px; border-radius: 50%; background: var(--orange);
  display: grid; place-items: center; transition: transform .15s; box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.thumb .play { z-index: 1; }
.thumb:hover .play { transform: translate(-50%, -50%) scale(1.08); }
.thumb .play::after { content: ""; border-left: 17px solid #111; border-top: 10px solid transparent; border-bottom: 10px solid transparent; margin-left: 5px; }
.slide .label { color: var(--accent); }
.slide h4 { font-size: 24px; margin: 6px 0 10px; }
.slide p { font-size: 16px; margin-bottom: 14px; }
.slide .views { font-size: 15px; color: var(--muted); }
.dots { display: flex; justify-content: center; gap: 8px; margin-top: 18px; }
.dots button { width: 9px; height: 9px; border-radius: 50%; border: none; background: var(--rule); cursor: pointer; padding: 0; transition: background .15s, width .15s; }
.dots button.active { background: var(--orange); width: 24px; border-radius: 5px; }
@media (max-width: 760px) { .slide { grid-template-columns: 1fr; gap: 18px; padding: 16px; } }

.channel-link { margin-top: 24px; font-size: 16px; }

/* ---------- Fixed footer ---------- */
body { padding-bottom: 56px; }
.site-footer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--bg); border-top: 1px solid var(--rule); font-size: 15px; color: var(--muted);
  transition: background .2s;
}
.site-footer .nav-inner { height: 56px; justify-content: space-between; }
.foot-links { display: flex; gap: 24px; }
.foot-links a { padding: 8px 0; }
.foot-links a { text-decoration: none; color: var(--text); }
.foot-links a:hover { color: var(--accent); }
.foot-links .foot-resume { color: var(--accent); font-weight: 600; }
@media (max-width: 480px) {
  .site-footer .copy { display: none; }
  .site-footer .nav-inner { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  html, .track { scroll-behavior: auto; }
  * { transition: none !important; }
}
