/* ============================================================
 *  Engineering Portfolio — dark theme
 *  All layout + components. Accent colors are injected at runtime
 *  from portfolio.json (settings.accentColor) onto :root.
 * ============================================================ */

:root {
  --bg:        #0c0f16;
  --bg-1:      #11151f;
  --bg-2:      #161b27;
  --bg-3:      #1d2433;
  --line:      #28303f;
  --line-soft: #1f2533;
  --text:      #e6e9ef;
  --text-dim:  #9aa4b6;
  --text-faint:#5d6779;
  --accent:    #5ed3f4;
  --accent-2:  #a78bfa;
  --danger:    #f47174;
  --ok:        #57d9a3;
  --radius:    14px;
  --radius-sm: 9px;
  --sidebar-w: 290px;
  --maxw:      1080px;
  --shadow:    0 14px 40px -16px rgba(0,0,0,.7);
  --mono:      "SF Mono", "JetBrains Mono", "Fira Code", ui-monospace, Menlo, Consolas, monospace;
  --sans:      -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

::selection { background: var(--accent); color: #06121a; }

/* scrollbar */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 8px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--line); }

/* ── Boot / loading ──────────────────────────────────────── */
.boot {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100vh; gap: 18px; color: var(--text-dim);
}
.boot-spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid var(--bg-3); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.fatal {
  max-width: 560px; margin: 14vh auto; padding: 32px;
  background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius);
}
.fatal h2 { color: var(--danger); margin-bottom: 12px; }
.fatal code {
  background: var(--bg-3); padding: 2px 7px; border-radius: 5px;
  font-family: var(--mono); font-size: .9em; color: var(--accent);
}
.fatal pre {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; margin-top: 14px; overflow:auto; font-family: var(--mono); font-size: .85rem;
}

/* ── App layout ──────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

/* The .sidebar is a flex item that stretches to the full layout
   height (so its background fills the left column even on tall pages
   — no more empty bottom-left gap). The actual UI inside is wrapped
   in .sb-inner, which is sticky-pinned at the top of the viewport. */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-1);
  border-right: 1px solid var(--line);
  align-self: stretch;        /* fill layout height */
}
.sb-inner {
  position: sticky; top: 0;
  height: 100vh; max-height: 100vh;
  overflow-y: auto;
  padding: 30px 24px;
  display: flex; flex-direction: column;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 52px clamp(24px, 5vw, 72px) 96px;
}
.main-inner { max-width: var(--maxw); margin: 0 auto; }

/* ── Sidebar: identity ───────────────────────────────────── */
.sb-photo {
  width: 100%; max-width: 200px; aspect-ratio: 1 / 1;
  border-radius: 22px; object-fit: cover; background: var(--bg-3);
  border: 1px solid var(--line);
}
.sb-name { font-size: 1.32rem; font-weight: 700; margin-top: 16px; letter-spacing: -.02em; }
.sb-title { color: var(--accent); font-size: .92rem; font-weight: 600; margin-top: 3px; }
.sb-tagline { color: var(--text-dim); font-size: .84rem; margin-top: 10px; line-height: 1.5; }

.sb-status {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 14px; font-size: .76rem; color: var(--text-dim);
  background: var(--bg-2); border: 1px solid var(--line);
  padding: 5px 11px; border-radius: 999px;
}
.sb-status .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 3px rgba(87,217,163,.18);
}

/* ── Sidebar: nav ────────────────────────────────────────── */
.sb-nav { margin-top: 30px; display: flex; flex-direction: column; gap: 3px; }
.sb-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-dim); font-weight: 600; font-size: .92rem;
  border: 1px solid transparent;
}
.sb-nav a:hover { background: var(--bg-2); color: var(--text); text-decoration: none; }
.sb-nav a.active {
  background: var(--bg-2); color: var(--text);
  border-color: var(--line);
}
.sb-nav a.active .nav-ico { color: var(--accent); }
.nav-ico { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-faint); }
.sb-nav a:hover .nav-ico { color: var(--accent); }
.sb-nav .nav-edit { margin-top: 8px; color: var(--accent-2); }
.sb-nav .nav-edit .nav-ico { color: var(--accent-2); }

/* ── Sidebar: footer / social ────────────────────────────── */
.sb-spacer { flex: 1; min-height: 28px; }
.sb-social { display: flex; flex-wrap: wrap; gap: 8px; }
.sb-social a {
  width: 36px; height: 36px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text-dim);
}
.sb-social a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.sb-social svg { width: 17px; height: 17px; }
.sb-foot { margin-top: 18px; font-size: .72rem; color: var(--text-faint); line-height: 1.5; }

/* ── Generic UI ──────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 9px 16px; font-size: .9rem; font-weight: 600; font-family: var(--sans);
  cursor: pointer; transition: .15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-primary { background: var(--accent); color: #06121a; border-color: var(--accent); }
.btn-primary:hover { background: #7ee0ff; color: #06121a; }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }
.btn svg { width: 15px; height: 15px; }
.btn-sm { padding: 6px 11px; font-size: .82rem; }

.tag {
  display: inline-block; font-size: .74rem; font-weight: 600;
  background: var(--bg-3); color: var(--text-dim);
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-soft);
}
.chip-cat {
  font-size: .7rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 6px;
  background: var(--bg-3); color: var(--text-dim);
}
.cat-work       { background: rgba(94,211,244,.13); color: var(--accent); }
.cat-personal   { background: rgba(167,139,250,.15); color: var(--accent-2); }
.cat-experiment { background: rgba(87,217,163,.13); color: var(--ok); }

/* page heading */
.page-head { margin-bottom: 34px; }
.page-eyebrow {
  color: var(--accent); font-weight: 700; font-size: .78rem;
  letter-spacing: .14em; text-transform: uppercase;
}
.page-title {
  font-size: clamp(1.9rem, 4vw, 2.7rem); font-weight: 800;
  letter-spacing: -.03em; margin-top: 8px; line-height: 1.1;
}
.page-sub { color: var(--text-dim); margin-top: 12px; max-width: 60ch; }

/* ── Home / hero ─────────────────────────────────────────── */
.hero { margin-bottom: 56px; }
.hero h1 {
  font-size: clamp(2.2rem, 5.5vw, 3.6rem); font-weight: 800;
  letter-spacing: -.035em; line-height: 1.05;
}
.hero h1 .grad {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .lede { font-size: 1.12rem; color: var(--text-dim); margin-top: 18px; max-width: 60ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }

.stats { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 40px; }
.stat {
  background: var(--bg-1); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 22px; flex: 1; min-width: 150px;
}
.stat .num {
  font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em;
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat .lbl { color: var(--text-dim); font-size: .82rem; margin-top: 2px; }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 52px 0 22px; gap: 16px;
}
.section-head h2 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.025em; }
.section-head a { font-size: .87rem; font-weight: 600; }

.about-prose { color: var(--text); }
.about-section.about-full .about-prose { max-width: 78ch; }
.about-section.about-photo-left,
.about-section.about-photo-right {
  display: grid; grid-template-columns: minmax(220px, .85fr) 1.4fr;
  gap: 42px; align-items: start;
}
.about-section.about-photo-left .about-prose,
.about-section.about-photo-right .about-prose { max-width: none; }
.about-photo {
  border-radius: 18px; overflow: hidden;
  border: 1px solid var(--line); background: var(--bg-3);
  aspect-ratio: 4 / 5;
}
.about-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 760px) {
  .about-section.about-photo-left,
  .about-section.about-photo-right { grid-template-columns: 1fr; gap: 22px; }
}

