/* ─── TOKENS (mirrors index exactly) ─────────────────────
   Same palette as the home page. Accent cobalt stays
   IDENTICAL across light and dark modes; only the surface
   and text shift so the mode switch feels like a room's
   lights dimming, not a palette change.

   Strictly true-blue family — no cyans, magentas, or pinks.
   ──────────────────────────────────────────────────────── */
:root {
  /* ── LIGHT MODE ── */

  /* Ink & surface */
  --ink:           #0A1628;
  --ink-dim:       #5B6A82;
  --surface:       #FFFFFF;
  --panel:         #F2F6FB;

  /* Blue ladder (dark → electric) */
  --dark:          #0D1B2E;
  --navy:          #1A3A5C;
  --blue:          #2563AE;
  --sky:           #5BA8D9;

  /* Accent — the glow. Grounded cobalt. IDENTICAL in dark mode. */
  --accent:        #2563EB;
  --accent-dark:   #1D4ED8;
  --accent-glow:   rgba(37, 99, 235, .28);
  --accent-glow-2: rgba(37, 99, 235, .12);
  --accent-halo:   rgba(37, 99, 235, .40);

  /* Subtle accent tint (used behind the project-tag hover) */
  --accent-tint:   rgba(37, 99, 235, .06);

  /* Text colour that sits on top of the accent — white for contrast. */
  --on-accent:     #FFFFFF;

  /* Neutrals */
  --border-l:      #E2E8F0;

  /* Nav */
  --nav-bg:        rgba(255, 255, 255, .94);
  --nav-cta-bg:    #E8EEF5;
  --nav-cta-bg-h:  #D5DFEC;
  --nav-cta-text:  #0A1628;

  /* Hero-left ambient glow (same tokens as the home page) */
  --hero-glow-1:   rgba(37, 99, 174, .25);
  --hero-glow-2:   rgba(26, 58, 92, .40);

  /* Shape */
  --radius:        12px;
  --radius-lg:     18px;
  --nav-h:         56px;

  /* Motion */
  --ease-out-expo: cubic-bezier(.16, 1, .3, 1);
  --ease-spring:   cubic-bezier(.34, 1.56, .64, 1);
  --ease-gentle:   cubic-bezier(.25, .46, .45, .94);
}

/* ─── DARK MODE ───────────────────────────────────────────
   Same hue family, lights dimmed. Accent unchanged.
   ──────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --ink:           #E6EDF7;
  --ink-dim:       #8DA0BD;
  --surface:       #0A1321;
  --panel:         #111E37;

  --dark:          #050B17;
  --navy:          #1E3A6B;
  --blue:          #3B82F6;
  --sky:           #60A5FA;

  --accent:        #2563EB;
  --accent-dark:   #1D4ED8;
  --accent-glow:   rgba(37, 99, 235, .30);
  --accent-glow-2: rgba(37, 99, 235, .14);
  --accent-halo:   rgba(37, 99, 235, .45);
  --accent-tint:   rgba(37, 99, 235, .08);

  --border-l:      #1B2742;

  --nav-bg:        rgba(10, 19, 33, .85);
  --nav-cta-bg:    #172340;
  --nav-cta-bg-h:  #223152;
  --nav-cta-text:  #E6EDF7;

  --hero-glow-1:   rgba(37, 99, 235, .30);
  --hero-glow-2:   rgba(59, 130, 246, .22);
}

/* ─── RESET ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  font-family: 'Noto Sans', sans-serif;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .4s ease, color .4s ease;
}
a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }
ul { list-style: none; }

/* ─── NAV ────────────────────────────────────────────── */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: var(--nav-h);
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-l);
  transition: box-shadow .3s var(--ease-out-expo),
              background-color .4s ease,
              border-color .4s ease;
}
nav.scrolled { box-shadow: 0 2px 20px rgba(0,0,0,.07); }

.nav-left { display: flex; align-items: center; gap: 20px; }
.nav-logo {
  font-family: 'Noto Sans', sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -.3px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: opacity .2s, color .4s ease;
}
.nav-logo:hover { opacity: .85; }

/* ─── LOGO MARK (rhombus with 90° angles) ───────────────
   Outer diamond stroke inherits the text colour via
   currentColor (auto-themes dark-on-light / light-on-dark).
   Inner diamond stays in the accent colour across modes —
   the "gem" inside the frame.
   ──────────────────────────────────────────────────────── */
