/* =========================================================
   Kanban Portfolio — design system
   ========================================================= */

:root {
  /* Base palette — warm off-white */
  --bg: #F7F6F2;
  --bg-elev: #FFFFFF;
  --bg-sunken: #EFEDE7;
  --ink: #1A1A1F;
  --ink-2: #3D3D45;
  --muted: #6E6E78;
  --muted-2: #9A9AA3;
  --line: #E5E2D9;
  --line-2: #D8D4C8;
  --focus: #1A1A1F;

  /* Column semantics — intensify left → right */
  --col-seen: #98968D;
  --col-seen-bg: #EEEBE2;
  --col-int: #3A6EA5;
  --col-int-bg: #DEE7F2;
  --col-imp: #2E7A4F;
  --col-imp-bg: #DCEAE0;
  --col-hire: #B07A1A;
  --col-hire-bg: #F2E5C2;

  /* Type */
  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;

  /* Spacing */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  /* Shadows */
  --shadow-sm: 0 1px 0 rgba(20,20,30,0.04), 0 1px 2px rgba(20,20,30,0.04);
  --shadow-md: 0 1px 0 rgba(20,20,30,0.04), 0 6px 16px -8px rgba(20,20,30,0.10);
  --shadow-lg: 0 1px 0 rgba(20,20,30,0.04), 0 24px 48px -16px rgba(20,20,30,0.16);
}

[data-theme="dark"] {
  --bg: #15151A;
  --bg-elev: #1E1E25;
  --bg-sunken: #101015;
  --ink: #F2F1ED;
  --ink-2: #C9C8C2;
  --muted: #8C8B87;
  --muted-2: #5E5E66;
  --line: #2A2A33;
  --line-2: #3A3A45;
  --col-seen-bg: #232229;
  --col-int-bg: #1B2A3F;
  --col-imp-bg: #1B2E22;
  --col-hire-bg: #322611;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}

button { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* =========================================================
   Layout shell
   ========================================================= */
.app {
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  height: 100vh;
  min-height: 640px;
  overflow: hidden;
}

/* =========================================================
   Header
   ========================================================= */
.header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 32px;
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.header__id { min-width: 0; }
.header__name {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 30px;
  letter-spacing: -0.01em;
  line-height: 1.05;
  margin: 0 0 4px;
}
.header__sub {
  color: var(--muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.header__sub > span:not(.dot):not(.socials) { white-space: nowrap; }
.header__sub .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted-2); }
.header__sub .socials { display: flex; gap: 8px; margin-left: 4px; }
.header__sub .socials a {
  width: 24px; height: 24px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2);
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.header__sub .socials a:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.header__sub .socials svg { width: 13px; height: 13px; }

.theme-toggle {
  width: 24px; height: 24px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: var(--bg-elev);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--ink-2);
  padding: 0;
  position: relative;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.theme-toggle:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.theme-toggle svg { width: 13px; height: 13px; position: absolute; transition: opacity 200ms ease, transform 200ms ease; }
.theme-toggle__sun { opacity: 1; transform: scale(1) rotate(0); }
.theme-toggle__moon { opacity: 0; transform: scale(0.5) rotate(-90deg); }
[data-theme="dark"] .theme-toggle__sun { opacity: 0; transform: scale(0.5) rotate(90deg); }
[data-theme="dark"] .theme-toggle__moon { opacity: 1; transform: scale(1) rotate(0); }

.header__right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.skills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-end;
  max-width: 460px;
}
.skill {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: -0.01em;
  padding: 3px 8px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
}
.skill--accent { background: var(--ink); color: var(--bg-elev); border-color: var(--ink); }

/* =========================================================
   Career timeline
   ========================================================= */
.timeline {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 14px 28px;
  overflow-x: auto;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}
.timeline__label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-2);
  white-space: nowrap;
  margin-right: 14px;
}
.tnode {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: var(--radius);
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
  position: relative;
}
.tnode:hover { border-color: var(--ink); }
.tnode--current { border-color: var(--ink); }
.tnode--current::before {
  content: "";
  width: 5px; height: 5px; border-radius: 50%;
  background: #2E7A4F;
  display: inline-block;
  margin-right: 2px;
  box-shadow: 0 0 0 3px rgba(46, 122, 79, 0.18);
}
.tnode__co { font-weight: 540; letter-spacing: -0.01em; }
.tnode__dates { color: var(--muted); font-family: var(--font-mono); font-size: 11px; }
.tnode__arrow {
  display: inline-block;
  margin: 0 4px;
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-size: 12px;
  user-select: none;
}

/* =========================================================
   Meta bar
   ========================================================= */
.meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 28px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}
.meta__left, .meta__right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.meta__stat { color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.meta__stat b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.meta__live { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.meta__live::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: #2E7A4F;
  box-shadow: 0 0 0 3px rgba(46, 122, 79, 0.18);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(46, 122, 79, 0.18); }
  50% { box-shadow: 0 0 0 6px rgba(46, 122, 79, 0.04); }
}

