/* ================== TOKENS ================== */
:root {
  --bg: #F7F6F1;
  --surface: #FFFFFF;
  --ink: #141617;
  --ink-70: #3C3F42;
  --ink-50: #6B6F74;
  --ink-30: #A8ABAF;
  --ink-10: #E6E5DF;
  --ink-05: #EFEDE7;
  --accent: oklch(60% 0.16 145);     /* Plus-inspired green, refined */
  --accent-soft: oklch(94% 0.04 145);
  --accent-ink: oklch(32% 0.09 145);
  --rule: #DDDBD3;
  --radius: 4px;
  --radius-lg: 10px;
  --font-sans: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Instrument Serif', 'Times New Roman', serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ================== LAYOUT ================== */
.page {
  display: grid;
  grid-template-columns: 380px 1fr;
  min-height: 100vh;
  max-width: 1600px;
  margin: 0 auto;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  padding: 48px 40px;
  border-right: 1px solid var(--rule);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 28px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sidebar::-webkit-scrollbar { width: 0; }

.sb-photo {
  width: 100%;
  aspect-ratio: 4 / 5;
  background: var(--ink-10);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}
.sb-photo img { width: 100%; height: 100%; object-fit: cover; display: block; filter: grayscale(0.08) contrast(1.02); }
.sb-photo::after {
  content: '';
  position: absolute; inset: 0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
  border-radius: inherit;
  pointer-events: none;
}

.sb-identity .eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-50);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sb-identity h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 48px;
  line-height: 0.95;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
}
.sb-identity h1 em { font-style: italic; color: var(--accent-ink); }
.sb-identity .role {
  font-size: 14px;
  color: var(--ink-70);
  line-height: 1.4;
  max-width: 28ch;
}

.sb-contact { display: grid; gap: 10px; font-size: 13px; }
.sb-contact .row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px dotted var(--ink-10);
}
.sb-contact .row:last-child { border-bottom: none; }
.sb-contact .k { color: var(--ink-50); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; }
.sb-contact .v { color: var(--ink); }
.sb-contact a.v:hover { color: var(--accent-ink); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }

.sb-nav { margin-top: auto; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.sb-nav a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 0;
  color: var(--ink-70);
  border-bottom: 1px solid var(--ink-10);
  transition: color 0.15s;
}
.sb-nav a:hover, .sb-nav a.active { color: var(--ink); }
.sb-nav a .num { font-size: 11px; color: var(--ink-30); font-variant-numeric: tabular-nums; }
.sb-nav a.active .num { color: var(--accent-ink); }

.sb-meta { font-size: 11px; color: var(--ink-30); display: flex; justify-content: space-between; margin-top: 8px; }

/* ---------- Main ---------- */
.main { padding: 72px 80px 120px; max-width: 980px; }

section { padding-top: 96px; scroll-margin-top: 40px; }
section:first-child { padding-top: 0; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 20px;
  margin-bottom: 48px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--rule);
}
.section-head .num {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 22px;
  color: var(--accent-ink);
}
.section-head h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 36px;
  line-height: 1;
  letter-spacing: -0.01em;
  flex: 1;
}
.section-head .tag {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-50);
}

/* ---------- Intro / hero block ---------- */
.hero {
  padding-top: 24px;
  padding-bottom: 24px;
}
.hero .lead {
  font-family: var(--font-serif);
  font-size: 40px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  font-weight: 400;
  text-wrap: pretty;
  max-width: 22ch;
  margin-bottom: 36px;
}
.hero .lead em { font-style: italic; color: var(--accent-ink); }
.hero .meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.hero .meta-grid > div {
  padding: 20px 24px 20px 0;
  border-right: 1px solid var(--rule);
}
.hero .meta-grid > div:last-child { border-right: none; padding-right: 0; padding-left: 24px; }
.hero .meta-grid > div:nth-child(2) { padding-left: 24px; }
.hero .meta-grid .k {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-50);
  margin-bottom: 8px;
}
.hero .meta-grid .v {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.4;
}

/* ---------- About paragraph ---------- */
.about-body {
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink-70);
  max-width: 62ch;
  text-wrap: pretty;
}
.about-body p + p { margin-top: 16px; }