.nav-logo-mark {
  flex-shrink: 0;
  overflow: visible;
}
.nav-logo-mark .logo-outer {
  stroke: currentColor;
  stroke-width: 2;
  stroke-linejoin: round;
  fill: none;
  transition: stroke .4s ease;
}
.nav-logo-mark .logo-inner {
  fill: var(--accent);
  transform-origin: center;
  transform-box: fill-box;
  transition: fill .4s ease, transform .3s var(--ease-spring);
}
.nav-logo:hover .logo-inner { transform: scale(1.25); }

.nav-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--ink-dim);
  transition: color .4s ease;
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #22C55E;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a { font-size: 14px; color: var(--ink-dim); transition: color .2s; }

.nav-links a:not(.nav-cta) { position: relative; padding-bottom: 2px; }
.nav-links a:not(.nav-cta)::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 0; height: 1.5px;
  background: var(--accent-dark);
  border-radius: 2px;
  transition: width .25s var(--ease-out-expo), background-color .4s ease;
}
.nav-links a:not(.nav-cta):hover        { color: var(--ink); }
.nav-links a:not(.nav-cta):hover::after { width: 100%; }

.nav-active { font-weight: 600; color: var(--ink) !important; }
.nav-active:not(.nav-cta)::after { width: 100% !important; }

.nav-cta {
  font-size: 13px; font-weight: 600; padding: 8px 16px;
  background: var(--nav-cta-bg);
  color: var(--nav-cta-text) !important;
  border-radius: 8px;
  transition: background .2s, transform .15s, color .4s ease;
}
.nav-cta:hover { background: var(--nav-cta-bg-h); transform: translateY(-1px); }

/* ─── THEME TOGGLE (desktop button in nav) ──────────────
   Circular icon button. Subtle hover lift, icon rotates
   slightly for a tactile feel.
   ──────────────────────────────────────────────────────── */
.theme-toggle {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-l);
  border-radius: 50%;
  color: var(--ink-dim);
  cursor: pointer;
  padding: 0;
  transition:
    color        .25s ease,
    border-color .25s ease,
    background   .25s ease,
    transform    .3s var(--ease-spring);
}
.theme-toggle:hover {
  color: var(--accent-dark);
  border-color: var(--accent);
  background: var(--accent-glow-2);
  transform: rotate(-12deg);
}
[data-theme="dark"] .theme-toggle:hover {
  color: var(--accent);
  transform: rotate(12deg);
}
.tt-icon { display: none; }
[data-theme="light"] .tt-moon,
:root:not([data-theme="dark"]) .tt-moon { display: block; }
[data-theme="dark"]  .tt-sun  { display: block; }

/* ─── HAMBURGER ──────────────────────────────────────── */
.hamburger {
  display: none; flex-direction: column; gap: 5px;
  cursor: pointer; padding: 4px; background: none; border: none;
}
.hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--ink); border-radius: 2px;
  transition: transform .25s var(--ease-out-expo), opacity .2s, background-color .4s ease;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
  display: none;
  position: fixed;
  top: var(--nav-h); left: 0; right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border-l);
  padding: 20px 32px 24px;
  z-index: 99; flex-direction: column; gap: 4px;
  transform: translateY(-6px); opacity: 0;
  transition: transform .25s var(--ease-out-expo),
              opacity .2s,
              background-color .4s ease,
              border-color .4s ease;
}
.mobile-menu.open { display: flex; transform: translateY(0); opacity: 1; }
.mobile-menu a {
  font-size: 16px; color: var(--ink-dim);
  padding: 12px 0; border-bottom: 1px solid var(--border-l);
  transition: color .2s, border-color .4s ease;
}
.mobile-menu a:hover { color: var(--ink); }
/* :last-of-type so the final anchor (Contact) has no border
   even though the toggle button now follows it. */
.mobile-menu a:last-of-type { border-bottom: none; }

/* Mobile theme-toggle row inside the mobile menu */
.mobile-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 0 2px;
  background: none;
  border: none;
  border-top: 1px solid var(--border-l);
  margin-top: 6px;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink-dim);
  cursor: pointer;
  transition: color .2s, border-color .4s ease;
}
.mobile-theme-toggle:hover { color: var(--accent-dark); }
[data-theme="dark"] .mobile-theme-toggle:hover { color: var(--accent); }
.mtt-label-light,
.mtt-label-dark { display: none; }
[data-theme="light"] .mtt-label-light,
:root:not([data-theme="dark"]) .mtt-label-light { display: inline; }
[data-theme="dark"]  .mtt-label-dark  { display: inline; }
.mtt-icon-wrap {
  width: 30px; height: 30px;
  border: 1px solid var(--border-l);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  transition: border-color .2s;
}
.mobile-theme-toggle:hover .mtt-icon-wrap { border-color: var(--accent); }

