/*
  Ranjith Vutnoor — Portfolio
  Calm, accessible, dependency-free design system.
*/

:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --bg-elevated: #fbfcfa;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --surface-muted: #edf1ed;
  --text: #17211d;
  --text-muted: #5f6d66;
  --text-soft: #7f8b85;
  --border: rgba(23, 33, 29, 0.11);
  --border-strong: rgba(23, 33, 29, 0.2);
  --accent: #24695a;
  --accent-strong: #185345;
  --accent-soft: #dcebe5;
  --accent-blue: #49677d;
  --highlight: #d7e7df;
  --shadow-sm: 0 1px 2px rgba(17, 30, 24, 0.05), 0 8px 24px rgba(17, 30, 24, 0.04);
  --shadow-md: 0 18px 50px rgba(21, 42, 32, 0.1);
  --shadow-lg: 0 30px 90px rgba(21, 42, 32, 0.14);
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --radius-xl: 40px;
  --container: 1180px;
  --header-height: 74px;
  --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(0.2, 0.75, 0.25, 1);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101713;
  --bg-elevated: #141d18;
  --surface: rgba(24, 35, 29, 0.76);
  --surface-solid: #18231d;
  --surface-muted: #1c2922;
  --text: #edf4ef;
  --text-muted: #aab8b0;
  --text-soft: #809087;
  --border: rgba(236, 246, 239, 0.1);
  --border-strong: rgba(236, 246, 239, 0.2);
  --accent: #75b9a5;
  --accent-strong: #9ad1bf;
  --accent-soft: #1e3a31;
  --accent-blue: #8facbf;
  --highlight: #23483c;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.16), 0 8px 26px rgba(0, 0, 0, 0.16);
  --shadow-md: 0 20px 55px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 34px 100px rgba(0, 0, 0, 0.38);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 12% 0%, rgba(72, 123, 104, 0.1), transparent 34rem),
    radial-gradient(circle at 88% 12%, rgba(74, 103, 125, 0.08), transparent 30rem),
    var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 180ms ease, color 180ms ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background-image:
    linear-gradient(rgba(54, 81, 68, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(54, 81, 68, 0.025) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}

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

button,
a,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent-strong);
}

button {
  color: inherit;
}

::selection {
  background: var(--highlight);
  color: var(--text);
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 5px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1000;
  padding: 10px 14px;
  transform: translateY(-160%);
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 999;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-blue));
  transition: width 60ms linear;
}

.container {
  width: min(calc(100% - 40px), var(--container));
  margin-inline: auto;
}

.narrow {
  width: min(calc(100% - 40px), 790px);
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  border-bottom: 1px solid transparent;
  background: color-mix(in srgb, var(--bg) 76%, transparent);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.site-header.is-scrolled {
  border-color: var(--border);
  box-shadow: 0 6px 28px rgba(23, 33, 29, 0.05);
}

.nav-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 720;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: linear-gradient(145deg, var(--surface-solid), var(--accent-soft));
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 820;
  letter-spacing: -0.03em;
  box-shadow: var(--shadow-sm);
}

.brand-label {
  white-space: nowrap;
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  position: relative;
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  padding: 8px 12px;
  color: var(--text-muted);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 610;
  text-decoration: none;
  transition: color 160ms ease, background-color 160ms ease;
}

.nav-link:hover,
.nav-link[aria-current="page"] {
  color: var(--text);
  background: var(--surface);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  transition: transform 160ms var(--ease), border-color 160ms ease, background-color 160ms ease;
}

.icon-button:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: var(--surface-solid);
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.menu-button {
  display: none;
}

.mobile-panel {
  display: none;
  position: fixed;
  inset: var(--header-height) 0 auto;
  z-index: 99;
  padding: 14px 20px 24px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-md);
}

.mobile-panel.is-open {
  display: grid;
  gap: 6px;
}

.mobile-panel .nav-link {
  min-height: 48px;
  font-size: 16px;
}

.hero {
  position: relative;
  padding: clamp(78px, 10vw, 132px) 0 74px;
  overflow: clip;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(290px, 0.65fr);
  gap: clamp(48px, 8vw, 104px);
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 18px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: currentColor;
}

.hero h1 {
  max-width: 850px;
  margin: 0;
  font-size: clamp(3rem, 7vw, 6.1rem);
  line-height: 0.98;
  letter-spacing: -0.062em;
  font-weight: 760;
}