/* ---------- Experience timeline ---------- */
.exp-list { display: flex; flex-direction: column; }
.exp {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 40px;
  padding: 28px 0;
  border-top: 1px solid var(--ink-10);
  position: relative;
}
.exp:last-child { border-bottom: 1px solid var(--ink-10); }
.exp .when {
  font-size: 12px;
  color: var(--ink-50);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding-top: 4px;
}
.exp .when .now {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent-ink);
}
.exp .when .now::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.5s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: 0.35 } }

.exp .body h3 {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.005em;
  margin-bottom: 4px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.exp .body .org {
  font-size: 13px;
  color: var(--ink-50);
  margin-bottom: 12px;
}
.exp .body p {
  font-size: 14.5px;
  color: var(--ink-70);
  line-height: 1.6;
  max-width: 62ch;
}

/* ---------- Education ---------- */
.edu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 1px solid var(--ink-10);
}
.edu {
  padding: 22px 24px 22px 0;
  border-bottom: 1px solid var(--ink-10);
  border-right: 1px solid var(--ink-10);
}
.edu:nth-child(2n) { border-right: none; padding-right: 0; padding-left: 24px; }
.edu:nth-child(2n+1):last-child { border-right: 1px solid var(--ink-10); }
.edu .when { font-size: 11px; color: var(--ink-50); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px; }
.edu h4 { font-size: 15px; font-weight: 500; margin-bottom: 2px; }
.edu .org { font-size: 13px; color: var(--ink-50); margin-bottom: 8px; }
.edu p { font-size: 13.5px; color: var(--ink-70); line-height: 1.55; }

/* ---------- Skills ---------- */
.skills {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  border-top: 1px solid var(--ink-10);
  border-left: 1px solid var(--ink-10);
}
.skill {
  padding: 16px 20px;
  border-right: 1px solid var(--ink-10);
  border-bottom: 1px solid var(--ink-10);
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.skill .num {
  font-size: 10px;
  color: var(--ink-30);
  font-variant-numeric: tabular-nums;
  min-width: 22px;
}
.skill .name { font-size: 14px; color: var(--ink); }
.skill .cat {
  margin-left: auto;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-50);
}

/* ---------- Portfolio grid ---------- */
.port-intro {
  max-width: 56ch;
  font-size: 15px;
  color: var(--ink-70);
  line-height: 1.6;
  margin-bottom: 40px;
}
.port-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.pcard {
  background: var(--surface);
  border: 1px solid var(--ink-10);
  border-radius: var(--radius-lg);
  padding: 28px 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  min-height: 260px;
}
.pcard:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px -18px rgba(0,158,67,0.35), 0 2px 8px -4px rgba(0,0,0,0.08);
}
.pcard .pc-num {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-30);
  position: absolute; top: 22px; right: 24px;
}
.pcard .pc-kind {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-50);
}
.pcard h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  max-width: 18ch;
  text-wrap: pretty;
}
.pcard p {
  font-size: 14px;
  color: var(--ink-70);
  line-height: 1.55;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pcard .pc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px dotted var(--ink-10);
  font-size: 12px;
  color: var(--ink-50);
}
.pcard .pc-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.pcard .pc-tag {
  font-size: 10.5px;
  padding: 3px 8px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-radius: 20px;
  letter-spacing: 0.02em;
}
.pcard .pc-open {
  color: var(--ink-50);
  display: flex;
  align-items: center;
  gap: 4px;
}
.pcard:hover .pc-open { color: var(--accent-ink); }

/* Featured card spans 2 cols */
.pcard.feat { grid-column: span 2; min-height: 220px; }
.pcard.feat h3 { font-size: 34px; max-width: 22ch; }
.pcard.feat p { max-width: 58ch; -webkit-line-clamp: 4; }

/* ---------- Modal ---------- */
.modal-scrim {
  position: fixed; inset: 0;
  background: rgba(20,22,23,0.45);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  animation: scrim-in 0.2s ease;
}
@keyframes scrim-in { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: var(--bg);
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 12px;
  padding: 56px 64px;
  position: relative;
  animation: modal-in 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) } to { opacity: 1; transform: none } }
