/* ============================================================
   Portfolio styles — design tokens
   Aesthetic: minimal personal-essay, technical typography
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Light mode */
  --bg:           #ffffff;
  --bg-soft:      oklch(0.985 0.003 250);
  --bg-code:      oklch(0.97 0.005 250);
  --fg:           oklch(0.18 0.01 250);
  --fg-muted:     oklch(0.48 0.01 250);
  --fg-subtle:    oklch(0.62 0.008 250);
  --border:       oklch(0.92 0.005 250);
  --border-hover: oklch(0.78 0.01 250);
  --rule:         oklch(0.88 0.005 250);

  --accent:       oklch(0.55 0.22 252);
  --accent-soft:  oklch(0.55 0.22 252 / 0.08);
  --good:         oklch(0.55 0.17 145);
  --warn:         oklch(0.62 0.18 50);

  --column:       760px;
  --column-wide:  960px;
  --radius:       4px;

  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

:root.dark {
  --bg:           oklch(0.155 0.008 250);
  --bg-soft:      oklch(0.195 0.01 250);
  --bg-code:      oklch(0.22 0.012 250);
  --fg:           oklch(0.94 0.005 250);
  --fg-muted:     oklch(0.68 0.01 250);
  --fg-subtle:    oklch(0.52 0.008 250);
  --border:       oklch(0.27 0.01 250);
  --border-hover: oklch(0.45 0.012 250);
  --rule:         oklch(0.27 0.01 250);

  --accent:       oklch(0.78 0.16 245);
  --accent-soft:  oklch(0.78 0.16 245 / 0.14);
  --good:         oklch(0.8  0.16 150);
  --warn:         oklch(0.78 0.16 60);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.25s ease;
  /* lowercase rhythm — maintains template feel. inline code / kbd stay as authored. */
  text-transform: lowercase;
}

code, kbd, .preserve-case { text-transform: none; }

::selection { background: var(--accent-soft); color: var(--accent); }

a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; transition: opacity 0.2s ease; }
a:hover { opacity: 0.6; }

h1, h2, h3, h4 { font-weight: 600; color: var(--fg); letter-spacing: -0.01em; line-height: 1.25; }

code, .mono { font-family: var(--font-mono); font-size: 0.92em; }

.page { max-width: var(--column); margin: 0 auto; padding: 28px 24px 96px; }
.page--wide { max-width: var(--column-wide); }

.progress {
  position: fixed; inset: 0 auto auto 0;
  height: 2px; width: 0;
  background: var(--accent);
  z-index: 100;
  transition: width 80ms linear;
}

/* Top nav */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 48px;
  font-size: 15px;
}

.nav__brand {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.nav__brand:hover { opacity: 1; color: var(--accent); }
.nav__brand .dot { color: var(--accent); }

.nav__links { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.nav__links a {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 14px;
  font-family: var(--font-mono);
  transition: color 0.2s ease;
}
.nav__links a:hover { color: var(--accent); opacity: 1; }
.nav__links a[aria-current="page"] { color: var(--fg); border-bottom: 1px solid var(--accent); padding-bottom: 2px; }

.nav__actions { display: flex; gap: 8px; align-items: center; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--border-hover); opacity: 1; }
.btn--solid { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn--solid:hover { opacity: 0.85; }
.btn--icon { padding: 6px; width: 32px; height: 32px; justify-content: center; }

/* Hero */
.hero { margin-bottom: 56px; }
.hero__top { display: flex; align-items: center; gap: 18px; margin-bottom: 24px; }
.hero__top .ident { display: flex; flex-direction: column; gap: 2px; }
.hero__top .ident .name { font-size: 17px; font-weight: 600; color: var(--fg); }
.hero__top .ident .role { font-family: var(--font-mono); font-size: 13px; color: var(--fg-muted); }

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: repeating-linear-gradient(45deg, var(--bg-soft) 0 6px, var(--bg-code) 6px 12px);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-subtle);
  flex-shrink: 0;
  cursor: pointer;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.hero__handle {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-subtle);
  margin-bottom: 14px;
  display: inline-flex; align-items: center; gap: 8px;
}
.hero__handle .cursor {
  display: inline-block; width: 7px; height: 14px;
  background: var(--accent);
  animation: blink 1s steps(2) infinite;
  vertical-align: -2px;
}
@keyframes blink { 50% { opacity: 0; } }