/* ── Home: photo hero layouts ─────────────────────────────── */
.hero-split {
  display: grid; grid-template-columns: 1.05fr .95fr;
  gap: 52px; align-items: center;
}
.hero-center { max-width: 780px; }
.hero-split .hero .lede,
.hero-split .lede { max-width: 48ch; }

.hero-photos { position: relative; }
.hp-main {
  border-radius: 22px; overflow: hidden; border: 1px solid var(--line);
  background: var(--bg-3); aspect-ratio: 4 / 5;
}
.hp-main img, .hp-mini img, .pb-item img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.hero-photos.cluster .hp-extras {
  display: flex; gap: 12px; margin-top: 12px;
}
.hp-mini {
  flex: 1; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--line); background: var(--bg-3); aspect-ratio: 1 / 1;
}

/* gallery band */
.photo-band { margin: 6px 0 46px; }
.pb-track {
  display: flex; gap: 16px; overflow-x: auto;
  padding: 4px 2px 14px; scroll-snap-type: x mandatory;
}
.pb-item {
  flex: 0 0 auto; width: 236px; aspect-ratio: 3 / 4; margin: 0;
  border-radius: 16px; overflow: hidden; border: 1px solid var(--line);
  background: var(--bg-3); scroll-snap-align: start;
}
.pb-track::-webkit-scrollbar { height: 8px; }
.pb-track::-webkit-scrollbar-thumb {
  background: var(--bg-3); border-radius: 8px;
}

/* banner layout — a wide landscape "stage" photo with text overlaid */
.hero-banner { position: relative; }
.hb-photo {
  border-radius: 22px; overflow: hidden;
  border: 1px solid var(--line); background: var(--bg-3);
  aspect-ratio: 16 / 9;
}
.hb-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hb-overlay {
  position: absolute; inset: 0; border-radius: 22px;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: clamp(22px, 4vw, 52px);
  background: linear-gradient(180deg,
    rgba(8, 12, 20, .12) 0%, rgba(8, 12, 20, .58) 56%, rgba(8, 12, 20, .94) 100%);
}
.hb-overlay .hero-text { max-width: 640px; }
.hb-overlay .lede { color: var(--text); }
.hb-overlay h1 { text-shadow: 0 2px 24px rgba(0, 0, 0, .55); }
@media (max-width: 760px) {
  .hero-banner { display: flex; flex-direction: column; gap: 18px; }
  .hb-photo { aspect-ratio: 4 / 3; }
  .hb-overlay {
    position: static; background: none; padding: 0; border-radius: 0;
  }
  .hb-overlay h1 { text-shadow: none; }
}
/* the banner is the visual itself — drop the cinematic panel chrome */
.home-tone-cinematic .hero-banner,
.home-tone-bold .hero-banner {
  padding: 0; background: none; border: 0;
}

/* stats band */
.home-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin: 4px 0 8px;
}
.home-stats .stat { min-width: 0; }

@media (max-width: 880px) {
  .hero-split { grid-template-columns: 1fr; gap: 32px; }
  .home-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ── Home tone: BOLD — vivid gradients + glow ─────────────── */
.home-tone-bold .hero {
  background: radial-gradient(70% 90% at 88% 12%,
    rgba(94, 211, 244, .13), transparent 70%);
  border-radius: 24px;
}
.home-tone-bold .hp-main {
  border: 2px solid transparent;
  background:
    linear-gradient(var(--bg-3), var(--bg-3)) padding-box,
    linear-gradient(140deg, var(--accent), var(--accent-2)) border-box;
  box-shadow: 0 24px 64px -26px rgba(94, 211, 244, .45);
}
.home-tone-bold .hp-mini {
  box-shadow: 0 12px 30px -16px rgba(0, 0, 0, .7);
}
.home-tone-bold .home-stats .stat:hover { border-color: var(--accent); }

/* ── Home tone: MINIMAL — restrained, typographic ─────────── */
.home-tone-minimal .hero h1 { font-weight: 700; letter-spacing: -.03em; }
.home-tone-minimal .hero h1 .grad {
  background: none; -webkit-text-fill-color: var(--accent); color: var(--accent);
}
.home-tone-minimal .hp-main,
.home-tone-minimal .hp-mini,
.home-tone-minimal .pb-item { border-radius: 9px; }
.home-tone-minimal .home-stats .stat {
  background: transparent; border-color: var(--line-soft); padding: 14px 4px;
}
.home-tone-minimal .home-stats .stat .num {
  background: none; -webkit-text-fill-color: var(--text);
  color: var(--text); font-size: 1.7rem;
}
.home-tone-minimal .section-head { margin-top: 64px; }

/* ── Home tone: CINEMATIC — dark panel + spotlight ────────── */
.home-tone-cinematic .hero {
  background:
    radial-gradient(90% 110% at 78% 18%, rgba(94, 211, 244, .16), transparent 62%),
    linear-gradient(180deg, var(--bg-1), var(--bg));
  border: 1px solid var(--line); border-radius: 24px;
  padding: clamp(26px, 4vw, 48px); margin-bottom: 30px;
}
.home-tone-cinematic .hp-main {
  border-color: var(--line);
  box-shadow: 0 36px 90px -34px rgba(0, 0, 0, .95),
              0 0 0 1px rgba(255, 255, 255, .03);
}
.home-tone-cinematic .pb-item {
  box-shadow: 0 26px 60px -30px rgba(0, 0, 0, .9);
}
.home-tone-cinematic .home-stats .stat {
  background: var(--bg-1);
}

/* ── Home: full-width mode (sidebar hidden, top nav) ──────── */
body.home-fullwidth .sidebar { display: none; }
body.home-fullwidth .menu-btn { display: none !important; }
body.home-fullwidth .main { padding: 0; }

.home-full { width: 100%; }
.home-shell {
  max-width: 1240px; margin: 0 auto;
  padding: 38px clamp(20px, 4vw, 56px) 96px;
}

/* sticky translucent top navigation */
.home-topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(12, 15, 22, .82);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.ht-inner {
  max-width: 1240px; margin: 0 auto;
  padding: 13px clamp(20px, 4vw, 56px);
  display: flex; align-items: center; gap: 22px;
}
.ht-brand {
  font-weight: 800; font-size: 1.06rem; letter-spacing: -.02em;
  color: var(--text); white-space: nowrap;
}
.ht-nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.ht-nav a {
  padding: 7px 12px; border-radius: 8px;
  font-weight: 600; font-size: .9rem; color: var(--text-dim);
}
.ht-nav a:hover { color: var(--text); background: var(--bg-2); }
.ht-nav .ht-edit {
  color: var(--accent); display: inline-flex; align-items: center; gap: 5px;
}
.ht-nav .ht-edit svg { width: 14px; height: 14px; }
.ht-social { display: flex; gap: 6px; }
.ht-social a {
  width: 34px; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); border: 1px solid var(--line);
}
.ht-social a:hover { color: var(--accent); border-color: var(--accent); }
.ht-social svg { width: 16px; height: 16px; }