.modal .close {
  position: absolute;
  top: 20px; right: 20px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--ink-05);
  color: var(--ink-70);
  display: grid; place-items: center;
  font-size: 18px;
  transition: all 0.15s;
}
.modal .close:hover { background: var(--ink); color: var(--bg); }
.modal .m-kind {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--accent-ink); margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.modal .m-kind::before { content: ''; width: 20px; height: 1px; background: var(--accent); }
.modal h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 44px;
  line-height: 1.05;
  letter-spacing: -0.015em;
  margin-bottom: 20px;
  text-wrap: balance;
}
.modal .m-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 28px; }
.modal .m-tag {
  font-size: 11px;
  padding: 4px 10px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-radius: 20px;
}
.modal .m-body {
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  text-wrap: pretty;
}
.modal .m-body p + p { margin-top: 14px; }
.modal .m-body strong { font-weight: 600; }
.modal .m-meta {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  font-size: 13px;
}
.modal .m-meta .k { color: var(--ink-50); text-transform: uppercase; font-size: 10px; letter-spacing: 0.12em; margin-bottom: 4px; }
.modal .m-meta .v { color: var(--ink); }

/* ---------- Chat (AI) ---------- */
.chat-fab {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 24px;
  padding: 14px 20px 14px 18px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  z-index: 80;
  box-shadow: 0 10px 30px -12px rgba(0,0,0,0.35);
  transition: all 0.2s;
}
.chat-fab:hover { transform: translateY(-2px); }
.chat-fab .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(0,158,67,0.22);
  animation: pulse 2.5s infinite;
}
.chat-fab .arrow { opacity: 0.5; font-size: 11px; }

.chat-panel {
  position: fixed;
  bottom: 24px; right: 24px;
  width: 420px;
  max-width: calc(100vw - 48px);
  height: 560px;
  max-height: calc(100vh - 48px);
  background: var(--bg);
  border-radius: 14px;
  box-shadow: 0 20px 60px -20px rgba(0,0,0,0.28), 0 4px 12px -4px rgba(0,0,0,0.1);
  border: 1px solid var(--ink-10);
  z-index: 80;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-in 0.2s ease;
}
.chat-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--ink-10);
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-head .av {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent);
  display: grid; place-items: center;
  color: white; font-family: var(--font-serif); font-size: 16px;
}
.chat-head .info { flex: 1; }
.chat-head .info .name { font-size: 13px; font-weight: 500; }
.chat-head .info .status { font-size: 11px; color: var(--ink-50); display: flex; align-items: center; gap: 6px; }
.chat-head .info .status::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}
.chat-head .close {
  color: var(--ink-50);
  font-size: 18px; width: 28px; height: 28px;
  border-radius: 50%;
  display: grid; place-items: center;
}
.chat-head .close:hover { background: var(--ink-05); color: var(--ink); }

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.bubble {
  max-width: 85%;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  text-wrap: pretty;
}
.bubble.ai {
  background: var(--surface);
  border: 1px solid var(--ink-10);
  border-top-left-radius: 4px;
  align-self: flex-start;
}
.bubble.user {
  background: var(--ink);
  color: var(--bg);
  border-top-right-radius: 4px;
  align-self: flex-end;
}
.bubble.ai strong { color: var(--accent-ink); }

.typing { display: inline-flex; gap: 4px; padding: 2px 0; }
.typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-30);
  animation: type 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes type { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4 } 30% { transform: translateY(-3px); opacity: 1 } }

.chat-suggestions {
  padding: 0 20px 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chat-suggestions button {
  font-size: 12px;
  padding: 6px 12px;
  border: 1px solid var(--ink-10);
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink-70);
  transition: all 0.15s;
}
.chat-suggestions button:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
  background: var(--accent-soft);
}