.hero h1 {
  font-size: clamp(20px, 2.5vw, 24px);
  font-weight: 600;
  margin-bottom: 18px;
  letter-spacing: -0.02em;
}
.hero h1 .easter {
  cursor: pointer;
  border-bottom: 1px dashed transparent;
  transition: border-color 0.2s ease;
}
.hero h1 .easter:hover { border-bottom-color: var(--accent); }

.hero__lede {
  font-size: 18px;
  line-height: 1.7;
  color: var(--fg-muted);
  margin-bottom: 14px;
  max-width: 60ch;
}
.hero__lede strong { color: var(--fg); font-weight: 600; }
.hero__lede .green { color: var(--good); font-weight: 500; }

.now {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-muted);
  margin-top: 8px;
}
.now .pulse { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.now .pulse::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: var(--good);
  animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(2.6); opacity: 0; }
}
.now .label { color: var(--fg-subtle); }
.now .what { color: var(--fg); }

/* Ticker */
.ticker { margin: 28px 0 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ticker__label { font-family: var(--font-mono); font-size: 12px; color: var(--fg-subtle); }
.ticker__label a { color: var(--fg-muted); text-decoration: none; }
.ticker__label a:hover { color: var(--accent); opacity: 1; }
.ticker__track {
  width: 100%;
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
}
.ticker__scroll {
  display: flex; gap: 28px; width: max-content;
  animation: ticker-scroll 28s linear infinite;
  padding: 6px 0;
}
.ticker__scroll:hover { animation-play-state: paused; }
.ticker__chip {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-muted);
  letter-spacing: -0.01em;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px;
}
.ticker__chip::before {
  content: ''; width: 6px; height: 6px; background: var(--accent);
  border-radius: 50%; opacity: 0.55;
}
@keyframes ticker-scroll { to { transform: translateX(-50%); } }

/* Section primitives */
.section { margin-top: 64px; }
.section__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; margin-bottom: 24px;
}
.section__title {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.section__title::before { content: '§ '; color: var(--accent); }
.section__more {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-muted);
  text-decoration: none;
}
.section__more:hover { color: var(--accent); opacity: 1; }

.prose p {
  font-size: 17px;
  line-height: 1.7;
  color: var(--fg-muted);
  margin-bottom: 16px;
}
.prose p strong { color: var(--fg); font-weight: 600; }
.prose p .green { color: var(--good); font-weight: 500; }
.prose p .blue  { color: var(--accent); font-weight: 500; }

/* Experience */
.exp-list { display: flex; flex-direction: column; }
.exp-item {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 24px;
  padding: 20px 0;
  border-top: 1px solid var(--rule);
}
.exp-item:last-child { border-bottom: 1px solid var(--rule); }
.exp-item__period { font-family: var(--font-mono); font-size: 13px; color: var(--fg-subtle); padding-top: 2px; }
.exp-item__role { font-size: 16px; font-weight: 600; color: var(--fg); margin-bottom: 2px; }
.exp-item__company {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 10px;
  text-decoration: none;
  display: inline-block;
}
.exp-item__company .award { color: var(--warn); margin-left: 6px; font-size: 12px; }
.exp-item__sub { font-size: 13px; color: var(--fg-muted); margin: 2px 0 10px; }
.exp-item__bullets { list-style: none; margin: 0 0 12px 0; padding: 0; }
.exp-item__bullets li {
  font-size: 15px; line-height: 1.6;
  color: var(--fg-muted);
  padding-left: 16px;
  position: relative;
  margin-bottom: 4px;
}
.exp-item__bullets li::before {
  content: '–';
  position: absolute; left: 0;
  color: var(--fg-subtle);
}

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--fg-muted);
  background: var(--bg-soft);
  white-space: nowrap;
}

