/* ==========================================================
   Carl W. Handlin — personal site
   ========================================================== */

:root {
  /* Dark = inverted black & white */
  --bg: #000000;
  --bg-2: #0d0d0d;
  --surface: #000000;
  --border: #2b2b2b;
  --line: #ffffff;
  --text: #ffffff;
  --muted: #a6a6a6;
  --accent: #ffffff;
  --accent-2: #d9d9d9;
  --accent-ink: #000000;
  --radius: 0px;
  --shadow: none;
  --serif: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  --sans: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --max: 1120px;
}

[data-theme="light"] {
  /* Default: the classic white page with black type */
  --bg: #ffffff;
  --bg-2: #f4f4f4;
  --surface: #ffffff;
  --border: #e3e3e3;
  --line: #000000;
  --text: #111111;
  --muted: #555555;
  --accent: #000000;
  --accent-2: #333333;
  --accent-ink: #ffffff;
  --shadow: none;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
body.ready { transition: background-color .3s, color .3s; }
img { max-width: 100%; display: block; }
a { color: inherit; }
p a, .about-copy a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.mono { font-family: var(--mono); }
::selection { background: var(--accent); color: var(--accent-ink); }

.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 24px;
  padding: 14px max(24px, calc((100vw - var(--max)) / 2));
  backdrop-filter: blur(14px) saturate(140%);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.topbar.scrolled { border-bottom-color: var(--border); }
.brand {
  font-family: var(--mono); font-weight: 500; font-size: 15px; letter-spacing: .12em;
  text-decoration: none; padding: 6px 10px; border: 1px solid var(--border); border-radius: 10px;
}
.brand span { color: var(--accent); }
.nav { margin-left: auto; }
.nav ul { list-style: none; display: flex; gap: 6px; margin: 0; padding: 0; align-items: center; }
.nav a {
  text-decoration: none; font-size: 14.5px; color: var(--muted);
  padding: 8px 12px; border-radius: 999px; transition: color .2s, background .2s;
}
.nav a:hover, .nav a.active { color: var(--text); background: var(--surface); }
.nav a.nav-cta { color: var(--accent-ink); background: var(--accent); font-weight: 600; }
.nav a.nav-cta:hover { filter: brightness(1.08); }
.nav-toggle { display: none; }

.theme-toggle {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer;
}
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.theme-toggle .i-moon { display: none; }
[data-theme="light"] .theme-toggle .i-sun { display: none; }
[data-theme="light"] .theme-toggle .i-moon { display: block; }

/* ---------- Layout ---------- */
main { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.section { padding: 110px 0 20px; }
.section-head { margin-bottom: 44px; max-width: 720px; }
.kicker { display: inline-block; font-size: 13px; color: var(--accent); letter-spacing: .06em; margin-bottom: 12px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; }
h2 { font-family: var(--serif); font-weight: 600; font-size: clamp(32px, 4.4vw, 48px); letter-spacing: -.02em; }
h3 { font-size: 19px; font-weight: 600; }

/* ---------- Hero ---------- */
.hero {
  display: grid; grid-template-columns: 1.35fr 1fr; gap: 56px; align-items: center;
  min-height: min(calc(100vh - 80px), 820px); padding: 40px 0 60px;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px; margin: 0 0 22px;
  font-family: var(--mono); font-size: 13px; color: var(--muted);
  padding: 7px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: #3ddc97; box-shadow: 0 0 0 4px color-mix(in srgb, #3ddc97 25%, transparent); animation: pulse 2.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px transparent; } }
.hero h1 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(48px, 8vw, 96px); letter-spacing: -.035em; line-height: .98;
  background: linear-gradient(100deg, var(--text) 30%, var(--accent) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-lead { font-size: clamp(18px, 1.6vw, 21px); color: var(--muted); max-width: 560px; margin: 24px 0 32px; }
.hero-lead strong { color: var(--text); font-weight: 600; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 15px var(--sans); text-decoration: none; cursor: pointer;
  padding: 13px 22px; border-radius: 999px; border: 1px solid var(--border);
  transition: transform .2s, background .2s, border-color .2s, filter .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: var(--surface); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-lg { font-size: 17px; padding: 16px 28px; }

.socials { list-style: none; display: flex; gap: 10px; padding: 0; margin: 34px 0 0; }
.socials a {
  width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  transition: color .2s, border-color .2s, transform .2s;
}
.socials a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.socials svg { width: 18px; height: 18px; fill: currentColor; }

.hero-photo { position: relative; justify-self: center; }
.photo-frame {
  width: min(360px, 78vw); aspect-ratio: 1; border-radius: 32px; overflow: hidden;
  border: 1px solid var(--border); box-shadow: var(--shadow); transform: rotate(2deg);
  background: var(--surface);
}
.photo-frame::after { content: ""; position: absolute; inset: -14px; border: 1px dashed color-mix(in srgb, var(--accent) 60%, transparent); border-radius: 40px; z-index: -1; transform: rotate(-4deg); }
.photo-frame img { width: 100%; height: 100%; object-fit: cover; }
.photo-tag {
  position: absolute; left: -28px; bottom: 26px; font-size: 12.5px;
  background: var(--bg-2); border: 1px solid var(--border); padding: 10px 14px; border-radius: 12px; box-shadow: var(--shadow);
}
.photo-tag span { color: var(--accent-2); }

/* ---------- Stats ---------- */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  overflow: hidden;
}
.stats div { padding: 26px 24px; border-right: 1px solid var(--border); }
.stats div:last-child { border-right: 0; }
.stats strong { display: block; font-family: var(--serif); font-size: 32px; font-weight: 600; color: var(--accent); line-height: 1.1; }
.stats span { font-size: 14px; color: var(--muted); }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; }
.about-copy p { margin: 0 0 18px; color: var(--muted); font-size: 18px; }
.about-copy strong { color: var(--text); }
.skills { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.skills h3 { font-size: 13px; font-weight: 500; color: var(--accent); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 14px; }
.skills h3:not(:first-child) { margin-top: 26px; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; }
.chips li { font-size: 13.5px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-2); }
.ticks { list-style: none; padding: 0; margin: 0; }
.ticks li { position: relative; padding-left: 24px; margin-bottom: 8px; color: var(--muted); font-size: 15.5px; }
.ticks li::before { content: "→"; position: absolute; left: 0; color: var(--accent-2); }

/* ---------- Timeline ---------- */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 130px; top: 8px; bottom: 8px; width: 1px; background: var(--border); }
.timeline li { display: grid; grid-template-columns: 130px 1fr; gap: 36px; padding: 0 0 38px; position: relative; }
.timeline li::before {
  content: ""; position: absolute; left: 125px; top: 8px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.timeline li:first-child::before { background: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 22%, transparent); }
.t-when { font-size: 13px; color: var(--muted); padding-top: 3px; }
.t-body h3 span { color: var(--muted); font-weight: 400; }
.t-body p { margin: 6px 0 0; color: var(--muted); max-width: 680px; }

.edu { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 30px; }
.edu-card { padding: 24px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.edu-card span { font-size: 13px; color: var(--accent-2); }
.edu-card h3 { margin: 6px 0 4px; }
.edu-card p { margin: 0; color: var(--muted); font-size: 15px; }

/* ---------- Cards ---------- */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.card {
  display: flex; flex-direction: column; gap: 10px; text-decoration: none;
  padding: 26px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  transition: transform .25s, border-color .25s, box-shadow .25s;
}
.card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); box-shadow: var(--shadow); }
.tag { font-family: var(--mono); font-size: 12px; color: var(--accent-2); }
.card h3 { font-size: 18px; }
.card p { margin: 0; color: var(--muted); font-size: 15px; flex: 1; }
.card-link { font-size: 14px; font-weight: 600; color: var(--accent); }

.sub-title { font-size: 13px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin: 52px 0 16px; }
.viz-list { display: grid; gap: 10px; }
.viz {
  display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; text-decoration: none;
  padding: 18px 22px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface);
  transition: border-color .2s, transform .2s;
}
.viz:hover { border-color: var(--accent-2); transform: translateX(4px); }
.viz-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; background: var(--bg-2); color: var(--accent-2); font-size: 18px; }
.viz h4 { font-size: 16px; font-weight: 600; }
.viz p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.arrow { color: var(--muted); font-size: 18px; transition: color .2s, transform .2s; }
.viz:hover .arrow, .post a:hover .arrow { color: var(--accent); transform: translate(2px, -2px); }