.nudge-budget {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 6px 14px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--bg-elev);
}
.nudge-budget__label { color: var(--muted); font-size: 12.5px; }
.nudge-budget__pips { display: flex; gap: 4px; }
.nudge-budget__pip {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--col-hire);
  color: white;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
}
.nudge-budget__pip--spent {
  background: transparent;
  border: 1px dashed var(--line-2);
  color: var(--muted-2);
}

/* =========================================================
   Board
   ========================================================= */
.board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding: 16px 28px 18px;
  overflow: hidden;
  min-height: 0;
}
.column {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-sunken);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  overflow: hidden;
}
.column__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--col-bg, var(--bg-sunken));
}
.column__title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--col-fg, var(--ink-2));
  font-weight: 600;
}
.column__title::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 2px;
  background: var(--col-fg, var(--muted-2));
}
.column__count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--col-fg, var(--muted));
  font-variant-numeric: tabular-nums;
  background: var(--bg-elev);
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.column[data-col="seen"] { --col-fg: var(--col-seen); --col-bg: var(--col-seen-bg); }
.column[data-col="interesting"] { --col-fg: var(--col-int); --col-bg: var(--col-int-bg); }
.column[data-col="impressive"] { --col-fg: var(--col-imp); --col-bg: var(--col-imp-bg); }
.column[data-col="would-hire"] { --col-fg: var(--col-hire); --col-bg: var(--col-hire-bg); }

.column__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
}

/* =========================================================
   Card
   ========================================================= */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: transform 360ms cubic-bezier(.2,.7,.2,1), box-shadow 200ms ease, border-color 200ms ease;
  position: relative;
  view-transition-name: var(--vt-name, none);
}
.card:hover { box-shadow: var(--shadow-md); border-color: var(--line-2); }
.card.is-moving { animation: cardMove 600ms cubic-bezier(.2,.7,.2,1); }
@keyframes cardMove {
  0% { transform: translateY(8px) scale(0.98); opacity: 0.6; }
  100% { transform: none; opacity: 1; }
}

.column[data-col="would-hire"] .card {
  border-color: rgba(176, 122, 26, 0.55);
  box-shadow: 0 0 0 1px rgba(176, 122, 26, 0.20), 0 8px 22px -14px rgba(176, 122, 26, 0.5);
}
.column[data-col="would-hire"] .card::before {
  content: "";
  position: absolute; left: -1px; top: -1px; bottom: -1px;
  width: 3px;
  background: linear-gradient(180deg, #C68B1F, #B07A1A);
  border-radius: var(--radius) 0 0 var(--radius);
}

.card--mini { padding: 10px 12px; gap: 6px; }
.card--mini .card__name { font-size: 13px; }
.card--mini .card__desc { display: none; }

.card__head { display: flex; align-items: flex-start; gap: 8px; justify-content: space-between; }
.card__name {
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
}
.card__badge {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--col-hire);
  color: white;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}
.card__desc {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0;
  line-height: 1.4;
  text-wrap: pretty;
}
.card__stack {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.tech {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 2px 6px;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink-2);
}

.card__bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
}
.dots {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  align-content: flex-end;
  flex: 1;
  min-width: 0;
}
.dot-pip {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--c, #ccc);
  animation: dotPop 360ms cubic-bezier(.2,.9,.3,1.4);
}
@keyframes dotPop {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.35); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.nudge-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid var(--line-2);
  background: var(--bg-elev);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 120ms ease;
  position: relative;
}
.nudge-btn:hover:not(:disabled) {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
  transform: translateY(-1px);
}
.nudge-btn:active:not(:disabled) { transform: translateY(0); }
.nudge-btn:disabled { cursor: not-allowed; opacity: 0.55; }
.nudge-btn[data-state="used"] {
  background: var(--bg-sunken);
  border-color: var(--line);
  color: var(--muted);
}
.nudge-btn[data-state="used"]::after {
  content: "✓";
  position: absolute;
  top: -5px; right: -5px;
  width: 12px; height: 12px;
  background: #2E7A4F;
  color: white;
  border-radius: 50%;
  font-size: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-sans);
}
.nudge-btn__arrow { font-size: 13px; line-height: 1; }
.nudge-btn__hint {
  font-family: var(--font-sans);
  font-size: 10.5px;
  color: var(--col-int);
  margin-left: 4px;
}

/* =========================================================
   Footer
   ========================================================= */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 10px 28px 12px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  font-size: 11.5px;
  color: var(--muted);
  font-family: var(--font-mono);
  letter-spacing: -0.005em;
}
.footer__legend { display: inline-flex; align-items: center; gap: 8px; }
.footer__legend .dot-pip {
  width: 7px; height: 7px;
  background: var(--col-int);
  animation: none;
}
.thresholds { display: flex; gap: 16px; flex-wrap: wrap; }
.thresholds span b { color: var(--ink); font-weight: 500; }