/* ─── MAIN TWO-COLUMN LAYOUT ─────────────────────────── */
.work-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  padding-top: var(--nav-h);
}

/* ─── LEFT PANEL ─────────────────────────────────────── */
.work-left {
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  background: var(--dark);
  overflow: hidden;
  display: flex;
  align-items: stretch;
  transition: background-color .4s ease;
}
.work-left::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 30% 40%, var(--hero-glow-1) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 80% 70%, var(--hero-glow-2) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
}
.work-left > img:not(.featured-img) {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  opacity: .45; z-index: 0;
}
.featured-placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .4s ease; z-index: 1;
}
.featured-placeholder.visible { opacity: 1; }
.featured-placeholder-inner {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; text-align: center; padding: 32px;
}
.featured-icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: rgba(255,255,255,.08); border: 1.5px solid rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center; margin-bottom: 4px;
}
.featured-placeholder-label {
  font-family: 'Noto Sans', sans-serif; font-size: 14px;
  font-weight: 700; color: rgba(255,255,255,.5);
}
.featured-placeholder-hint { font-size: 12px; color: rgba(255,255,255,.3); line-height: 1.6; }
.featured-placeholder-hint code {
  font-family: monospace; font-size: 11px;
  background: rgba(255,255,255,.08); padding: 1px 5px;
  border-radius: 4px; color: var(--sky);
}
.featured-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .5s var(--ease-gentle);
  pointer-events: none; z-index: 1;
}
.featured-img.visible { opacity: 1; }
.featured-caption {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 48px 28px 24px;
  /* The panel stays dark in both modes, so this hardcoded
     near-black gradient is intentional and correct. */
  background: linear-gradient(to top, rgba(10,18,30,.8) 0%, transparent 100%);
  opacity: 0; transform: translateY(6px);
  transition: opacity .35s var(--ease-gentle), transform .35s var(--ease-gentle);
  pointer-events: none; z-index: 2;
}
.featured-caption.visible { opacity: 1; transform: translateY(0); }
.featured-caption-text {
  font-size: 13px; font-weight: 600;
  color: rgba(255,255,255,.9); letter-spacing: .2px;
}

/* ─── RIGHT PANEL ────────────────────────────────────── */
.work-right {
  display: flex; flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border-l);
  transition: background-color .4s ease, border-color .4s ease;
}

/* ── Work header ─────────────────────────────────────── */
.work-header {
  padding: 52px 60px 36px;
  border-bottom: 1px solid var(--border-l);
  transition: border-color .4s ease;
}
.work-heading {
  font-family: 'Noto Sans', sans-serif;
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 700; color: var(--ink);
  letter-spacing: -1px; line-height: 1.1; margin-bottom: 16px;
  transition: color .4s ease;
}
.work-sub {
  font-size: 15px; line-height: 1.65; color: var(--ink-dim);
  transition: color .4s ease;
}
.work-sub + .work-sub { margin-top: 2px; }

/* ── Project list ────────────────────────────────────── */
.project-list { display: flex; flex-direction: column; flex: 1; }

.project-row {
  display: flex; align-items: center; gap: 20px;
  padding: 24px 60px;
  border-bottom: 1px solid var(--border-l);
  cursor: pointer;
  transition: background .2s var(--ease-gentle), border-color .4s ease;
  position: relative;
}
.project-row:hover { background: var(--panel); }
.project-row:hover .project-arrow { opacity: 1; transform: translate(0, 0); }
.project-row:hover .project-name  { color: var(--blue); }