.cards-2 { grid-template-columns: repeat(2, 1fr); }
.certs { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.certs li { padding: 16px 18px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; gap: 2px; }
.certs strong { font-size: 15.5px; font-weight: 600; }
.certs span { font-size: 13.5px; color: var(--muted); }
.edu + .sub-title, .timeline + .sub-title { margin-top: 20px; }

/* ---------- Writing ---------- */
.filters { display: flex; gap: 8px; margin-bottom: 18px; }
.filter {
  font: 500 14px var(--sans); color: var(--muted); cursor: pointer;
  padding: 7px 16px; border-radius: 999px; border: 1px solid var(--border); background: transparent;
}
.filter.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }
.posts { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--border); }
.post { border-bottom: 1px solid var(--border); }
.post.hidden { display: none; }
.post a { display: grid; grid-template-columns: 150px 1fr auto; gap: 20px; align-items: center; padding: 20px 4px; text-decoration: none; }
.post-src { font-size: 12.5px; color: var(--muted); }
.post-title { font-size: 18px; font-weight: 500; transition: color .2s; }
.post a:hover .post-title { color: var(--accent); }

.video {
  display: grid; grid-template-columns: 1fr 1.4fr; gap: 40px; align-items: center;
  margin-top: 60px; padding: 32px; border-radius: 24px; border: 1px solid var(--border); background: var(--surface);
}
.video-copy h3 { font-family: var(--serif); font-size: 28px; font-weight: 600; margin-bottom: 10px; }
.video-copy p { color: var(--muted); margin: 0 0 22px; }
.video-frame { aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: #000; }
.video-frame iframe { width: 100%; height: 100%; border: 0; }
.video-poster { all: unset; cursor: pointer; position: relative; display: block; width: 100%; height: 100%; }
.video-poster img { width: 100%; height: 100%; object-fit: cover; opacity: .85; transition: opacity .2s; }
.video-poster:hover img { opacity: 1; }
.play {
  position: absolute; inset: 0; margin: auto; width: 72px; height: 72px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-size: 24px; padding-left: 4px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); transition: transform .2s;
}
.video-poster:hover .play { transform: scale(1.08); }