/* a wide image strip across the top of the Home page */
.home-banner-strip {
  margin: 0 0 32px;
  border-radius: 22px; overflow: hidden;
  border: 1px solid var(--line); background: var(--bg-3);
  height: clamp(180px, 28vh, 320px);
  box-shadow: 0 18px 50px -24px rgba(0, 0, 0, .65);
}
.home-banner-strip img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

/* a taller, more cinematic banner when the page runs full-width */
@media (min-width: 761px) {
  .home-full.home-lay-banner .hb-photo {
    aspect-ratio: auto; height: clamp(440px, 66vh, 780px);
  }
}
@media (max-width: 720px) {
  .ht-inner { flex-wrap: wrap; gap: 10px 16px; }
  .ht-nav { order: 3; flex-basis: 100%; }
  .home-shell { padding-top: 24px; }
}

/* ── Home: bottom CTA cards (Projects / Timeline / Resume) ── */
.home-cta { margin: 60px 0 24px; }
.home-cta-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px;
}
.cta-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 26px 24px 22px;
  background: var(--bg-1); border: 1px solid var(--line);
  border-radius: 18px; color: var(--text);
  transition: border-color .15s ease, transform .15s ease, background .15s ease;
}
.cta-card:hover {
  border-color: var(--accent); transform: translateY(-2px);
  background: var(--bg-2);
}
.cta-card .cta-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--bg-3); color: var(--accent); margin-bottom: 4px;
}
.cta-card .cta-ico svg { width: 22px; height: 22px; }
.cta-card h3 { font-size: 1.18rem; font-weight: 800; letter-spacing: -.02em; }
.cta-card p { color: var(--text-dim); font-size: .92rem; margin: 0; flex: 1; }
.cta-card .cta-go {
  margin-top: 8px; color: var(--accent); font-weight: 700; font-size: .88rem;
}
@media (max-width: 760px) {
  .home-cta-grid { grid-template-columns: 1fr; }
}

/* ── site-wide footer (every page) ────────────────────────── */
.site-footer {
  margin-top: 30px; padding: 36px 24px 28px;
  background: var(--bg-1); border-top: 1px solid var(--line);
  color: var(--text-dim); font-size: .88rem;
}
.sf-inner { max-width: 1240px; margin: 0 auto; }
.sf-top {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding-bottom: 22px; border-bottom: 1px solid var(--line);
}
.sf-brand { flex: 1 1 240px; min-width: 0; }
.sf-name { font-size: 1.05rem; font-weight: 800; color: var(--text);
  letter-spacing: -.01em; }
.sf-title { font-size: .82rem; color: var(--accent); font-weight: 600; }
.sf-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.sf-nav a {
  padding: 6px 12px; border-radius: 8px; font-weight: 600;
  font-size: .9rem; color: var(--text-dim);
}
.sf-nav a:hover { background: var(--bg-2); color: var(--text); }
.sf-social { display: flex; gap: 6px; }
.sf-social a {
  width: 34px; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); border: 1px solid var(--line);
}
.sf-social a:hover { color: var(--accent); border-color: var(--accent); }
.sf-social svg { width: 16px; height: 16px; }
.sf-bottom {
  padding-top: 18px; display: flex; flex-direction: column; gap: 10px;
}
.sf-copy { color: var(--text-faint); }
.sf-disclaimer { color: var(--text-faint); font-size: .8rem; line-height: 1.55; }
.sf-disclaimer p { margin: 0 0 6px; }
/* footer spans the full page width across the bottom on every layout */

/* ── floating Preview-as-visitor pill ─────────────────────── */
.preview-pill {
  position: fixed; bottom: 18px; right: 18px; z-index: 100;
  display: inline-flex; align-items: center;
  background: var(--bg-1); border: 1px solid var(--line);
  border-radius: 999px; color: var(--text-dim);
  font-size: .82rem; font-weight: 700;
  box-shadow: 0 14px 36px -12px rgba(0, 0, 0, .55);
  transition: border-color .15s ease, color .15s ease;
}
.preview-pill:hover { border-color: var(--accent); color: var(--text); }
.preview-pill svg { width: 14px; height: 14px; }

/* offer state — the whole pill is one button */
.preview-pill:not(.is-active) > button {
  padding: 9px 15px; background: transparent; color: inherit;
  border: 0; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit;
}
.preview-pill:not(.is-active) > button:hover { color: var(--accent); }

/* active state — accent ring + accent "Exit preview" button */
.preview-pill.is-active {
  border-color: var(--accent); color: var(--text); padding-right: 6px;
}
.preview-pill.is-active > span {
  padding: 8px 0 8px 14px;
  display: inline-flex; align-items: center; gap: 7px;
}
.preview-pill.is-active > button {
  padding: 6px 13px; margin: 0 0 0 8px;
  background: var(--accent); color: #06121a;
  font-weight: 800; font-size: .8rem;
  border: 0; border-radius: 999px; cursor: pointer; font: inherit;
  font-weight: 800;
}
.preview-pill.is-active > button:hover { filter: brightness(1.1); }

/* ── editor: "Photos of you" manager ──────────────────────── */
.ed-photos { display: flex; flex-direction: column; gap: 10px; }
.ed-photo {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px;
}
.ed-photo-thumb {
  flex: 0 0 84px; width: 84px; height: 84px; border-radius: 8px;
  overflow: hidden; background: var(--bg-3); border: 1px solid var(--line);
}
.ed-photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ed-photo-main { flex: 1; min-width: 0; }
.ed-photo-main .field { margin-bottom: 0; }
.ed-photo-thumb { position: relative; }
.ed-photo-flag {
  position: absolute; top: 4px; left: 4px;
  width: 19px; height: 19px; border-radius: 50%;
  background: var(--ok); color: #06121a;
  display: flex; align-items: center; justify-content: center;
}
.ed-photo-flag svg { width: 12px; height: 12px; }
.ed-photo.is-sidebar {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
/* photo-row actions: text buttons left, reorder/delete icons right */
.ed-photo .pr-actions { flex-wrap: wrap; }
.ed-photo .pr-actions [data-dir="-1"] { margin-left: auto; }
.ed-photo-current {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .8rem; font-weight: 700; color: var(--ok);
}
.ed-photo-current svg { width: 13px; height: 13px; }

/* ── Project grid ────────────────────────────────────────── */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  margin-bottom: 26px;
}
.search-box {
  flex: 1; min-width: 220px; position: relative;
}
.search-box svg {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-faint);
}
.search-box input {
  width: 100%; background: var(--bg-1); border: 1px solid var(--line);
  color: var(--text); border-radius: var(--radius-sm);
  padding: 11px 14px 11px 38px; font-size: .92rem; font-family: var(--sans);
}
.search-box input:focus { outline: none; border-color: var(--accent); }
.select {
  background: var(--bg-1); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--radius-sm); padding: 10px 14px; font-size: .9rem;
  font-family: var(--sans); cursor: pointer;
}
.select:focus { outline: none; border-color: var(--accent); }

.filter-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.pill {
  background: var(--bg-1); border: 1px solid var(--line); color: var(--text-dim);
  border-radius: 999px; padding: 6px 14px; font-size: .82rem; font-weight: 600;
  cursor: pointer;
}
.pill:hover { color: var(--text); }
.pill.active { background: var(--accent); color: #06121a; border-color: var(--accent); }

.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
}