/* Projects */
.proj-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.proj {
  display: block;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  background: var(--bg);
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}
.proj:hover { border-color: var(--accent); transform: translateY(-2px); opacity: 1; background: var(--bg-soft); }
.proj__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.proj__title { font-size: 16px; font-weight: 600; color: var(--fg); }
.proj__status {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--good);
  display: inline-flex; align-items: center; gap: 5px;
}
.proj__status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--good); }
.proj__status--demo { color: var(--warn); }
.proj__status--demo .dot { background: var(--warn); }
.proj__desc { font-size: 14px; line-height: 1.55; color: var(--fg-muted); margin-bottom: 10px; }
.proj__tags { display: flex; flex-wrap: wrap; gap: 5px; }
.proj__tags .tag { font-size: 11px; padding: 1px 6px; }

/* Stack rows */
.stack { display: flex; flex-direction: column; }
.stack__row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  padding: 14px 0;
  border-top: 1px solid var(--rule);
}
.stack__row:last-child { border-bottom: 1px solid var(--rule); }
.stack__cat { font-family: var(--font-mono); font-size: 13px; color: var(--fg-subtle); }
.stack__items { display: flex; flex-wrap: wrap; gap: 6px; }

/* Preview list (writing + workshops on home) */
.preview-list { display: flex; flex-direction: column; border-top: 1px solid var(--rule); }
.preview-list a {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
  color: inherit;
  text-decoration: none;
  align-items: baseline;
  transition: background 0.2s ease, padding 0.2s ease;
}
.preview-list a:hover { opacity: 1; background: var(--bg-soft); padding-left: 8px; padding-right: 8px; }
.preview-list .date { font-family: var(--font-mono); font-size: 12px; color: var(--fg-subtle); }
.preview-list .title { font-size: 15px; color: var(--fg); }
.preview-list .meta { font-family: var(--font-mono); font-size: 11.5px; color: var(--fg-subtle); white-space: nowrap; }
.preview-list .meta .badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-right: 6px;
}
.preview-list .meta .badge--video { background: oklch(0.7 0.2 25 / 0.1); color: oklch(0.55 0.2 25); }
:root.dark .preview-list .meta .badge--video { color: oklch(0.78 0.16 25); }