.chat-input {
  padding: 14px 18px 16px;
  border-top: 1px solid var(--ink-10);
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.chat-input textarea {
  flex: 1;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 14px;
  resize: none;
  max-height: 100px;
  min-height: 22px;
  color: var(--ink);
  outline: none;
  font-family: inherit;
}
.chat-input textarea::placeholder { color: var(--ink-30); }
.chat-input button.send {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  display: grid; place-items: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.chat-input button.send:disabled { background: var(--ink-10); color: var(--ink-30); cursor: not-allowed; }
.chat-input button.send:not(:disabled):hover { background: var(--accent-ink); }

/* ---------- Tweaks panel ---------- */
.tweaks-panel {
  position: fixed;
  bottom: 24px; left: 24px;
  background: var(--bg);
  border: 1px solid var(--ink-10);
  border-radius: 12px;
  padding: 18px;
  width: 280px;
  z-index: 90;
  box-shadow: 0 12px 30px -12px rgba(0,0,0,0.2);
  font-size: 13px;
}
.tweaks-panel h4 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-50);
  margin-bottom: 14px;
}
.tweaks-panel .tw-row {
  margin-bottom: 14px;
}
.tweaks-panel .tw-row:last-child { margin-bottom: 0; }
.tweaks-panel .tw-label { font-size: 11px; color: var(--ink-70); margin-bottom: 6px; display: block; }
.tweaks-panel .tw-opts { display: flex; gap: 4px; flex-wrap: wrap; }
.tweaks-panel .tw-opts button {
  padding: 6px 10px;
  border: 1px solid var(--ink-10);
  border-radius: 6px;
  font-size: 11px;
  background: var(--surface);
  color: var(--ink-70);
}
.tweaks-panel .tw-opts button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 500;
}
.tweaks-panel .swatch {
  width: 24px; height: 24px; border-radius: 4px;
  padding: 0;
  border: 1px solid var(--ink-10);
}
.tweaks-panel .swatch.active { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--ink); }

/* ---------- Theme: mono ---------- */
body.theme-mono {
  --accent: #141617;
  --accent-soft: #EFEDE7;
  --accent-ink: #141617;
}
body.theme-blue {
  --accent: oklch(55% 0.15 250);
  --accent-soft: oklch(94% 0.04 250);
  --accent-ink: oklch(35% 0.1 250);
}
body.theme-orange {
  --accent: oklch(62% 0.16 55);
  --accent-soft: oklch(94% 0.05 55);
  --accent-ink: oklch(40% 0.11 55);
}
body.dense .main { padding: 56px 60px 100px; }
body.dense section { padding-top: 72px; }
body.dense .exp { padding: 20px 0; }

body.serif-heavy .hero .lead,
body.serif-heavy .pcard h3,
body.serif-heavy .modal h2 { font-family: var(--font-serif); }

/* A print-button */
.print-btn {
  position: fixed;
  top: 24px; right: 24px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--ink-10);
  border-radius: 20px;
  font-size: 12px;
  color: var(--ink-70);
  z-index: 70;
  transition: all 0.15s;
}
.print-btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.print-btn svg { width: 14px; height: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .page { grid-template-columns: 320px 1fr; }
  .main { padding: 60px 48px 100px; }
}
@media (max-width: 860px) {
  .page { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    max-height: none;
    overflow-y: visible;
    border-right: none;
    border-bottom: 1px solid var(--rule);
    padding: 40px 24px 32px;
    gap: 20px;
  }
  .sb-photo { max-width: 220px; align-self: center; }
  .sb-identity h1 { font-size: 42px; }
  .sb-identity .role { max-width: 34ch; }
  .sb-nav { display: none; }
  .sb-meta { display: none; }
  .print-btn { display: none; }
  .chat-fab { bottom: 16px; right: 16px; padding: 12px 16px 12px 14px; font-size: 12px; }
  .main { padding: 40px 28px 80px; }
  .section-head h2 { font-size: 28px; }
  .hero .lead { font-size: 30px; }
  .hero .meta-grid { grid-template-columns: 1fr; }
  .hero .meta-grid > div { border-right: none; border-bottom: 1px solid var(--rule); padding: 16px 0 !important; }
  .hero .meta-grid > div:last-child { border-bottom: none; padding-left: 0 !important; }
  .port-grid { grid-template-columns: 1fr; }
  .pcard.feat { grid-column: auto; }
  .edu-grid { grid-template-columns: 1fr; }
  .edu { border-right: none !important; padding: 20px 0 !important; }
  .skills { grid-template-columns: 1fr; border-left: none; }
  .skill { border-right: none; }
  .exp { grid-template-columns: 1fr; gap: 8px; }
  .chat-panel { right: 12px; bottom: 12px; width: calc(100vw - 24px); height: 70vh; }
  .tweaks-panel { left: 12px; bottom: 12px; width: calc(100vw - 24px); max-width: 320px; }
  .modal { padding: 40px 28px; }
  .modal h2 { font-size: 32px; }
}