/* ── Projects: view-mode toggle (grid / carousel) ────── */
.view-toggle {
  display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm);
  overflow: hidden; background: var(--bg-1);
}
.view-toggle button {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 0; color: var(--text-dim);
  padding: 8px 13px; font-size: .85rem; font-weight: 600; cursor: pointer;
  font-family: var(--sans);
}
.view-toggle button:not(:last-child) { border-right: 1px solid var(--line); }
.view-toggle button:hover { color: var(--text); }
.view-toggle button.active { background: var(--accent); color: #06121a; }
.view-toggle svg { width: 14px; height: 14px; }

/* ── Projects: carousel view ──────────────────────────── */
.proj-carousel-wrap { position: relative; }
.proj-carousel {
  display: flex; gap: 18px;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  padding: 6px 4px 18px;
  scrollbar-width: thin;
}
.proj-carousel > .card {
  flex: 0 0 clamp(260px, 32vw, 360px);
  scroll-snap-align: start;
}
.pc-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  z-index: 5; box-shadow: var(--shadow);
}
.pc-arrow:hover { color: var(--accent); border-color: var(--accent); }
.pc-arrow svg { width: 18px; height: 18px; }
.pc-prev { left: -8px; }
.pc-next { right: -8px; }
@media (max-width: 720px) {
  .pc-arrow { display: none; }
  .proj-carousel > .card { flex-basis: 78vw; }
}
.card {
  background: var(--bg-1); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column;
  color: inherit; text-decoration: none;
  transition: transform .18s ease, border-color .18s ease,
              box-shadow .25s ease, background .18s ease;
}
.card, .card:hover, .card * { text-decoration: none !important; }
.card:hover {
  transform: translateY(-5px); border-color: var(--accent);
  background: var(--bg-2);
  box-shadow:
    0 22px 50px -22px rgba(0, 0, 0, .7),
    0 0 0 1px var(--accent),
    0 0 36px -4px rgba(94, 211, 244, .35);
}
.card:hover h3 { color: var(--accent); }
.card-cover { aspect-ratio: 16 / 9; width: 100%; object-fit: cover; background: var(--bg-3); }
.card-body { padding: 16px 17px 18px; display: flex; flex-direction: column; flex: 1; }
.card-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.card-year { font-family: var(--mono); font-size: .8rem; color: var(--text-faint); }
.card h3 { font-size: 1.06rem; font-weight: 700; letter-spacing: -.02em; }
.card .card-sum { color: var(--text-dim); font-size: .87rem; margin-top: 7px; flex: 1; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 13px; }

.empty {
  text-align: center; color: var(--text-faint); padding: 70px 20px;
  border: 1px dashed var(--line); border-radius: var(--radius);
}

/* ── Timeline ────────────────────────────────────────────── */
.timeline { position: relative; margin-top: 12px; padding-left: 0; }
/* central spine */
.timeline::before {
  content: ""; position: absolute; top: 6px; bottom: 6px;
  left: 50%; width: 2px; margin-left: -1px;
  background: linear-gradient(var(--accent), var(--accent-2));
  opacity: .35;
}

/* the year block — wraps a year header + every item under it; the
   year inside floats with the page as the user scrolls through it */
.tl-year-block { position: relative; }
.tl-year {
  text-align: center; z-index: 3;
  font-size: clamp(3.4rem, 9vw, 6.6rem); font-weight: 800;
  letter-spacing: -.04em; line-height: 1;
  color: transparent; -webkit-text-stroke: 1.5px var(--line);
  margin: 46px 0 26px;
  user-select: none; pointer-events: none;
  position: sticky; top: 8px;
}
/* when the top-bar covers the page header, sit just below it */
body.home-fullwidth .tl-year { top: 64px; }
.tl-year-block:first-child .tl-year { margin-top: 6px; }

.tl-month {
  text-align: center; position: relative; z-index: 2;
  margin: 8px 0 8px;
}
.tl-month span {
  font-family: var(--mono); font-size: .78rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-faint); background: var(--bg);
  padding: 3px 12px; border: 1px solid var(--line); border-radius: 999px;
}

.tl-item {
  position: relative; width: 50%; padding: 14px 44px; box-sizing: border-box;
  margin: 6px 0;
}
.tl-item.left  { left: 0; text-align: right; }
.tl-item.right { left: 50%; text-align: left; }

/* connector dot on the spine */
.tl-item::after {
  content: ""; position: absolute; top: 26px;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--accent);
  z-index: 3; transition: .16s;
}
.tl-item.left::after  { right: -7.5px; }
.tl-item.right::after { left: -7.5px; }
.tl-item:hover::after { background: var(--accent); box-shadow: 0 0 0 6px rgba(94,211,244,.16); }

/* connector line from card to spine */
.tl-item::before {
  content: ""; position: absolute; top: 32px; width: 32px; height: 2px;
  background: var(--line);
}
.tl-item.left::before  { right: 0; }
.tl-item.right::before { left: 0; }

.tl-card { cursor: pointer; display: inline-block; max-width: 100%; }
.tl-card .tl-head { display: flex; align-items: center; gap: 9px; }
.tl-item.left .tl-head { flex-direction: row-reverse; }
.tl-card h3 {
  font-size: 1.18rem; font-weight: 700; letter-spacing: -.02em;
  margin-top: 7px; transition: .15s;
}
.tl-card:hover h3 { color: var(--accent); }
.tl-card .tl-sum { color: var(--text-dim); font-size: .9rem; margin-top: 6px; }
.tl-card .tl-thumb {
  margin-top: 12px; border-radius: 10px; border: 1px solid var(--line);
  aspect-ratio: 16/9; object-fit: cover; width: 100%; max-width: 340px;
}
.tl-item.left .tl-thumb { margin-left: auto; }
.tl-card .tl-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.tl-item.left .tl-head, .tl-item.left .tl-tags { justify-content: flex-end; }
.tl-card .tl-more {
  display: inline-block; margin-top: 11px; font-size: .82rem;
  font-weight: 700; color: var(--accent);
}

.tl-start {
  text-align: center; margin-top: 38px; color: var(--text-faint);
  font-size: .85rem; position: relative; z-index: 2;
}

/* ── Resume ──────────────────────────────────────────────── */
.resume { max-width: 800px; }
.resume-block { margin-bottom: 40px; }
.resume-block > h2 {
  font-size: .82rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); padding-bottom: 9px; margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.summary-text { font-size: 1.05rem; color: var(--text); }

.job { display: flex; gap: 22px; margin-bottom: 26px; }
.job-rail { flex-shrink: 0; width: 8px; padding-top: 6px; }
.job-rail .dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px rgba(94,211,244,.14);
}
.job-body { flex: 1; }
.job-top {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; align-items: baseline;
}
.job-role { font-size: 1.12rem; font-weight: 700; }
.job-co { color: var(--accent); font-weight: 600; }
.job-dates { font-family: var(--mono); font-size: .82rem; color: var(--text-faint); }
.job-loc { color: var(--text-faint); font-size: .82rem; }
.job-sum { color: var(--text-dim); margin: 7px 0 9px; }
.job ul { list-style: none; }
.job li {
  position: relative; padding-left: 20px; color: var(--text-dim);
  margin-bottom: 5px; font-size: .92rem;
}
.job li::before {
  content: "▸"; position: absolute; left: 0; color: var(--accent); font-size: .8rem;
}