/* Contact */
.contact { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.contact a {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--fg);
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease;
  min-width: 0;
  overflow: hidden;
}
.contact a:hover { border-color: var(--accent); background: var(--bg-soft); opacity: 1; }
.contact a .label { color: var(--fg-subtle); flex-shrink: 0; }
.contact a .val { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Workshops */
.workshops { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.ws {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  transition: border-color 0.2s ease, transform 0.2s ease;
  display: flex; flex-direction: column;
}
.ws:hover { border-color: var(--accent); transform: translateY(-2px); }
.ws__img {
  aspect-ratio: 16/9;
  background: var(--bg-soft);
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.ws__img img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}
.ws:hover .ws__img img { transform: scale(1.04); }
.ws__date {
  position: absolute; top: 10px; right: 10px;
  font-family: var(--font-mono); font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--fg);
}
.ws__body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.ws__title { font-size: 15px; font-weight: 600; color: var(--fg); line-height: 1.35; }
.ws__loc { font-family: var(--font-mono); font-size: 12px; color: var(--accent); }
.ws__desc { font-size: 13.5px; color: var(--fg-muted); line-height: 1.55; }
.ws__foot { display: flex; gap: 14px; padding-top: 4px; margin-top: auto; }
.ws__foot a {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
}
.ws__foot a:hover { color: var(--accent); opacity: 1; }

/* Videos grid (writing page) */
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.video {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.video:hover { border-color: var(--accent); transform: translateY(-2px); opacity: 1; }
.video__thumb {
  aspect-ratio: 16/9;
  background: var(--bg-soft);
  position: relative;
  display: block;
  border-bottom: 1px solid var(--border);
}
.video__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video__thumb .play {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.0);
  transition: background 0.2s ease;
}
.video:hover .video__thumb .play { background: rgba(0,0,0,0.25); }
.video__thumb .play svg { width: 36px; height: 36px; color: #fff; opacity: 0; transition: opacity 0.2s ease; }
.video:hover .video__thumb .play svg { opacity: 1; }
.video__duration {
  position: absolute; bottom: 8px; right: 8px;
  font-family: var(--font-mono); font-size: 11px;
  background: rgba(0,0,0,0.75); color: #fff;
  padding: 2px 6px; border-radius: 3px;
}
.video__body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.video__title { font-size: 14px; font-weight: 500; color: var(--fg); line-height: 1.4; }
.video__meta { font-family: var(--font-mono); font-size: 11px; color: var(--fg-subtle); }

/* Footer */
.foot {
  margin-top: 96px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--fg-subtle);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.foot a { color: var(--fg-muted); text-decoration: none; }
.foot a:hover { color: var(--accent); opacity: 1; }
.foot kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 3px;
  background: var(--bg-soft);
  color: var(--fg-muted);
}

/* Modal */
.modal {
  position: fixed; inset: 0;
  background: oklch(0.1 0.005 250 / 0.7);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center; justify-content: center;
  padding: 24px;
  z-index: 200;
}
.modal.open { display: flex; }
.modal__inner {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 460px;
  width: 100%;
  padding: 28px;
  text-align: center;
}
.modal__art {
  aspect-ratio: 1;
  background: repeating-linear-gradient(45deg, var(--bg-soft) 0 10px, var(--bg-code) 10px 20px);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 12px;
  color: var(--fg-subtle);
  margin-bottom: 16px;
}
.modal__caption { font-family: var(--font-mono); font-size: 13px; color: var(--fg-muted); }
.modal__close {
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 4px 10px;
  color: var(--fg);
  cursor: pointer;
}

/* Page sub-header for /writing /workshops */
.page-head { margin-bottom: 32px; }
.page-head .back {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 16px;
}
.page-head .back:hover { color: var(--accent); opacity: 1; }
.page-head h1 {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}
.page-head p {
  font-size: 15px;
  color: var(--fg-muted);
  max-width: 60ch;
}

/* Tab toggle on writing page */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 24px;
}
.tabs button {
  font-family: var(--font-mono);
  font-size: 13px;
  background: none;
  border: 0;
  padding: 8px 14px;
  color: var(--fg-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs button.active { color: var(--fg); border-bottom-color: var(--accent); }
.tabs button:hover { color: var(--fg); }
.tabs .count {
  font-size: 11px;
  color: var(--fg-subtle);
  margin-left: 4px;
}

@media (max-width: 720px) {
  .page { padding: 20px 18px 80px; }
  .nav { margin-bottom: 32px; }
  .nav__links { gap: 14px; font-size: 13px; }
  .nav__actions .btn .lbl { display: none; }
  .nav__actions .btn { padding: 6px 8px; }

  .proj-grid { grid-template-columns: 1fr; }
  .exp-item { grid-template-columns: 1fr; gap: 6px; }
  .exp-item__period { padding-top: 0; }
  .stack__row { grid-template-columns: 1fr; gap: 8px; }
  .preview-list a { grid-template-columns: 1fr; gap: 4px; padding: 12px 0; }
  .preview-list .meta { font-size: 11px; }

  .hero h1 { font-size: 26px; }
  .hero__lede { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .ticker__scroll, .now .pulse::after, .hero__handle .cursor { animation: none; }
}