/* ================== PRINT ================== */
@media print {
  @page { size: A4; margin: 14mm 14mm 14mm 14mm; }
  body { background: white; font-size: 10pt; line-height: 1.4; }
  .page { display: block; max-width: none; }
  .sidebar {
    position: static; height: auto; border-right: none;
    padding: 0 0 16pt; border-bottom: 1px solid #999;
    margin-bottom: 18pt;
    display: grid;
    grid-template-columns: 90pt 1fr;
    gap: 18pt;
    align-items: start;
  }
  .sb-photo { width: 90pt; aspect-ratio: 4/5; }
  .sb-identity h1 { font-size: 28pt; margin-bottom: 8pt; }
  .sb-identity .eyebrow { font-size: 8pt; margin-bottom: 6pt; }
  .sb-identity .role { font-size: 10pt; max-width: none; }
  .sb-contact { margin-top: 10pt; grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8pt; }
  .sb-contact .row { display: block; border: none; padding: 0; }
  .sb-contact .k { font-size: 7pt; margin-bottom: 2pt; }
  .sb-contact .v { font-size: 9pt; }
  .sb-nav, .sb-meta { display: none; }

  .main { padding: 0; max-width: none; }
  section { padding-top: 14pt; page-break-inside: auto; }
  section:first-child { padding-top: 0; }
  .section-head { margin-bottom: 14pt; padding-bottom: 8pt; }
  .section-head h2 { font-size: 18pt; }
  .section-head .num { font-size: 12pt; }

  .hero .lead { font-size: 18pt; margin-bottom: 14pt; max-width: none; }
  .hero .meta-grid { grid-template-columns: repeat(3, 1fr); }
  .hero .meta-grid > div { padding: 8pt 10pt 8pt 0 !important; }
  .hero .meta-grid .v { font-size: 9pt; }

  .about-body { font-size: 10pt; max-width: none; }

  .exp { grid-template-columns: 90pt 1fr; gap: 16pt; padding: 10pt 0; page-break-inside: avoid; }
  .exp .when { font-size: 8pt; }
  .exp .body h3 { font-size: 11pt; }
  .exp .body .org { font-size: 9pt; margin-bottom: 4pt; }
  .exp .body p { font-size: 9.5pt; max-width: none; }

  .edu-grid { page-break-inside: avoid; }
  .edu { padding: 10pt 10pt 10pt 0 !important; }
  .edu h4 { font-size: 10pt; }
  .edu p { font-size: 9pt; }

  .skills { page-break-inside: avoid; grid-template-columns: repeat(2, 1fr); }
  .skill { padding: 6pt 10pt; }
  .skill .name { font-size: 9.5pt; }

  /* Portfolio: force-page-break before */
  #portfolio { page-break-before: always; padding-top: 0; }
  .port-grid { grid-template-columns: 1fr 1fr; gap: 8pt; }
  .pcard {
    min-height: 0;
    padding: 12pt;
    border: 1px solid #ccc;
    box-shadow: none;
    page-break-inside: avoid;
  }
  .pcard.feat { grid-column: span 2; }
  .pcard h3 { font-size: 13pt; }
  .pcard.feat h3 { font-size: 16pt; }
  .pcard p { font-size: 9pt; -webkit-line-clamp: unset; display: block; overflow: visible; }
  .pcard .pc-open { display: none; }

  .chat-fab, .chat-panel, .tweaks-panel, .print-btn { display: none !important; }
  .modal-scrim { display: none !important; }
}