/* ---------- Contact ---------- */
.contact { padding-bottom: 100px; }
.contact-box {
  text-align: center; padding: 72px 32px; border-radius: 28px; border: 1px solid var(--border);
  background:
    radial-gradient(600px 300px at 50% 0%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%),
    var(--surface);
}
.contact-box h2 { max-width: 700px; margin: 0 auto; }
.contact-box p { color: var(--muted); margin: 16px 0 30px; font-size: 18px; }
.contact-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.footer {
  max-width: var(--max); margin: 0 auto; padding: 28px 24px 40px;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  border-top: 1px solid var(--border); color: var(--muted); font-size: 14px;
}
.footer p { margin: 0; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--accent); }

/* ---------- Reveal animation ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .dot { animation: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; min-height: auto; padding-top: 50px; text-align: left; }
  .hero-photo { order: -1; justify-self: start; }
  .photo-frame { width: 200px; border-radius: 24px; }
  .photo-tag { display: none; }
  .about-grid, .video { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats div:nth-child(2) { border-right: 0; }
  .stats div:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .section { padding-top: 80px; }
  .nav-toggle {
    display: grid; gap: 5px; width: 38px; height: 38px; place-content: center;
    border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer;
  }
  .nav-toggle span { width: 16px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .25s; }
  .nav-toggle[aria-expanded="true"] span:first-child { transform: translateY(3.5px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3.5px) rotate(-45deg); }
  .nav ul {
    position: absolute; left: 12px; right: 12px; top: 68px; flex-direction: column; align-items: stretch;
    padding: 10px; border-radius: 16px; border: 1px solid var(--border); background: var(--bg-2); box-shadow: var(--shadow);
    opacity: 0; pointer-events: none; transform: translateY(-8px); transition: opacity .2s, transform .2s;
  }
  .nav ul.open { opacity: 1; pointer-events: auto; transform: none; }
  .nav a { display: block; padding: 12px 14px; }
  .cards, .cards-2, .edu { grid-template-columns: 1fr; }
  .timeline::before { left: 5px; }
  .timeline li { grid-template-columns: 1fr; gap: 4px; padding-left: 30px; }
  .timeline li::before { left: 0; }
  .post a { grid-template-columns: 1fr auto; gap: 4px 12px; }
  .post-src { grid-column: 1 / -1; }
  .video { padding: 20px; }
}


/* ==========================================================
   Monochrome layer — keeps the original carlwhandlin.com feel:
   white page, black type, Montserrat headings, square
   black-outlined buttons.
   ========================================================== */
h1, h2, .hero h1, .stats strong, .video-copy h3 { font-family: var(--serif); font-weight: 800; letter-spacing: -.03em; }
.hero h1 { background: none; -webkit-background-clip: initial; background-clip: initial; color: var(--text); font-weight: 800; }
.hero h1 .period, h2 .period { color: var(--text); }
h3 { font-family: var(--serif); font-weight: 700; letter-spacing: -.01em; }
.section-head p.sub { margin: 12px 0 0; color: var(--muted); font-size: 19px; }
.kicker, .tag, .edu-card span, .photo-tag span, .sub-title, .skills h3 { color: var(--muted); }
p a, .about-copy a { color: var(--text); text-decoration-thickness: 2px; }

/* Square everything */
.brand, .eyebrow, .btn, .socials a, .theme-toggle, .chips li, .card, .skills, .stats, .edu-card,
.viz, .viz-icon, .certs li, .filter, .video, .video-frame, .contact-box, .photo-tag, .nav a, .nav-toggle, .nav ul { border-radius: 0 !important; }