.hero h1 .quiet {
  color: var(--text-muted);
  font-weight: 560;
}

.hero-copy {
  max-width: 730px;
  margin: 28px 0 0;
  color: var(--text-muted);
  font-size: clamp(1.05rem, 1.8vw, 1.28rem);
  line-height: 1.72;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 17px;
  border: 1px solid var(--border-strong);
  border-radius: 13px;
  background: var(--surface-solid);
  color: var(--text);
  font-size: 14px;
  font-weight: 710;
  line-height: 1;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 170ms var(--ease), box-shadow 170ms ease, background-color 170ms ease, border-color 170ms ease;
}

.button:hover {
  transform: translateY(-2px);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.button-primary {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  color: #ffffff;
}

[data-theme="dark"] .button-primary {
  color: #10211a;
  background: var(--accent-strong);
}

.button-primary:hover {
  color: #ffffff;
  background: var(--accent);
}

[data-theme="dark"] .button-primary:hover {
  color: #10211a;
}

.button-ghost {
  background: transparent;
  box-shadow: none;
}

.button svg {
  width: 17px;
  height: 17px;
}

.availability {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-top: 24px;
  color: var(--text-soft);
  font-size: 13px;
}

.availability-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #4d9a78;
  box-shadow: 0 0 0 5px rgba(77, 154, 120, 0.12);
}

.hero-card {
  position: relative;
  min-height: 420px;
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(150deg, color-mix(in srgb, var(--surface-solid) 88%, transparent), color-mix(in srgb, var(--accent-soft) 55%, transparent));
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.hero-card::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  right: -110px;
  bottom: -110px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  box-shadow:
    0 0 0 28px rgba(82, 128, 110, 0.05),
    0 0 0 60px rgba(82, 128, 110, 0.035);
}

.hero-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.monogram {
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  background: var(--surface-solid);
  color: var(--accent-strong);
  font-size: 25px;
  font-weight: 820;
  letter-spacing: -0.06em;
  box-shadow: var(--shadow-md);
}

.hero-card-label {
  max-width: 150px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  text-align: right;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-card-body {
  position: relative;
  z-index: 1;
  margin-top: 70px;
}

.hero-card-title {
  margin: 0;
  max-width: 310px;
  font-size: 1.58rem;
  line-height: 1.25;
  letter-spacing: -0.035em;
}

.hero-card-text {
  max-width: 310px;
  margin: 14px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.hero-card-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 22px;
}

.pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-solid) 72%, transparent);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1;
}

.metrics-band {
  padding: 14px 0 86px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.metric {
  padding: 24px 26px;
  border-right: 1px solid var(--border);
}

.metric:last-child {
  border-right: 0;
}

.metric-value {
  display: block;
  color: var(--text);
  font-size: clamp(1.65rem, 3vw, 2.3rem);
  font-weight: 760;
  line-height: 1.1;
  letter-spacing: -0.045em;
}

.metric-label {
  display: block;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.section {
  padding: 98px 0;
}

.section-sm {
  padding: 72px 0;
}

.section-muted {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elevated) 86%, transparent);
}

.section-header {
  display: grid;
  grid-template-columns: 0.65fr 1.35fr;
  gap: 40px;
  align-items: end;
  margin-bottom: 48px;
}

.section-kicker {
  margin: 0;
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-title {
  margin: 0;
  max-width: 760px;
  font-size: clamp(2rem, 4.2vw, 4rem);
  line-height: 1.06;
  letter-spacing: -0.05em;
  font-weight: 720;
}

.section-description {
  max-width: 740px;
  margin: 18px 0 0;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -16px 0 28px;
}

.filter-button {
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: all 160ms ease;
}

.filter-button:hover,
.filter-button.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 440px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 220ms var(--ease), box-shadow 220ms ease, border-color 220ms ease;
}

.project-card:hover {
  transform: translateY(-5px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.project-card[hidden] {
  display: none;
}

.project-visual {
  display: grid;
  place-items: center;
  min-height: 190px;
  margin: -4px -4px 22px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--accent-soft) 75%, var(--surface-solid)), var(--surface-muted));
  overflow: hidden;
}

.project-visual img {
  width: 100%;
  height: 190px;
  object-fit: cover;
}