.skill-row { display: flex; flex-wrap: wrap; gap: 18px 40px; }
.skill-group { min-width: 200px; }
.skill-group h3 {
  font-size: .9rem; font-weight: 700; margin-bottom: 9px; color: var(--text);
}
.skill-group .tags { display: flex; flex-wrap: wrap; gap: 7px; }

.edu-item, .cert-item { margin-bottom: 14px; }
.edu-item .edu-deg { font-weight: 700; }
.edu-item .edu-school { color: var(--accent); }
.edu-item .edu-meta { font-family: var(--mono); font-size: .8rem; color: var(--text-faint); }
.edu-item .edu-notes { color: var(--text-dim); font-size: .9rem; margin-top: 3px; }

/* ── Project detail ──────────────────────────────────────── */
.detail { max-width: 1120px; margin: 0 auto; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-dim); font-weight: 600; font-size: .88rem; margin-bottom: 22px;
}
.back-link:hover { color: var(--accent); text-decoration: none; }
.back-link svg { width: 15px; height: 15px; }

.detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.detail-year { font-family: var(--mono); color: var(--accent); font-weight: 700; }
.detail h1, .detail .detail-title {
  font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 800;
  letter-spacing: -.035em; line-height: 1.08;
}

/* Centered hero: small uppercase eyebrow above a big headline */
.detail-hero { text-align: center; margin: 8px auto 40px; max-width: 920px; }
.detail-hero .page-eyebrow { margin-bottom: 14px; }
.detail-hero .detail-title { margin: 0 auto; }

/* Split intro — left content, right framed image */
.detail-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: center;
  margin-bottom: 52px;
}
.detail-split .ds-left { min-width: 0; }
.detail-split .ds-right { min-width: 0; position: relative; }
.detail-split .detail-sum {
  font-size: 1.06rem; color: var(--text-dim); line-height: 1.65;
  margin-top: 0; margin-bottom: 18px;
}
.detail-split .detail-tags { margin-top: 4px; }
.detail-split .detail-links { margin-top: 22px; }
.detail-split .detail-folder { margin-top: 18px; }

/* the framed image — rounded card with a subtle accent-offset shadow,
   giving it the depth from the reference design */
.ds-frame {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-3);
  border: 1px solid var(--line);
  box-shadow:
    16px 16px 0 0 rgba(94, 211, 244, 0.08),
    0 24px 60px -20px rgba(0,0,0,.6);
}
.ds-frame img {
  display: block; width: 100%; height: auto;
  aspect-ratio: 4 / 3; object-fit: cover;
}

@media (max-width: 860px) {
  .detail-split {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .ds-frame { box-shadow: 8px 8px 0 0 rgba(94,211,244,.08),
    0 18px 40px -16px rgba(0,0,0,.6); }
  .detail-hero { margin-bottom: 28px; }
}

.detail-sum { font-size: 1.12rem; color: var(--text-dim); margin-top: 14px; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.detail-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.detail-folder {
  margin-top: 14px; font-family: var(--mono); font-size: .78rem;
  color: var(--text-faint);
  display: flex; align-items: center; gap: 6px;
}
.detail-folder svg { width: 14px; height: 14px; flex-shrink: 0; }

/* full write-up prose under the split — slightly narrower for readability */
/* prose fills the full detail width so it lines up with the
   image + tags container above it (no narrow 820px column) */
.detail .prose { max-width: none; margin: 0; }

.media-block { margin: 30px 0; }
/* company media sits inside a résumé job card — tighter, lighter */
.job-media { margin: 14px 0 4px; max-width: 560px; }
.job-media .media-item { margin-bottom: 14px; }
.media-item { margin-bottom: 22px; }
.media-item img {
  width: 100%; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--bg-3);
}

/* ── owner-only inline media hide/show control (edit mode) ── */
.media-editable { position: relative; }
.media-edit-toggle {
  position: absolute; top: 10px; right: 10px; z-index: 4;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; font-size: .76rem; font-weight: 700;
  color: var(--text); background: var(--bg-1);
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
  opacity: .35; transition: opacity .15s ease, border-color .15s ease;
}
.media-editable:hover .media-edit-toggle { opacity: 1; }
.media-edit-toggle:hover { border-color: var(--accent); color: var(--accent); }
.media-edit-toggle svg { width: 13px; height: 13px; }
/* an item hidden from the public site — dimmed, with a badge */
.media-item.is-hidden-pub { opacity: .5; }
.media-item.is-hidden-pub:hover { opacity: 1; }
.media-item.is-hidden-pub .media-edit-toggle { opacity: 1; }
.media-hidden-badge {
  position: absolute; top: 10px; left: 10px; z-index: 4;
  padding: 4px 9px; font-size: .7rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .04em;
  color: #06121a; background: var(--accent-2, #f0a020);
  border-radius: 999px;
}
.media-cap { color: var(--text-faint); font-size: .83rem; margin-top: 8px; text-align: center; }
.video-wrap {
  position: relative; padding-bottom: 56.25%; height: 0;
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line);
}
.video-wrap iframe, .video-wrap video {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
}

.divider { height: 1px; background: var(--line); margin: 34px 0; }

/* ── Markdown prose ──────────────────────────────────────── */
.prose { color: var(--text); font-size: 1.02rem; }
.prose > *:first-child { margin-top: 0; }
.prose h2 {
  font-size: 1.5rem; font-weight: 800; letter-spacing: -.025em;
  margin: 34px 0 14px; padding-bottom: 0;
}
.prose h3 { font-size: 1.18rem; font-weight: 700; margin: 26px 0 10px; }
.prose p { margin: 13px 0; }
.prose ul, .prose ol { margin: 13px 0; padding-left: 26px; }
.prose li { margin: 5px 0; }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
.prose blockquote {
  border-left: 3px solid var(--accent); background: var(--bg-1);
  padding: 10px 18px; margin: 18px 0; border-radius: 0 8px 8px 0;
  color: var(--text-dim);
}
.prose img { border-radius: 10px; border: 1px solid var(--line); margin: 18px 0; }
.prose hr { border: 0; height: 1px; background: var(--line); margin: 28px 0; }

.prose code {
  font-family: var(--mono); font-size: .88em;
  background: var(--bg-3); color: var(--accent);
  padding: 2px 6px; border-radius: 5px;
}
.prose pre {
  background: var(--bg-1) !important; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; margin: 18px 0;
  overflow-x: auto; line-height: 1.55;
}
.prose pre code {
  background: none !important; color: inherit; padding: 0;
  font-size: .87rem;
}

.prose table {
  width: 100%; border-collapse: collapse; margin: 18px 0;
  font-size: .92rem; overflow: hidden; border-radius: 8px;
}
.prose th, .prose td {
  border: 1px solid var(--line); padding: 9px 13px; text-align: left;
}
.prose th { background: var(--bg-2); font-weight: 700; }
.prose tr:nth-child(even) td { background: var(--bg-1); }

.katex-display { overflow-x: auto; overflow-y: hidden; padding: 6px 0; }

/* ── Editor ──────────────────────────────────────────────── */
.editor-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  background: var(--bg-1); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 22px;
  position: sticky; top: 12px; z-index: 20;
}
.editor-bar .grow { flex: 1; }
.editor-status { font-size: .82rem; color: var(--text-faint); }
.editor-status.dirty { color: var(--accent-2); }
.editor-status.saved { color: var(--ok); }
.editor-status.saving { color: var(--accent); }

