/* ─────────────────────────────────────────────────────────
   SHARED DESIGN SYSTEM
   Tokens, fonts, and site-wide chrome (nav, footer, cursor)
   used by every page. Linked before each page's own <style>
   block, so page-specific rules still win the cascade.
   ───────────────────────────────────────────────────────── */

/* ─── Fonts ─── */
@font-face {
  font-family: 'Geist';
  src: url('../Fonts/Geist/Geist[wght].woff2') format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Geist';
  src: url('../Fonts/Geist/Geist-Italic[wght].woff2') format('woff2');
  font-weight: 100 900; font-style: italic; font-display: swap;
}

/* ─── Tokens ─── */
:root {
  --bg:          #FBF9F9;
  --text:        #2a2a2b;
  --text2:       #666767;
  --text-muted:  #989799;
  --text3:       #989799; /* alias of --text-muted, kept for existing case-study usage */
  --border:      #d5d5d6;
  --surface:     #fcfafd;
  --border-card: #dddddd;
  --purple:      #6a5acd;
  --font-serif:  'Geist', sans-serif;
  --font-sans:   'Geist', sans-serif;
  --ease-soft:   cubic-bezier(0.23, 1, 0.32, 1);
}

/* ─── Reset ─── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  cursor: none !important;
}

html { scroll-behavior: smooth; overflow-x: hidden; }
body { background: var(--bg); color: var(--text); font-family: var(--font-sans); overflow-x: hidden; max-width: 100vw; }

/* ─── RISO GRAIN TEXTURE ─── */
body::before {
  content: "";
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9990;
  pointer-events: none;
  opacity: 0.09;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.55' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 1.4 -0.25'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
}

/* ─── NAV ─── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  background: var(--bg);
}
.nav-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo, .nav-logo a {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 15px;
  line-height: 22px;
  letter-spacing: -0.01em;
  color: rgb(50, 64, 79);
  text-decoration: none;
  display: block;
}
.nav-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}
.nav-links {
  display: flex;
  gap: 8px;
  align-items: center;
}
.nav-links a {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 400;
  line-height: 22px;
  color: rgb(50, 64, 79);
  text-decoration: none;
  padding: 0 8px;
  transition: color 0.25s ease;
}
.nav-links a:hover { color: #b8b8b8; }
.nav-clock {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 400;
  line-height: 22px;
  color: rgb(50, 64, 79);
  white-space: nowrap;
  text-decoration: none;
  transition: color 0.25s ease;
}
.nav-clock:hover { color: #b8b8b8; }

/* ─── FOOTER (shared chrome; each page still sets its own footer margin-top/position for layout) ─── */
footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 258px;
  padding: 64px 120px;
}
.footer-inner {
  width: 100%;
  max-width: 1200px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}
.footer-heading {
  font-family: var(--font-serif);
  font-size: 40px;
  font-weight: 300;
  line-height: 48px;
  color: var(--text);
  padding: 8px;
  transition: color 0.25s ease;
  text-wrap: balance;
}
.footer-heading:hover { color: var(--text-muted); }
.footer-links {
  display: flex;
  gap: 28px;
  align-items: center;
  padding: 12px 0;
}
.footer-links a {
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 300;
  line-height: 24px;
  color: var(--text);
  text-decoration: none;
  padding: 12px 8px;
  white-space: nowrap;
  transition: color 0.25s ease;
}
.footer-links a:hover { color: var(--text-muted); }

/* ─── CURSOR (baseline shell; index.html extends this with a hover-label pill) ─── */
#cursor {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 9999;
  width: 20px;
  height: auto;
}
#cursor img {
  width: 100%;
  height: auto;
  display: block;
  transform: rotate(-15deg);
}

/* ─── PAGE LAYOUT (fixed bio sidebar + content column) ───
   Used by index.html and any page opting into the sidebar
   (case studies, about, ai-workflow). */