.project-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.project-title {
  margin: 14px 0 0;
  font-size: 1.42rem;
  line-height: 1.22;
  letter-spacing: -0.035em;
}

.project-copy {
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.project-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: auto;
  padding-top: 20px;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 720;
  text-decoration: none;
}

.text-link:hover {
  gap: 10px;
}

.text-link svg {
  width: 15px;
  height: 15px;
  transition: transform 160ms var(--ease);
}

.text-link:hover svg {
  transform: translateX(2px);
}

.experience-layout {
  display: grid;
  grid-template-columns: minmax(250px, 0.65fr) minmax(0, 1.35fr);
  gap: clamp(40px, 8vw, 96px);
}

.sticky-note {
  position: sticky;
  top: calc(var(--header-height) + 34px);
  align-self: start;
}

.sticky-note p {
  color: var(--text-muted);
}

.timeline {
  display: grid;
  gap: 0;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 30px;
  padding: 0 0 44px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  top: 9px;
  left: 164px;
  bottom: -8px;
  width: 1px;
  background: var(--border);
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-item::after {
  content: "";
  position: absolute;
  top: 7px;
  left: 159px;
  width: 11px;
  height: 11px;
  border: 3px solid var(--bg-elevated);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--border-strong);
}

.timeline-period {
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
}

.timeline-content {
  padding-left: 18px;
}

.timeline-content h3 {
  margin: 0;
  font-size: 1.22rem;
  letter-spacing: -0.025em;
}

.timeline-company {
  margin: 5px 0 0;
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 680;
}