.ed-banner {
  background: rgba(167,139,250,.1); border: 1px solid var(--accent-2);
  color: var(--text); border-radius: var(--radius); padding: 13px 16px;
  margin-bottom: 22px; font-size: .88rem;
}

.ed-tabs {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px;
  position: sticky; top: 0; z-index: 20;
  background: var(--bg); padding: 12px 0; margin-top: -6px;
  border-bottom: 1px solid var(--line);
}
.ed-tab {
  background: var(--bg-1); border: 1px solid var(--line); color: var(--text-dim);
  padding: 8px 15px; border-radius: var(--radius-sm); font-weight: 600;
  font-size: .88rem; cursor: pointer;
}
.ed-tab.active { background: var(--accent); color: #06121a; border-color: var(--accent); }

.ed-panel { display: none; }
.ed-panel.active { display: block; }

.ed-card {
  background: var(--bg-1); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.ed-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}
.ed-card-head h3 { font-size: 1.02rem; font-weight: 700; }

.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: .8rem; font-weight: 700; color: var(--text-dim);
  margin-bottom: 5px; letter-spacing: .02em;
}
.field input, .field textarea, .field select {
  width: 100%; background: var(--bg); border: 1px solid var(--line);
  color: var(--text); border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: .9rem; font-family: var(--sans);
}
.field textarea { resize: vertical; min-height: 80px; }
.field textarea.code { font-family: var(--mono); font-size: .85rem; min-height: 200px; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--accent);
}
.field-hint { font-size: .75rem; color: var(--text-faint); margin-top: 4px; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row .field { flex: 1; min-width: 140px; }

.ed-list-item {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 16px; margin-bottom: 12px;
}
.ed-list-item .ed-card-head h3 { font-size: .94rem; }

/* collapsed/expanded resume experience entries */
.ed-exp .ed-exp-head { cursor: pointer; }
.ed-exp .ed-exp-head:hover { background: var(--bg); border-radius: var(--radius-sm); }
.ed-exp-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; margin-left: auto; margin-right: 8px;
  color: var(--text-faint);
}
.ed-exp-toggle svg { width: 14px; height: 14px; }
.ed-exp.is-open .ed-exp-toggle { color: var(--accent); }
.ed-proj-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 11px 14px; margin-bottom: 8px;
}
.ed-proj-row .pr-year { font-family: var(--mono); color: var(--text-faint); font-size: .82rem; }
.ed-proj-row .pr-year-input {
  font-family: var(--mono); font-size: .85rem; font-weight: 700;
  color: var(--text); text-align: center;
  width: 62px; padding: 4px 6px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 7px;
}
.ed-proj-row .pr-year-input:focus {
  outline: none; border-color: var(--accent);
  background: var(--bg-1);
}
.ed-proj-row .pr-title { flex: 1; font-weight: 600; }
.ed-proj-row .pr-actions { display: flex; gap: 6px; }
/* a project marked "ready" — its row goes green */
.ed-proj-row.is-ready {
  background: rgba(87, 217, 163, .12);
  border-color: rgba(87, 217, 163, .55);
}
.pr-ready {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--ok); color: #06121a;
  border-radius: 999px; padding: 2px 9px;
  font-size: .72rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .03em;
}
.pr-ready svg { width: 12px; height: 12px; }

.icon-btn {
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text-dim);
  width: 30px; height: 30px; border-radius: 7px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn.danger:hover { color: var(--danger); border-color: var(--danger); }
.icon-btn svg { width: 14px; height: 14px; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(4,6,10,.78);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 20px; z-index: 100; overflow-y: auto;
}
.modal {
  background: var(--bg-1); border: 1px solid var(--line);
  border-radius: var(--radius); width: 100%; max-width: 720px;
  box-shadow: var(--shadow);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg-1); border-radius: var(--radius) var(--radius) 0 0;
}
.modal-head h2 { font-size: 1.12rem; font-weight: 700; }
.modal-body { padding: 20px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--line);
  position: sticky; bottom: 0; background: var(--bg-1);
}

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
  padding: 11px 20px; border-radius: 999px; font-size: .88rem; font-weight: 600;
  box-shadow: var(--shadow); z-index: 200; animation: toastIn .25s ease;
}
.toast.ok { border-color: var(--ok); }
.toast.err { border-color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } }

/* ── Resume PDF generator (Editor) ───────────────────────── */
.rpdf-modal { max-width: 760px; }
.rpdf-intro {
  color: var(--text-dim); font-size: .9rem; line-height: 1.5; margin-bottom: 16px;
}
.rpdf-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.rpdf-card {
  display: flex; flex-direction: column; gap: 7px; text-align: left;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px; cursor: pointer;
  color: var(--text); transition: border-color .15s, transform .12s, box-shadow .15s;
}
.rpdf-card:hover { transform: translateY(-2px); border-color: var(--accent-2); }
.rpdf-card.selected {
  border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset;
}
.rpdf-card-name { font-weight: 700; font-size: .92rem; }
.rpdf-card.selected .rpdf-card-name { color: var(--accent); }
.rpdf-card-desc { font-size: .73rem; color: var(--text-faint); line-height: 1.45; }