.page-layout {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 60px;
  padding: 40px 20px 172px;
}
.sidebar {
  position: fixed;
  top: 90px;
  left: 20px;
  height: calc(100vh - 90px);
  width: 360px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.sidebar-divider {
  width: 410px;
  margin-left: -20px;
  height: 1px;
  background: var(--border);
  border: none;
  margin-top: 20px;
}
.hero-text {
  font-family: var(--font-serif);
  font-size: 38px;
  font-weight: 400;
  line-height: 40px;
  color: var(--text);
  text-wrap: balance;
}
.hero-subtext {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 300;
  line-height: 22px;
  color: var(--text2);
}
.col-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 410px;
  width: 1px;
  background: var(--border);
}
.main-col {
  flex: 1;
  min-width: 0;
  margin-left: 420px;
  display: flex;
  flex-direction: column;
  gap: 140px;
}
.experience {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
}
.experience-row {
  display: flex;
  gap: 12px;
}
.experience-year {
  width: 40px;
  flex-shrink: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 300;
  line-height: 20px;
  color: var(--text2);
}
.experience-detail {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.experience-company {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  color: var(--text);
}
.experience-role {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 300;
  line-height: 20px;
  color: var(--text2);
}
.sidebar-cta {
  margin-top: auto;
  margin-bottom: 40px;
  align-self: center;
  display: inline-flex;
  align-items: center;
  padding: 12px 20px;
  border: 1px solid var(--text);
  border-radius: 100px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}
.sidebar-cta:hover {
  background: var(--text);
  color: var(--bg);
}

@media (max-width: 960px) {
  .page-layout { flex-direction: column; gap: 60px; }
  .sidebar { position: static; width: 100%; height: auto; left: auto; overflow: visible; }
  .main-col { margin-left: 0; }
  .col-divider { display: none; }
  .sidebar-divider { width: 100%; margin-left: 0; }
}

/* ─── SPLIT-SCROLL LAYOUT (Figma) ───
   Used by index.html and about.html: a chrome nav + two independently-
   scrolling columns (sidebar card stack + main content), each column
   capped to the viewport height with its own hidden scrollbar. Opt in
   by giving <nav> the .home-nav class and wrapping content in
   .home-wrap > .home-layout > aside.sidebar + .home-right. */
.home-nav {
  height: 64px;
  padding: 0 40px;
  border-bottom-color: #ececec;
  background: #fffffe;
}
.home-nav .nav-avatar { display: none; }
.home-nav .nav-logo, .home-nav .nav-logo a {
  font-weight: 400;
  font-size: 16px;
  line-height: 24px;
  color: #2a2a2b;
}
.home-nav .nav-links { gap: 16px; }
.home-nav .nav-links a {
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
  color: #2a2a2b;
  padding: 0;
}
.home-nav .nav-links a:hover { color: #b8b8b8; }
.home-nav .nav-clock {
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
  color: #2a2a2b;
}
.home-nav .nav-clock:hover { color: #b8b8b8; }

.home-wrap {
  background: #fffffe;
  height: calc(100vh - 64px);
  overflow: hidden;
}
.home-layout {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 64px;
  max-width: 1360px;
  height: 100%;
  margin: 0 auto;
  padding: 0 40px;
}
.home-layout .sidebar {
  position: static;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 40px 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 360px;
  flex-shrink: 0;
}
.home-layout .sidebar::-webkit-scrollbar { display: none; }
.home-photo {
  height: 391px;
  flex-shrink: 0;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}
.home-photo img {
  position: absolute;
  left: 0;
  top: -11.16%;
  width: 100%;
  height: 122.76%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.home-photo img.media-loaded { opacity: 1; }
.home-intro {
  background: #f6f6f6;
  height: 391px;
  flex-shrink: 0;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.home-intro-title {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 38px;
  line-height: 44px;
  color: #2a2a2b;
  width: 100%;
  text-wrap: balance;
}
.home-intro-body {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 16px;
  line-height: 24px;
  color: #575757;
  width: 100%;
}
.home-cta {
  background: #2a2a2b;
  height: 73px;
  flex-shrink: 0;
  border-radius: 12px;
  padding: 12px 20px;
  display: flex;
  align-items: flex-end;
  text-decoration: none;
  transition: background 0.2s ease;
  position: relative;
  overflow: visible;
}
.home-cta:hover { background: #444445; }
.home-cta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  position: relative;
  z-index: 1;
}
.home-cta-text {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 38px;
  line-height: 44px;
  color: #fffffe;
  white-space: nowrap;
}
.home-cta-row svg { flex-shrink: 0; width: 24px; height: 24px; fill: #fffffe; }

/* ─── CTA FLUID CANVAS (assets/cta-fluid.js) ─── */
.home-cta canvas {
  position: absolute;
  inset: -10px;
  width: calc(100% + 20px);
  height: calc(100% + 20px);
  display: block;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 0;
}
.home-cta canvas.fluid-active { opacity: 1; }
.home-cta.fluid-bg-hidden { background: transparent !important; }
@media (prefers-reduced-motion: reduce) {
  .home-cta canvas { display: none; }
}

.home-right {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 40px 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
  min-width: 0;
}
.home-right::-webkit-scrollbar { display: none; }

.proj-card:focus-visible,
.home-cta:focus-visible {
  outline-offset: 4px;
  border-radius: 10px;
}

@media (max-width: 1040px) {
  .home-wrap { height: auto; overflow: visible; }
  .home-layout { flex-direction: column; align-items: stretch; height: auto; gap: 40px; padding: 32px 24px 96px; }
  /* display: contents lets the sidebar's children (intro content + CTA) and
     .home-right become siblings in the same flex flow, so `order` below can
     push the CTA below the main content once everything stacks on mobile. */
  .home-layout .sidebar { position: static; height: auto; overflow-y: visible; padding: 0; left: auto; top: auto; width: 100%; display: contents; }
  .home-right { height: auto; overflow-y: visible; padding: 0; width: 100%; order: 1; }
  .home-cta { order: 2; }
}

@media (max-width: 768px) {
  .home-nav { height: auto; padding: 16px 20px; }
  .home-nav .nav-links { display: none; }
  .home-nav .nav-clock { display: none; }
}

@media (max-width: 640px) {
  .home-photo { height: 320px; }
  .home-intro { height: auto; padding: 24px 20px; }
  .home-intro-title { font-size: 28px; line-height: 34px; }
  .home-cta { height: auto; padding: 20px; }
  .home-cta-text { font-size: 28px; line-height: 34px; }
  .home-layout { padding: 24px 16px 64px; }
}

/* ─── CASE STUDY CONTEXT (sidebar block under the bio, replaces the
   old back-button + TOC sidebar) ─── */
.cs-context {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 20px;
}
.cs-context-back {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  color: var(--text2);
  text-decoration: none;
  transition: color 0.2s ease;
}
.cs-context-back:hover { color: var(--text); }
.cs-context-back svg { flex-shrink: 0; }
.cs-context-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  row-gap: 12px;
  column-gap: 12px;
}
.cs-context-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cs-context-label {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 300;
  line-height: 18px;
  color: var(--text-muted);
}
.cs-context-value {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 300;
  line-height: 20px;
  color: var(--text);
}
.cs-context-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.cs-context-link {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 300;
  line-height: 20px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
  overflow-wrap: break-word;
}
.cs-context-link:hover { color: var(--text2); }
.cs-context-link.active { color: var(--text); font-weight: 400; }

@media (max-width: 960px) {
  .cs-context { flex-direction: row; flex-wrap: wrap; gap: 24px 40px; }
  .cs-context-nav { flex-direction: row; flex-wrap: wrap; border-top: none; padding-top: 0; }
}

/* ─── CASE STUDY V2 TYPOGRAPHY (Katarina Blind-inspired system) ───
   Scoped under .cs-v2 (added to <body>) so it only applies to pages
   that have been migrated to the new centered-container system —
   the other case studies keep their own local styles until migrated. */
.cs-v2 .cs-main {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  gap: 0;
}
.cs-v2 .hero-img { border-radius: 20px; margin-bottom: 64px; }
.cs-v2 .cs-intro-title {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: clamp(1.875rem, 1.1rem + 3vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text);
  text-align: center;
  max-width: 640px;
  margin: 0 auto;
}
.cs-v2 .cs-content { gap: 0; }
.cs-v2 .section-break {
  padding: 40px 0;
  border-bottom: 1px solid var(--border);
}
.cs-v2 .label {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 300;
  line-height: 20px;
  letter-spacing: 0.01em;
  color: #b8b8b8;
  text-align: left;
}
.cs-v2 .section-header { gap: 14px; align-items: flex-start; text-align: left; }
.cs-v2 .section-heading {
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.015em;
  font-size: 24px;
  line-height: 30px;
  text-align: left;
}
.cs-v2 .section-body {
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 16px;
  line-height: 24px;
  letter-spacing: -0.005em;
  color: #575757;
  max-width: none;
  margin: 0;
  text-align: left;
}

/* ─── ACCESSIBILITY ─── */
:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* ─── RESPONSIVE (shared nav/footer chrome only) ─── */
@media (max-width: 768px) {
  nav { height: auto; padding: 16px 20px; }
  footer { height: auto; padding: 48px 24px; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 24px; }
  .footer-heading { font-size: 32px; line-height: 40px; }
  .footer-links a { font-size: 16px; }
  #cursor { display: none; }
}