.timeline-content p {
  margin: 13px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.clean-list {
  display: grid;
  gap: 9px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.clean-list li {
  position: relative;
  padding-left: 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.clean-list li::before {
  content: "";
  position: absolute;
  top: 0.72em;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.skill-card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.skill-card h3 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.skill-card p {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.skill-card .skill-index {
  display: block;
  margin-bottom: 24px;
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 11px;
}

.writing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.article-card {
  display: flex;
  flex-direction: column;
  min-height: 310px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  text-decoration: none;
  transition: transform 180ms var(--ease), border-color 180ms ease, box-shadow 180ms ease;
}

.article-card:hover {
  transform: translateY(-4px);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.article-state {
  align-self: flex-start;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 760;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.article-card h3 {
  margin: 28px 0 0;
  font-size: 1.27rem;
  line-height: 1.28;
  letter-spacing: -0.03em;
}

.article-card p {
  margin: 14px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.article-card time {
  margin-top: auto;
  padding-top: 24px;
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 11px;
}

.beyond-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.beyond-card {
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.beyond-card h3 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
}

.beyond-card p {
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.contact-card {
  position: relative;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 50px;
  padding: clamp(34px, 6vw, 68px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 100% 100%, rgba(69, 113, 95, 0.15), transparent 26rem),
    var(--surface-solid);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.contact-card h2 {
  margin: 0;
  font-size: clamp(2.1rem, 4.5vw, 4.5rem);
  line-height: 1;
  letter-spacing: -0.055em;
}

.contact-card p {
  max-width: 650px;
  margin: 20px 0 0;
  color: var(--text-muted);
  font-size: 1.02rem;
}

.contact-actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.contact-link {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 15px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  text-decoration: none;
  transition: transform 160ms var(--ease), border-color 160ms ease;
}

.contact-link:hover {
  transform: translateX(3px);
  color: var(--text);
  border-color: var(--border-strong);
}

.contact-link-label {
  display: block;
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.contact-link-value {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  font-weight: 650;
}

.site-footer {
  padding: 34px 0 44px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  color: var(--text-soft);
  font-size: 12px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.footer-links a {
  text-decoration: none;
}

/* Case studies */
.case-hero {
  padding: 80px 0 58px;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--text-soft);
  font-size: 12px;
}

.breadcrumbs a {
  text-decoration: none;
}

.case-title {
  max-width: 960px;
  margin: 28px 0 0;
  font-size: clamp(2.6rem, 7vw, 6.2rem);
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.case-lead {
  max-width: 780px;
  margin: 28px 0 0;
  color: var(--text-muted);
  font-size: clamp(1.08rem, 2vw, 1.32rem);
}

.case-facts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin-top: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--border);
  overflow: hidden;
}

.case-fact {
  padding: 20px;
  background: var(--surface-solid);
}

.case-fact-label {
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.case-fact-value {
  margin-top: 7px;
  font-size: 14px;
  font-weight: 680;
}

.case-cover {
  margin-top: 50px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface-muted);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.case-cover img {
  width: 100%;
  min-height: 300px;
  object-fit: cover;
}

.case-body {
  display: grid;
  grid-template-columns: 230px minmax(0, 760px);
  gap: clamp(38px, 8vw, 96px);
  justify-content: center;
  padding: 90px 0 110px;
}

.case-nav {
  position: sticky;
  top: calc(var(--header-height) + 34px);
  align-self: start;
}

.case-nav-title {
  margin: 0 0 14px;
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.case-nav a {
  display: block;
  padding: 7px 0;
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: none;
}

.case-nav a:hover {
  color: var(--accent-strong);
}

.prose {
  min-width: 0;
}

.prose > :first-child {
  margin-top: 0;
}

.prose h2 {
  margin: 72px 0 18px;
  font-size: clamp(1.7rem, 3vw, 2.45rem);
  line-height: 1.15;
  letter-spacing: -0.04em;
}

.prose h3 {
  margin: 38px 0 12px;
  font-size: 1.25rem;
  letter-spacing: -0.025em;
}

.prose p,
.prose li {
  color: var(--text-muted);
}

.prose strong {
  color: var(--text);
}

.prose ul,
.prose ol {
  padding-left: 1.35rem;
}

.prose li + li {
  margin-top: 8px;
}

.prose code {
  padding: 2px 5px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 0.86em;
}

.prose blockquote {
  margin: 32px 0;
  padding: 20px 24px;
  border-left: 3px solid var(--accent);
  border-radius: 0 14px 14px 0;
  background: var(--surface);
  color: var(--text-muted);
}

.prose table {
  width: 100%;
  margin: 30px 0;
  border-collapse: collapse;
  font-size: 13px;
}

.prose th,
.prose td {
  padding: 12px 13px;
  border: 1px solid var(--border);
  text-align: left;
}

.prose th {
  background: var(--surface-muted);
  color: var(--text);
}

.callout {
  margin: 34px 0;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.callout-title {
  display: block;
  margin-bottom: 8px;
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.architecture-flow {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 30px 0;
}

.flow-step {
  position: relative;
  min-height: 112px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-size: 12px;
}

.flow-step::after {
  content: "→";
  position: absolute;
  right: -9px;
  top: 42%;
  color: var(--text-soft);
  z-index: 2;
}

.flow-step:last-child::after {
  display: none;
}

.flow-step strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

.next-project {
  padding: 0 0 100px;
}

.next-project-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-decoration: none;
  transition: transform 180ms var(--ease), box-shadow 180ms ease;
}

.next-project-card:hover {
  transform: translateY(-3px);
  color: var(--text);
  box-shadow: var(--shadow-md);
}

.next-project-card small {
  display: block;
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.next-project-card h2 {
  margin: 8px 0 0;
  font-size: 1.6rem;
  letter-spacing: -0.035em;
}

/* Writing page */
.writing-hero {
  padding: 86px 0 55px;
}

.writing-hero h1 {
  margin: 0;
  max-width: 870px;
  font-size: clamp(3rem, 7vw, 6.4rem);
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.writing-hero p {
  max-width: 680px;
  margin: 26px 0 0;
  color: var(--text-muted);
  font-size: 1.15rem;
}

.note-list {
  display: grid;
  gap: 12px;
  padding: 30px 0 100px;
}

.note-item {
  display: grid;
  grid-template-columns: 130px 1fr auto;
  gap: 24px;
  align-items: center;
  min-height: 110px;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  text-decoration: none;
  transition: transform 160ms var(--ease), border-color 160ms ease;
}

.note-item:hover {
  transform: translateX(4px);
  color: var(--text);
  border-color: var(--border-strong);
}

.note-topic {
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.note-item h2 {
  margin: 0;
  font-size: 1.12rem;
  letter-spacing: -0.025em;
}

.note-item p {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.note-state {
  color: var(--text-soft);
  font-size: 11px;
}

/* Command palette */
.command-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: min(14vh, 120px) 20px 20px;
  background: rgba(7, 12, 9, 0.5);
  backdrop-filter: blur(8px);
}

.command-overlay.is-open {
  display: flex;
}

.command-dialog {
  width: min(100%, 620px);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  background: var(--surface-solid);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.command-search {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.command-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
}

.command-results {
  max-height: 430px;
  overflow-y: auto;
  padding: 8px;
}

.command-item {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 48px;
  padding: 9px 11px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  text-align: left;
  cursor: pointer;
}

.command-item:hover,
.command-item.is-selected {
  background: var(--surface-muted);
  color: var(--text);
}

.command-item small {
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 10px;
}

.command-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 10px;
}

kbd {
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-bottom-color: var(--border-strong);
  border-radius: 5px;
  background: var(--surface-muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 700;
  max-width: 340px;
  padding: 12px 15px;
  transform: translateY(140%);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: var(--shadow-md);
  font-size: 13px;
  opacity: 0;
  transition: transform 220ms var(--ease), opacity 220ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 620ms var(--ease), transform 620ms var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (max-width: 980px) {
  .desktop-nav {
    display: none;
  }

  .menu-button {
    display: inline-grid;
  }

  .hero-grid,
  .contact-card {
    grid-template-columns: 1fr;
  }

  .hero-card {
    min-height: 360px;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .metric:nth-child(2) {
    border-right: 0;
  }

  .metric:nth-child(-n + 2) {
    border-bottom: 1px solid var(--border);
  }

  .skill-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .writing-grid {
    grid-template-columns: 1fr;
  }

  .article-card {
    min-height: 250px;
  }

  .case-facts {
    grid-template-columns: repeat(2, 1fr);
  }

  .case-body {
    grid-template-columns: 1fr;
    width: min(calc(100% - 40px), 790px);
    margin-inline: auto;
  }

  .case-nav {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 5px 14px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
  }

  .case-nav-title {
    width: 100%;
  }

  .case-nav a {
    padding: 2px 0;
  }

  .architecture-flow {
    grid-template-columns: 1fr;
  }

  .flow-step::after {
    content: "↓";
    top: auto;
    right: 50%;
    bottom: -17px;
  }
}

@media (max-width: 760px) {
  :root {
    --header-height: 66px;
  }

  .container,
  .narrow {
    width: min(calc(100% - 28px), var(--container));
  }

  .brand-label {
    display: none;
  }

  .hero {
    padding-top: 70px;
  }

  .hero h1 {
    font-size: clamp(2.9rem, 15vw, 4.6rem);
  }

  .hero-card {
    min-height: 340px;
    padding: 24px;
    border-radius: 28px;
  }

  .metrics-band {
    padding-bottom: 58px;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .metric,
  .metric:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .metric:last-child {
    border-bottom: 0;
  }

  .section,
  .section-sm {
    padding: 72px 0;
  }

  .section-header {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 34px;
  }

  .project-grid,
  .beyond-grid,
  .skill-grid {
    grid-template-columns: 1fr;
  }

  .project-card {
    min-height: 400px;
  }

  .experience-layout {
    grid-template-columns: 1fr;
  }

  .sticky-note {
    position: static;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 8px;
    padding-left: 28px;
  }

  .timeline-item::before {
    left: 5px;
  }

  .timeline-item::after {
    left: 0;
  }

  .timeline-content {
    padding-left: 0;
  }

  .contact-card {
    padding: 32px 24px;
    border-radius: 28px;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .case-hero {
    padding-top: 58px;
  }

  .case-facts {
    grid-template-columns: 1fr;
  }

  .case-cover {
    border-radius: 24px;
  }

  .case-body {
    width: min(calc(100% - 28px), 790px);
    padding-top: 62px;
  }

  .prose table {
    display: block;
    overflow-x: auto;
  }

  .next-project-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .note-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .nav-actions .command-trigger {
    display: none;
  }

  .hero-actions .button {
    width: 100%;
  }

  .project-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .availability {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}

@media print {
  .site-header,
  .scroll-progress,
  .command-overlay,
  .toast,
  .hero-actions,
  .contact-actions,
  .site-footer {
    display: none !important;
  }

  body {
    background: #fff;
    color: #111;
  }

  .section,
  .section-sm {
    padding: 30px 0;
  }

  .project-card,
  .skill-card,
  .contact-card,
  .case-cover,
  .case-fact {
    box-shadow: none;
    break-inside: avoid;
  }
}