/* schematic preview thumbnail (a tiny faux resume) */
.rpdf-thumb {
  display: block; background: #f4f5f7; border: 1px solid var(--line);
  border-radius: 5px; height: 116px; padding: 11px 13px; overflow: hidden;
}
.rt { display: flex; flex-direction: column; height: 100%; }
.rt-center { align-items: stretch; }
.rt-center .rpdf-bar { margin-left: auto; margin-right: auto; }
.rt-airy { justify-content: flex-start; }
.rt-dense { gap: 0; }
.rt-tech { flex-direction: row; gap: 8px; }
.rt-tech .rt-side {
  width: 34%; background: #dfe7ea; border-radius: 3px; padding: 7px 6px;
  display: flex; flex-direction: column;
}
.rt-tech .rt-main { flex: 1; display: flex; flex-direction: column; }
.rpdf-bar {
  display: block; height: 4px; border-radius: 2px;
  background: #cdd2da; margin-bottom: 4px;
}
.rt-dense .rpdf-bar { height: 3px; margin-bottom: 3px; }
.rpdf-bar.rt-strong { background: #6b7280; height: 7px; margin-bottom: 6px; }
.rpdf-bar.rt-thin   { background: #c2c7d0; height: 3px; }
.rpdf-bar.rt-faint  { background: #d8dce3; }
.rpdf-bar.rt-acc    { background: var(--accent); }
.rpdf-bar.rt-bar-acc{ background: var(--accent); border-radius: 1px; }
.rpdf-bar.rt-rule   { background: #6b7280; height: 1px; }
.rt-tech .rt-side .rpdf-bar { background: #aeb9bf; }
.rt-tech .rt-side .rpdf-bar.rt-acc { background: var(--accent); }

@media (max-width: 620px) {
  .rpdf-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Project media editor ────────────────────────────────── */
.ed-media-item {
  display: flex; gap: 14px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 14px; margin-bottom: 12px;
}
.ed-media-item.is-hidden { opacity: .58; }

.ed-media-thumb {
  position: relative; flex-shrink: 0;
  width: 150px; height: 100px; border-radius: 7px; overflow: hidden;
  background: var(--bg); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
}
.ed-media-thumb img,
.ed-media-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.ed-media-empty {
  font-size: .72rem; color: var(--text-faint); text-align: center;
  padding: 6px; line-height: 1.4;
}
/* shown only when the <img>/<video> fails to load */
.ed-media-thumb.broken img,
.ed-media-thumb.broken video { display: none; }
.ed-media-thumb.broken::after {
  content: "file not found"; font-size: .72rem; color: var(--danger);
  font-family: var(--mono);
}
/* the "Hidden" badge — only visible when the item is hidden */
.ed-media-badge {
  position: absolute; top: 6px; left: 6px; display: none;
  background: var(--bg-3); color: var(--text-dim);
  border: 1px solid var(--line); border-radius: 999px;
  font-size: .64rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; padding: 3px 8px;
}
.ed-media-item.is-hidden .ed-media-badge { display: block; }

.ed-media-main { flex: 1; min-width: 0; }
.ed-media-main .ed-card-head { margin-bottom: 10px; }
.ed-media-main .field:last-child { margin-bottom: 0; }
.icon-btn[disabled] { opacity: .3; cursor: default; pointer-events: none; }

@media (max-width: 560px) {
  .ed-media-item { flex-direction: column; }
  .ed-media-thumb { width: 100%; height: 150px; }
}

/* clickable project rows in the editor list */
.ed-proj-click { cursor: pointer; transition: border-color .12s, background .12s; }
.ed-proj-click:hover { border-color: var(--accent); background: var(--bg-3); }
.ed-proj-click .pr-actions { cursor: default; }

/* thumbnail picker */
.ed-thumb-pick { display: flex; gap: 14px; align-items: flex-start; }
.ed-thumb-prev {
  position: relative; flex-shrink: 0;
  width: 150px; height: 100px; border-radius: 7px; overflow: hidden;
  background: var(--bg); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
}
.ed-thumb-prev img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ed-thumb-prev.broken img { display: none; }
.ed-thumb-prev.broken::after {
  content: "file not found"; font-size: .72rem; color: var(--danger);
  font-family: var(--mono);
}
.ed-thumb-side { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.ed-thumb-side .field-hint { margin-top: 0; word-break: break-all; }

@media (max-width: 560px) {
  .ed-thumb-pick { flex-direction: column; }
  .ed-thumb-prev { width: 100%; height: 150px; }
}

/* ── Tag chip editor ─────────────────────────────────────── */
.ed-tags {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 8px 10px; min-height: 40px;
}
.ed-tags:focus-within { border-color: var(--accent); }
.ed-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .76rem; font-weight: 600;
  padding: 3px 5px 3px 10px; border-radius: 999px;
  border: 1px solid var(--line-soft); white-space: nowrap;
}
.ed-tag-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 999px; border: 0;
  background: rgba(0,0,0,.25); color: inherit; cursor: pointer;
  font-size: .8rem; line-height: 1; padding: 0;
}
.ed-tag-x:hover { background: var(--danger); color: #fff; }
.ed-tag-input {
  flex: 1; min-width: 130px; border: 0; background: transparent;
  color: var(--text); font-size: .85rem; padding: 4px 2px; outline: none;
}
.ed-tag-suggest {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin-top: 8px;
}
.ed-tag-suggest-lbl { font-size: .72rem; color: var(--text-faint); font-weight: 700; }
.ed-tag-sug { cursor: pointer; padding: 3px 10px; }
.ed-tag-sug:hover { filter: brightness(1.25); }

/* ── Resume: employer logos, linked projects, disclaimer ─── */
.job-headline { display: flex; align-items: center; gap: 10px; }
.job-logo {
  height: 40px; width: auto; max-width: 140px; flex-shrink: 0;
  border-radius: 6px; padding: 0; object-fit: contain;
  background: transparent;
}
.job-logo.size-sm { height: 32px; max-width: 110px; }
.job-logo.size-md { height: 40px; max-width: 140px; }
.job-logo.size-lg { height: 56px; max-width: 180px; }
.job-logo.size-xl { height: 80px; max-width: 240px; }
.job-logo.bg-none  { background: transparent; padding: 0; }
.job-logo.bg-light { background: #fff; padding: 5px 8px; border-radius: 7px; }
.job-logo.bg-dark  {
  background: var(--bg-3); padding: 5px 8px; border-radius: 7px;
  border: 1px solid var(--line);
}
.job-projects { margin-top: 9px; font-size: .9rem; }
.job-projects-lbl { color: var(--text-faint); font-weight: 700; font-size: .8rem; }
.job-proj {
  display: inline-block; margin: 2px 4px 2px 0;
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 11px; font-size: .82rem; font-weight: 600;
}
.job-proj:hover { border-color: var(--accent); text-decoration: none; }
.resume-disclaimer {
  margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: .76rem; color: var(--text-faint); line-height: 1.6; font-style: italic;
}

/* ── Markdown live-preview panel ─────────────────────────── */
.md-preview-btn { margin-top: 8px; }
#md-preview-panel {
  position: fixed; top: 0; right: 0; height: 100vh;
  width: min(440px, 46vw); z-index: 130;
  background: var(--bg-1); border-left: 1px solid var(--line);
  box-shadow: -16px 0 44px -20px rgba(0,0,0,.75);
  display: flex; flex-direction: column;
}
.md-preview-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 18px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.md-preview-head strong { font-size: 1rem; }
#md-preview-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
body.md-preview-open .main { padding-right: min(460px, 48vw); }
body.md-preview-open .modal-backdrop { padding-right: min(460px, 48vw); }
@media (max-width: 720px) {
  #md-preview-panel { width: 100vw; }
  body.md-preview-open .main,
  body.md-preview-open .modal-backdrop { padding-right: 20px; }
}

/* ── Document / file embeds (project pages) ──────────────── */
.doc-embed-wrap {
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: var(--bg-1);
}
.doc-embed { width: 100%; height: 560px; border: 0; display: block; background: #fff; }
.doc-open {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px; font-size: .85rem; font-weight: 600;
}
.doc-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-1); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
}
.doc-card:hover { border-color: var(--accent); text-decoration: none; }
.doc-card-ico {
  display: inline-flex; color: var(--accent); flex-shrink: 0;
}
.doc-card-ico svg { width: 30px; height: 30px; }
.doc-card-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.doc-card-name { font-weight: 700; color: var(--text); }
.doc-card-sub { font-size: .8rem; color: var(--text-faint); }

/* document preview inside the media editor */
.ed-media-doc {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 8px; text-align: center;
}
.ed-media-doc svg { width: 26px; height: 26px; color: var(--accent); }
.ed-media-doc-ext {
  font-size: .64rem; font-weight: 800; letter-spacing: .08em;
  color: var(--accent); font-family: var(--mono);
}
.ed-media-doc-name {
  font-size: .68rem; color: var(--text-faint);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Home content blocks ─────────────────────────────────── */
.home-blocks { margin: 30px 0 10px; }
/* 12-column row grid. Each cell sets its own `grid-column: span N`
   inline (computed by home.js from cell.width or the row's default).
   The legacy .hb-cols-N classes are kept as harmless no-ops for any
   old code/CSS that targets them. */
.home-row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
  margin: 22px 0;
  align-items: start;
}
.hb-cell { min-width: 0; }
/* Optional explicit width classes — synced with the JS cellSpan helper */
.hb-w-1  { grid-column: span 1; }
.hb-w-2  { grid-column: span 2; }
.hb-w-3  { grid-column: span 3; }
.hb-w-4  { grid-column: span 4; }
.hb-w-6  { grid-column: span 6; }
.hb-w-8  { grid-column: span 8; }
.hb-w-9  { grid-column: span 9; }
.hb-w-12 { grid-column: span 12; }

/* Stack cell — its body is a vertical list of sub-cells (heading +
   text + image + button stacked inside one column) */
.hb-stack { display: flex; flex-direction: column; gap: 16px; }
.hb-substack-item { min-width: 0; }
.hb-substack-item .hb-img { width: 100%; }

.hb-img { width: 100%; border-radius: var(--radius); display: block; }
.hb-cap { font-size: .82rem; color: var(--text-faint); margin-top: 6px; }
.hb-heading { margin: 0; }
.hb-text > :first-child { margin-top: 0; }
.hb-text > :last-child { margin-bottom: 0; }
@media (max-width: 760px) {
  .home-row { grid-template-columns: 1fr !important; }
}

/* ── Home block editor ───────────────────────────────────── */
.ed-hcell-tools { display: flex; gap: 8px; align-items: center; }
.ed-hcells { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.ed-hcell {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 13px 14px;
}
.ed-hcell .ed-card-head h3 { font-size: .82rem; color: var(--text-dim); }
.ed-icon-grid {
  display: flex; flex-wrap: wrap; gap: 6px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 8px;
}
.ed-icon {
  width: 32px; height: 32px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 7px; color: var(--text-dim); cursor: pointer; font-size: .9rem;
}
.ed-icon:hover { color: var(--accent); border-color: var(--accent); }
.ed-icon.sel { color: #06121a; background: var(--accent); border-color: var(--accent); }
.ed-icon svg { width: 16px; height: 16px; }

/* ── Editor: projects search/sort + sub-headings ─────────── */
.ed-proj-controls {
  display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0 16px;
}
.ed-proj-controls .search-box { flex: 1; min-width: 180px; }
.ed-subhead {
  font-size: .78rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--accent);
  margin: 18px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line);
}

/* ── Project page: company / created-for attribution ─────── */
.detail-attribution {
  display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 4px 0 18px;
}
.attr-item { display: inline-flex; align-items: center; gap: 9px; }
.attr-logo {
  height: 30px; width: auto; max-width: 120px;
  border-radius: 5px; background: #fff; padding: 3px 5px; object-fit: contain;
}
.attr-label {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-faint);
}
.attr-co { font-weight: 700; color: var(--text); }

/* ── Editor: project row count pills ─────────────────────── */
.pr-pills { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.pr-pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg-3); border: 1px solid var(--line);
  color: var(--text-dim); border-radius: 999px;
  padding: 2px 9px; font-size: .76rem; font-weight: 700;
}
.pr-pill svg { width: 13px; height: 13px; color: var(--accent); }
.ed-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 22px; padding: 0 8px;
  background: var(--accent); color: #06121a;
  border-radius: 999px; font-size: .82rem; font-weight: 800;
  vertical-align: middle; margin-left: 4px;
}
.ed-count-ready {
  background: var(--ok); gap: 4px; font-weight: 800;
}
.ed-count-ready svg { width: 13px; height: 13px; }

/* "Mark project ready" button in the project modal foot */
.btn-ready { display: inline-flex; align-items: center; gap: 6px; }
.btn-ready svg { width: 14px; height: 14px; }
.btn-ready.is-ready {
  background: var(--ok); border-color: var(--ok); color: #06121a;
  font-weight: 700;
}

/* ── Editor: positions / roles sub-editor ────────────────── */
.ed-roles { margin: 4px 0 14px; }
.ed-roles-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 10px;
}
.ed-roles-head label { margin: 0; }
.ed-role {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 13px 14px; margin-bottom: 10px;
}
.ed-role-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.ed-role-head strong { font-size: .82rem; color: var(--text-dim); }

/* ── company → project link panel ────────────────────────── */
.ed-projlink-panel {
  margin-top: 8px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px; background: var(--bg);
}
.ed-projlink-list {
  margin-top: 8px; max-height: 260px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
.ed-projlink-row {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer;
}
.ed-projlink-row:hover { background: var(--bg-3); }
.ed-projlink-row.is-on { background: var(--bg-3); box-shadow: inset 3px 0 0 var(--accent); }
.ed-projlink-row input { margin: 0; flex-shrink: 0; }
.ed-projlink-name { flex: 1; font-size: .9rem; color: var(--text); }
.ed-projlink-meta { font-size: .78rem; color: var(--text-faint); }

/* ── Resume: multi-role company progression ──────────────── */
.job-co-lead { font-size: 1.12rem; font-weight: 700; color: var(--text); }
.job-roles {
  margin: 8px 0 4px; padding-left: 2px;
  border-left: 2px solid var(--line); padding-left: 12px;
}
.job-role-row {
  display: flex; flex-wrap: wrap; justify-content: space-between;
  gap: 4px 14px; margin-bottom: 5px;
}
.job-role-row .job-role { font-size: .98rem; }
.job-role-row:last-child { margin-bottom: 0; }

/* ── Voice dictation button ──────────────────────────────── */
.dictate-btn { margin-top: 8px; }
.dictate-btn.dictating {
  background: var(--danger); color: #fff; border-color: var(--danger);
  animation: dictatePulse 1.3s ease-in-out infinite;
}
.dictate-btn.dictating:hover { color: #fff; }
.dictate-btn.dictating svg { color: #fff; }
@keyframes dictatePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244, 113, 116, .55); }
  50%      { box-shadow: 0 0 0 7px rgba(244, 113, 116, 0); }
}

/* ── Mobile ──────────────────────────────────────────────── */
.menu-btn {
  display: none; position: fixed; top: 14px; right: 14px; z-index: 50;
  width: 44px; height: 44px; border-radius: 11px;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  align-items: center; justify-content: center; cursor: pointer;
}
.menu-btn svg { width: 22px; height: 22px; }

@media (max-width: 860px) {
  .menu-btn { display: flex; }
  .layout { flex-direction: column; }
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; width: 280px;
    transform: translateX(-100%); transition: transform .22s ease; z-index: 60;
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow); }
  .scrim {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 55;
  }
  .scrim.show { display: block; }
  .main { padding: 64px 20px 80px; }

  .timeline::before { left: 24px; }
  .tl-year { text-align: left; padding-left: 8px; }
  .tl-month { text-align: left; padding-left: 8px; }
  .tl-item { width: 100%; left: 0 !important; padding: 12px 0 12px 52px; text-align: left !important; }
  .tl-item.left .tl-head, .tl-item.left .tl-tags { justify-content: flex-start; }
  .tl-item.left .tl-head { flex-direction: row; }
  .tl-item.left .tl-thumb { margin-left: 0; }
  .tl-item::after { left: 16.5px !important; right: auto !important; }
  .tl-item::before { left: 24px !important; right: auto !important; width: 22px; }
}

@media (max-width: 520px) {
  .grid { grid-template-columns: 1fr; }
  .job { gap: 14px; }
}