/* =========================================================
   Project detail overlay
   ========================================================= */
.detail-mask {
  position: fixed; inset: 0;
  background: rgba(20,20,30,0.32);
  backdrop-filter: blur(2px);
  z-index: 50;
  display: none;
  opacity: 0;
  transition: opacity 200ms ease;
}
.detail-mask.is-open { display: block; opacity: 1; }
.detail {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -48%) scale(0.98);
  width: min(880px, 92vw);
  max-height: 86vh;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  z-index: 51;
  display: none;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transition: transform 240ms cubic-bezier(.2,.7,.2,1), opacity 200ms ease;
}
.detail.is-open {
  display: flex;
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}
.detail__close {
  position: absolute; top: 14px; right: 14px;
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: var(--muted);
  z-index: 2;
}
.detail__close:hover { background: var(--bg-sunken); color: var(--ink); }
.detail__scroll { overflow-y: auto; padding: 28px 32px 32px; }

.detail__eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail__eyebrow .pin {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--col-hire);
}
.detail__title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 38px;
  letter-spacing: -0.015em;
  line-height: 1.05;
  margin: 0 0 8px;
}
.detail__lede {
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.55;
  max-width: 64ch;
  margin: 0 0 22px;
  text-wrap: pretty;
}
.detail__hero {
  height: 220px;
  border-radius: 12px;
  background:
    repeating-linear-gradient(135deg, transparent 0 18px, rgba(20,20,30,0.04) 18px 19px),
    linear-gradient(135deg, #1F2A38, #2C3E50 60%, #3D5A7A);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.5);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.detail__hero-tag {
  position: absolute;
  top: 14px; left: 14px;
  background: rgba(0,0,0,0.4);
  color: rgba(255,255,255,0.8);
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.detail__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 28px;
}
.detail__section { margin-bottom: 22px; }
.detail__section h3 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
  font-weight: 600;
}
.detail__section p { font-size: 13.5px; color: var(--ink-2); line-height: 1.6; margin: 0 0 10px; }
.detail__section ul { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--ink-2); line-height: 1.65; }
.detail__section li { margin-bottom: 4px; }

.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 14px;
  font-size: 13px;
}
.kv dt { color: var(--muted); font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; padding-top: 2px; }
.kv dd { margin: 0; color: var(--ink); }
.kv dd a { border-bottom: 1px solid var(--line-2); }
.kv dd a:hover { border-color: var(--ink); }

.detail__nudge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-sunken);
  border-radius: 10px;
  border: 1px solid var(--line);
  margin-top: 18px;
}
.detail__nudge-row .dots { max-width: none; }

/* =========================================================
   Toast (HTMX action feedback)
   ========================================================= */
.toast {
  position: fixed;
  bottom: 22px; left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--ink);
  color: var(--bg);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-family: var(--font-mono);
  z-index: 70;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* =========================================================
   Responsive
   ========================================================= */

/* Tablet — board scrolls horizontally, layout still desktop-like */
@media (max-width: 1100px) {
  .header { grid-template-columns: 1fr; }
  .header__right { align-items: flex-start; }
  .skills { justify-content: flex-start; max-width: 100%; }
  .board {
    grid-template-columns: repeat(4, minmax(270px, 1fr));
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }
  .column { scroll-snap-align: start; }
}

/* Mobile — single scroll axis: board becomes vertical stack of columns,
   each column scrolls its cards. App grid switches to natural flow. */
@media (max-width: 720px) {
  .app {
    display: block;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }
  body { overflow-y: auto; }

  .header, .timeline, .meta, .footer { padding-left: 16px; padding-right: 16px; }
  .header { padding-top: 16px; padding-bottom: 14px; }
  .header__name { font-size: 24px; }
  .skills { gap: 4px; }
  .skill { font-size: 10.5px; padding: 2px 7px; }

  .timeline { padding-top: 10px; padding-bottom: 10px; }
  .timeline__label { display: none; }
  .tnode { padding: 6px 10px; font-size: 12px; }

  .meta { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .meta__left, .meta__right { width: 100%; justify-content: space-between; }
  .nudge-budget { padding-left: 10px; }

  .board {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px 18px;
    overflow: visible;
  }
  .column {
    width: 100%;
    max-height: none;
  }
  .column__list {
    overflow: visible;
    max-height: none;
  }

  .footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    font-size: 10.5px;
    padding: 12px 16px 16px;
  }
  .thresholds { gap: 10px; }

  .detail {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    top: 0; left: 0;
    border-radius: 0;
    transform: translateY(20px);
  }
  .detail.is-open { transform: translateY(0); }
  .detail__scroll { padding: 56px 20px 24px; }
  .detail__title { font-size: 28px; }
  .detail__hero { height: 160px; }
  .detail__grid { grid-template-columns: 1fr; gap: 0; }
}