/* Top bar */
.brand { border: 2px solid var(--line); font-weight: 700; color: var(--text); }
.brand span { color: var(--text); opacity: .45; }
.nav a:hover, .nav a.active { background: transparent; color: var(--text); text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 2px; }
.nav a.nav-cta { background: var(--line); color: var(--bg); text-decoration: none; }
.nav a.nav-cta:hover { filter: none; opacity: .85; }
.theme-toggle { border: 2px solid var(--line); background: var(--bg); }
.topbar.scrolled { border-bottom-color: var(--line); }

/* Buttons — the classic "Let's talk!" box */
.btn { border: 3px solid var(--line); font-family: var(--sans); font-weight: 600; font-size: 16px; padding: 12px 24px; }
.btn:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--line); }
.btn-primary { background: var(--line); color: var(--bg); border-color: var(--line); }
.btn-primary:hover { filter: none; }
.btn-ghost { background: var(--bg); color: var(--text); }
.btn-ghost:hover { border-color: var(--line); }

/* Hero */
.eyebrow { border: 1px solid var(--line); background: transparent; color: var(--text); }
.dot { background: var(--text); box-shadow: none; animation: blink 1.6s steps(1) infinite; border-radius: 0; width: 8px; height: 14px; }
@keyframes blink { 50% { opacity: 0; } }
.socials a { border: 2px solid var(--line); background: var(--bg); color: var(--text); }
.socials a:hover { background: var(--line); color: var(--bg); border-color: var(--line); }
.photo-frame { border-radius: 0; transform: none; border: 3px solid var(--line); box-shadow: 14px 14px 0 var(--line); }
.photo-frame::after { display: none; }
.photo-frame img { filter: grayscale(1) contrast(1.05); transition: filter .5s ease; }
.photo-frame:hover img { filter: none; }
.photo-tag { background: var(--line); color: var(--bg); border: 0; box-shadow: none; }
.photo-tag span { color: var(--bg); opacity: .6; }

/* Stats, cards and blocks */
.stats { border: 3px solid var(--line); }
.stats div { border-color: var(--line); }
.stats strong { color: var(--text); font-size: 30px; }
.skills, .edu-card, .certs li, .viz, .card, .video { border: 2px solid var(--line); background: var(--surface); }
.chips li { border: 1px solid var(--line); background: transparent; }
.ticks li::before { color: var(--text); }
.card:hover, .viz:hover { transform: translate(-3px, -3px); border-color: var(--line); box-shadow: 6px 6px 0 var(--line); }
.card-link { color: var(--text); text-decoration: underline; text-underline-offset: 4px; }
.viz-icon { background: var(--line); color: var(--bg); }
.timeline::before { background: var(--line); width: 2px; }
.timeline li::before { border-radius: 0; background: var(--bg); border: 2px solid var(--line); }
.timeline li:first-child::before { background: var(--line); box-shadow: none; }
.posts, .post { border-color: var(--line); }
.post a:hover .post-title { color: var(--text); text-decoration: underline; text-underline-offset: 5px; }
.viz:hover .arrow, .post a:hover .arrow { color: var(--text); }
.filter { border: 2px solid var(--line); color: var(--text); }
.filter.is-active { background: var(--line); color: var(--bg); border-color: var(--line); }
.video-poster img { filter: grayscale(1); opacity: .9; }
.video-poster:hover img { filter: none; opacity: 1; }
.play { background: var(--bg); color: var(--text); border-radius: 0; border: 3px solid var(--line); box-shadow: none; }

/* Contact — inverted black block */
.contact-box { background: var(--line); color: var(--bg); border: 0; }
.contact-box h2, .contact-box .kicker { color: var(--bg); }
.contact-box p { color: var(--bg); opacity: .7; }
.contact-box .btn-primary { background: var(--bg); color: var(--line); border-color: var(--bg); }
.contact-box .btn-ghost { background: transparent; color: var(--bg); border-color: var(--bg); }
.contact-box .btn:hover { box-shadow: 4px 4px 0 var(--bg); }
.footer { border-top: 2px solid var(--line); }

@media (max-width: 960px) {
  .photo-frame { box-shadow: 8px 8px 0 var(--line); }
}
@media (max-width: 760px) {
  .nav-toggle { background: var(--line); border: 0; }
  .nav-toggle span { background: var(--bg); }
  .nav ul { border: 2px solid var(--line); background: var(--bg); box-shadow: 6px 6px 0 var(--line); }
}
@media (max-width: 960px) {
  .stats div:nth-child(-n+2) { border-bottom: 2px solid var(--line); }
  .stats strong { font-size: 24px; }
}