.project-info { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.project-name {
  font-family: 'Noto Sans', sans-serif; font-size: 24px; font-weight: 700;
  color: var(--ink); letter-spacing: -.3px;
  transition: color .2s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.project-desc {
  font-size: 15px; color: var(--ink-dim); line-height: 1.5;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .4s ease;
}
.project-tag {
  font-size: 12px; font-weight: 600; color: var(--ink-dim);
  white-space: nowrap; flex-shrink: 0; letter-spacing: .2px;
  padding: 4px 10px; border: 1px solid var(--border-l);
  border-radius: 20px; background: var(--surface);
  transition: border-color .2s, color .2s, background .2s;
}
.project-row:hover .project-tag {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--accent-tint);
}
/* Default bg uses --accent to avoid a colour flash during the
   fade-in transition in dark mode (where --ink is light). */
.project-arrow {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; opacity: 0; transform: translate(-4px, 4px);
  transition: opacity .2s, transform .25s var(--ease-spring), background .2s;
}
.project-row:hover .project-arrow { background: var(--blue); }

/* ── CTA strip ───────────────────────────────────────── */
.work-cta-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 36px 60px;
  border-top: 1px solid var(--border-l);
  flex-wrap: wrap;
  transition: border-color .4s ease;
}
.work-cta-copy { font-size: 15px; color: var(--ink-dim); transition: color .4s ease; }

/* ── Button — desktop base ───────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  width: auto;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 16px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s, transform .2s var(--ease-spring), box-shadow .2s;
}
.btn-primary:hover {
  background: var(--accent-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-halo);
}
.btn-primary:active { transform: translateY(0); }

/* ── Footer ──────────────────────────────────────────── */
.work-footer {
  padding: 28px 60px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  border-top: 1px solid var(--border-l);
  transition: border-color .4s ease;
}
.footer-copy { font-size: 12px; color: var(--ink-dim); transition: color .4s ease; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { font-size: 12px; color: var(--ink-dim); transition: color .2s; }
.footer-links a:hover { color: var(--ink); }

/* ═══════════════════════════════════════════════════════
   RESPONSIVE  960 → 768 → 480
   ═══════════════════════════════════════════════════════ */

@media (max-width: 960px) {
  .work-layout         { grid-template-columns: 1fr; }
  .work-right          { border-left: none; }

  .work-left {
    position: relative; top: auto;
    height: 52vw; min-height: 280px;
    border-bottom: 1px solid var(--border-l);
  }
  .featured-img        { pointer-events: none; }

  .work-header         { padding: 40px 36px 28px; }
  .project-row         { padding: 20px 36px; }

  /* Strip: stacked column, fixed 36px horizontal padding each side */
  .work-cta-strip {
    padding: 28px 36px;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  /* Button: explicit fixed width of 260px — does not depend on container */
  .btn-primary {
    width: 260px;
    max-width: 260px;
    justify-content: center;
    font-size: 16px;
  }

  .work-footer         { padding: 24px 36px; }
}

@media (max-width: 768px) {
  nav                  { padding: 0 20px; }
  .nav-links,
  .nav-status,
  .nav-cta             { display: none; }
  /* Desktop theme-toggle lives inside .nav-links so it collapses
     with the rest; the mobile menu hosts its own toggle row. */
  .hamburger           { display: flex; }

  .work-left           { height: 56vw; min-height: 240px; }
  .work-left > img:not(.featured-img) { object-position: center 30%; }

  .work-header         { padding: 32px 24px 24px; }
  .work-sub            { font-size: 14px; }

  .project-row         { padding: 18px 24px; gap: 12px; }
  .project-name        { font-size: 18px; }
  .project-desc        { font-size: 14px; }
  .project-tag         { display: none; }
  .project-arrow       { opacity: 1; transform: none; }

  /* Strip: same column layout, tighter vertical padding, same 24px horizontal */
  .work-cta-strip {
    padding: 24px 24px;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  /* Button: explicit fixed width of 220px — smaller than 960px but still readable */
  .btn-primary {
    width: 220px;
    max-width: 220px;
    justify-content: center;
    font-size: 15px;
  }

  .work-footer         { padding: 20px 24px; flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .work-left           { height: 60vw; min-height: 200px; }
  .work-heading        { font-size: 28px; letter-spacing: -.5px; }

  .project-row         { padding: 16px 20px; gap: 10px; }
  .project-name        { font-size: 16px; }
  .project-desc        { font-size: 13px; }
  .featured-caption-text { font-size: 12px; }

  /* Strip: tightest padding at small phones */
  .work-cta-strip {
    padding: 20px 20px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  /* Button: explicit fixed width of 200px on small phones */
  .btn-primary {
    width: 200px;
    max-width: 200px;
    justify-content: center;
    font-size: 14px;
  }
}
