/* ══════════════════════════════════════════════════
   style.css — sabnur-portfolio "a lazy afternoon"
   Bespoke editorial portfolio for Sabnur Samiha
   ══════════════════════════════════════════════════ */

/* ── 0. CUSTOM PROPERTIES ───────────────────────── */
:root {
  /* Palette — milk-tea (Default / High-Contrast Light Mode) */
  --cream:         #FAF6F0;
  --oat:           #F1E8DC;
  --card-bg:       #FCFAF7;
  --cocoa:         #211510; /* Deepest ink for headings & strong emphasis */
  --text:          #211510; /* Headings contrast ratio > 13:1 against cream */
  --text-body:     #34241C; /* Main body copy contrast ratio > 9.5:1 against cream */
  --text-muted:    #544238; /* Secondary copy & labels contrast ratio > 5.8:1 (exceeds WCAG AA) */
  --text-dim:      #6E5C52; /* Captions & fine notes contrast ratio > 4.5:1 */
  --rose:          #C26356; /* Rich warm terracotta rose (passes contrast) */
  --peach:         #7C4524; /* Warm coffee-peach accent text */
  --sage:          #3F6538; /* Crisp forest sage for visible status dot */
  --border:        rgba(33, 21, 16, 0.16); /* Clearly defined 1px borders */
  --border-strong: rgba(33, 21, 16, 0.28);
  --shadow:        rgba(33, 21, 16, 0.08);
  --grain-opacity: 0.024;

  /* Typography */
  --font-serif: 'Fraunces', Georgia, serif;
  --font-body:  'DM Sans', system-ui, sans-serif;
  --font-mono:  'JetBrains Mono', 'Courier New', monospace;

  /* Spacing */
  --s1:  0.25rem;
  --s2:  0.5rem;
  --s3:  0.75rem;
  --s4:  1rem;
  --s5:  1.5rem;
  --s6:  2rem;
  --s7:  3rem;
  --s8:  4.5rem;
  --s9:  7rem;

  /* Layout */
  --rail-w: 245px;
  --content-max: 860px;

  /* Transitions */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-soft:   cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --t-fast: 160ms;
  --t-mid:  320ms;
  --t-slow: 500ms;

  /* Surfaces — Default Light Mode */
  --bg:            var(--cream);
  --bg-rgb:        250, 246, 240;
  --bg-alt:        var(--oat);
  --accent:        var(--sage);
  --kitten-stroke: #211510;
  --yarn-stroke:   #D47C6F;
}

/* System dark preference — only when user hasn't explicitly chosen light */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not(.light) {
    --bg:            #1E1816;
    --bg-rgb:        30, 24, 22;
    --bg-alt:        #29221F;
    --card-bg:       #26201D;
    --text:          #F2ECE4;
    --text-body:     #E5DDD4;
    --text-muted:    #ABA099;
    --text-dim:      #8F847E;
    --border:        rgba(242, 236, 228, 0.13);
    --border-strong: rgba(242, 236, 228, 0.25);
    --shadow:        rgba(0, 0, 0, 0.4);
    --rose:          #E9B8B0;
    --peach:         #F2CDB0;
    --sage:          #B7C4A8;
    --cream:         #F2ECE4;
    --cocoa:         #F2ECE4;
    --kitten-stroke: #F2ECE4;
    --yarn-stroke:   #F2CDB0;
  }
}

/* Explicit Dark Mode */
[data-theme="dark"], html.dark {
  --bg:            #1E1816;
  --bg-rgb:        30, 24, 22;
  --bg-alt:        #29221F;
  --card-bg:       #26201D;
  --text:          #F2ECE4;
  --text-body:     #E5DDD4;
  --text-muted:    #ABA099;
  --text-dim:      #8F847E;
  --border:        rgba(242, 236, 228, 0.13);
  --border-strong: rgba(242, 236, 228, 0.25);
  --shadow:        rgba(0, 0, 0, 0.4);
  --rose:          #E9B8B0;
  --peach:         #F2CDB0;
  --sage:          #B7C4A8;
  --cream:         #F2ECE4;
  --cocoa:         #F2ECE4;
  --kitten-stroke: #F2ECE4;
  --yarn-stroke:   #F2CDB0;
}

/* Explicit Light Mode (Overrides OS dark preference completely) */
[data-theme="light"], html.light {
  --bg:            #FAF6F0;
  --bg-rgb:        250, 246, 240;
  --bg-alt:        #F1E8DC;
  --card-bg:       #FCFAF7;
  --text:          #211510;
  --text-body:     #34241C;
  --text-muted:    #544238;
  --text-dim:      #6E5C52;
  --border:        rgba(33, 21, 16, 0.16);
  --border-strong: rgba(33, 21, 16, 0.28);
  --shadow:        rgba(33, 21, 16, 0.08);
  --cream:         #FAF6F0;
  --cocoa:         #211510;
  --rose:          #C26356;
  --peach:         #7C4524;
  --sage:          #3F6538;
  --kitten-stroke: #211510;
  --yarn-stroke:   #D47C6F;
}

/* ── 1. RESET + BASE ─────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  overflow-x: hidden;
  position: relative;
  transition: background-color var(--t-mid) ease, color var(--t-mid) ease;
}

/* Paper grain overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
}

/* ── 2. TYPOGRAPHY ───────────────────────────────── */
h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
  color: var(--text);
  font-optical-sizing: auto;
}

h1 {
  font-size: clamp(3.2rem, 6.5vw, 5.2rem);
  font-weight: 300;
  font-style: italic;
  line-height: 1.05;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

h3 {
  font-size: 1.15rem;
  font-weight: 500;
  font-style: normal;
}

p {
  max-width: 60ch;
  text-wrap: balance;
  color: var(--text-body);
}

a {
  color: var(--text);
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
  transition: text-decoration-color var(--t-fast) var(--ease-soft),
              color var(--t-fast) var(--ease-soft);
}

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

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--sage);
  outline-offset: 3px;
  border-radius: 2px;
}

.kicker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: lowercase;
  color: var(--text);
  font-weight: 500;
  display: inline-block;
  margin-bottom: var(--s3);
  background: var(--bg-alt);
  padding: 3px 9px;
  border-radius: 2px;
  border: 1px solid var(--border-strong);
}

/* ── 3. LAYOUT: RAIL ─────────────────────────────── */
.rail-layout {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  min-height: 100vh;
  align-items: start;
}

/* Sticky left rail — immersive seamless flow, no separating vertical border */
.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: var(--s7) var(--s5) var(--s6) var(--s6);
  border-right: none;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 10;
}

.rail__top {
  display: contents;
}

.rail__brand {
  order: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: var(--s7);
  text-decoration: none;
}

.rail__name {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.15;
  color: var(--text);
  transition: color var(--t-fast) ease;
}

.rail__brand:hover .rail__name {
  color: var(--rose);
}

.rail__role {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* Nav Wrapper — smooth fluid typography, zero button cards */
.rail__nav-wrapper {
  order: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.rail__nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  width: 100%;
}

.rail__nav li {
  width: 100%;
}

.rail__nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.25rem 0;
  text-decoration: none;
  color: var(--text-body);
  transition: color var(--t-fast) ease, transform var(--t-fast) var(--ease-soft);
  position: relative;
  width: fit-content;
  background: none;
  border: none;
  box-shadow: none;
}

.rail__nav-num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  transition: color var(--t-fast) ease;
}

.rail__nav-label {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  letter-spacing: 0.06em;
  color: var(--text-body);
  font-weight: 500;
  transition: color var(--t-fast) ease;
}

/* Smooth hairline thread indicator that glides beside active link */
.rail__nav-link::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 1px;
  background: var(--sage);
  transition: width var(--t-mid) var(--ease-spring);
  vertical-align: middle;
}

.rail__nav-link:hover {
  color: var(--text);
  transform: translateX(4px);
}

.rail__nav-link:hover .rail__nav-num,
.rail__nav-link.active .rail__nav-num {
  color: var(--rose);
}

.rail__nav-link:hover .rail__nav-label,
.rail__nav-link.active .rail__nav-label {
  color: var(--text);
  font-weight: 600;
}

.rail__nav-link:hover::before,
.rail__nav-link.active::before {
  width: 16px;
}

/* Status Footnote at bottom (Desktop) — quiet, dry editorial copy, no pulsing/AI dots */
.rail__status {
  order: 3;
  margin-top: auto;
  padding-top: var(--s5);
  border-top: 1px solid var(--border);
}

.rail__status-text {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.45;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-bottom: 0.2rem;
}

.rail__status-sub {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.03em;
}

/* Theme Switcher — smooth, flat, quiet */
.rail__theme {
  order: 4;
  margin-top: var(--s3);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: color var(--t-fast) ease;
  width: fit-content;
}

.rail__theme:hover {
  color: var(--text);
}

.rail__theme-svg {
  display: block;
  stroke: currentColor;
  transition: transform var(--t-mid) var(--ease-spring);
}

.rail__theme:hover .rail__theme-svg {
  transform: rotate(20deg);
}

/* Main content wrapper */
.content-wrapper {
  position: relative;
  min-height: 100vh;
}

.content {
  padding: var(--s8) var(--s7) var(--s9) var(--s7);
  max-width: calc(var(--content-max) + var(--s7) * 2);
  position: relative;
  z-index: 2;
}

/* ── 4. THE SUNBEAM (Signature Device #1) ─────────── */
/* Blurred, slightly pane-shaped window light that drifts with scroll */
.sunbeam {
  position: fixed;
  top: 0;
  right: 0;
  width: min(620px, 60vw);
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  transform-origin: 75% 25%;
  transition: opacity 0.3s ease-out;
}

.sunbeam::before {
  content: "";
  position: absolute;
  inset: 0;
  /* 4-pane sash window light casting with soft mullions */
  background:
    linear-gradient(to bottom, transparent 47%, rgba(59, 47, 42, 0.07) 49%, rgba(59, 47, 42, 0.07) 51%, transparent 53%),
    linear-gradient(to right, transparent 48%, rgba(59, 47, 42, 0.07) 50%, rgba(59, 47, 42, 0.07) 52%, transparent 54%),
    radial-gradient(ellipse at 55% 40%, rgba(242, 205, 176, 0.42) 0%, rgba(233, 184, 176, 0.18) 50%, transparent 80%);
  filter: blur(34px);
  transform: rotate(-9deg) skew(-4deg);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not(.light) .sunbeam::before {
    background:
      linear-gradient(to bottom, transparent 47%, rgba(0, 0, 0, 0.28) 49%, rgba(0, 0, 0, 0.28) 51%, transparent 53%),
      linear-gradient(to right, transparent 48%, rgba(0, 0, 0, 0.28) 50%, rgba(0, 0, 0, 0.28) 52%, transparent 54%),
      radial-gradient(ellipse at 55% 40%, rgba(183, 196, 168, 0.22) 0%, rgba(160, 185, 175, 0.07) 50%, transparent 80%);
    filter: blur(36px);
  }
}

[data-theme="dark"] .sunbeam::before,
html.dark .sunbeam::before {
  background:
    linear-gradient(to bottom, transparent 47%, rgba(0, 0, 0, 0.28) 49%, rgba(0, 0, 0, 0.28) 51%, transparent 53%),
    linear-gradient(to right, transparent 48%, rgba(0, 0, 0, 0.28) 50%, rgba(0, 0, 0, 0.28) 52%, transparent 54%),
    radial-gradient(ellipse at 55% 40%, rgba(183, 196, 168, 0.22) 0%, rgba(160, 185, 175, 0.07) 50%, transparent 80%);
  filter: blur(36px);
}

[data-theme="light"] .sunbeam::before,
html.light .sunbeam::before {
  background:
    linear-gradient(to bottom, transparent 47%, rgba(59, 47, 42, 0.07) 49%, rgba(59, 47, 42, 0.07) 51%, transparent 53%),
    linear-gradient(to right, transparent 48%, rgba(59, 47, 42, 0.07) 50%, rgba(59, 47, 42, 0.07) 52%, transparent 54%),
    radial-gradient(ellipse at 55% 40%, rgba(242, 205, 176, 0.42) 0%, rgba(233, 184, 176, 0.18) 50%, transparent 80%);
  filter: blur(34px);
}

/* ── 5. THE YARN (Signature Device #2) ─────────────── */
/* Hairline SVG thread running down the page, loops around headers */
.yarn-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: visible;
}

.yarn-path {
  stroke: var(--yarn-stroke);
  stroke-width: 1.2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.65;
  transition: stroke-dashoffset 0.1s linear, stroke var(--t-fast) ease;
}

/* ── 6. SECTIONS & DIVIDERS ───────────────────────── */
section {
  position: relative;
  z-index: 2;
  padding-top: var(--s8);
  padding-bottom: var(--s8);
  scroll-margin-top: 2rem;
}

section + section {
  border-top: 1px solid var(--border);
}

.section-header {
  margin-bottom: var(--s6);
}

/* Whisker divider: three delicate lines fanning out */
.whisker-divider {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-bottom: var(--s4);
  height: 16px;
}

.whisker-divider span {
  display: block;
  height: 1px;
  background: var(--muted);
  opacity: 0.45;
  transform-origin: left center;
}

.whisker-divider span:nth-child(1) { width: 30px; transform: rotate(-6deg); }
.whisker-divider span:nth-child(2) { width: 44px; transform: rotate(0deg); }
.whisker-divider span:nth-child(3) { width: 30px; transform: rotate(6deg); }

/* ── 7. HERO SECTION ─────────────────────────────── */
#hero {
  min-height: calc(100vh - var(--s8));
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: var(--s6);
  padding-bottom: var(--s7);
  border-top: none;
}

.hero__container {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s7);
  width: 100%;
}

.hero__col-text {
  flex: 1;
  min-width: 0;
  max-width: 530px;
}

.hero__col-photo {
  flex-shrink: 0;
  padding-top: var(--s3);
  padding-right: var(--s3);
  display: flex;
  justify-content: center;
}

/* Hero kicker: pure, quiet typography (no capsules or boxes) */
.hero__kicker {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--rose);
  text-transform: lowercase;
  margin-bottom: var(--s2);
  font-weight: 500;
  display: block;
  line-height: 1.45;
}

.hero__name {
  margin-bottom: var(--s2);
}

.hero__headline {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 2.7vw, 2.3rem);
  color: var(--text);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.015em;
  max-width: 32ch;
  margin-bottom: var(--s3);
}

.hero__subheadline {
  font-family: var(--font-body);
  font-size: clamp(0.96rem, 1.3vw, 1.08rem);
  color: var(--text-body);
  font-weight: 400;
  line-height: 1.55;
  max-width: 44ch;
  margin-bottom: var(--s5);
}

@media (max-width: 860px) {
  .hero__container {
    flex-direction: column-reverse;
    gap: var(--s6);
  }
  .hero__col-photo {
    padding-top: 0;
    padding-right: 0;
    align-self: flex-start;
    margin-bottom: var(--s3);
  }
}

.hero__meta {
  display: flex;
  align-items: center;
  gap: var(--s6);
  flex-wrap: wrap;
  margin-bottom: var(--s6);
}

.hero__dot {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-body);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--s2);
  letter-spacing: 0.04em;
}

.hero__dot::before {
  content: "●";
  color: var(--sage);
  font-size: 0.65rem;
}

.hero__links {
  display: flex;
  gap: var(--s5);
  flex-wrap: wrap;
}

.hero__links a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1.5px solid var(--border-strong);
  padding-bottom: 2px;
  transition: color var(--t-fast), border-color var(--t-fast);
}

.hero__links a:hover {
  color: var(--rose);
  border-color: var(--rose);
}

/* Hero stage: loaf kitten, windowsill ledge, and mischief pencil */
.hero__stage {
  display: flex;
  align-items: flex-end;
  gap: var(--s6);
  margin-top: var(--s5);
  flex-wrap: wrap;
}

.hero__kitten {
  width: 180px;
  height: 135px;
  position: relative;
  display: flex;
  align-items: center;
}

.hero__ledge-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 20px;
}

.hero__ledge {
  position: relative;
  width: 130px;
  height: 24px;
  display: flex;
  align-items: flex-end;
  border-bottom: 1.5px solid var(--border);
}

.hero__pencil {
  cursor: pointer;
  width: 72px;
  height: 14px;
  position: absolute;
  left: 20px;
  bottom: 1px;
  transform-origin: 90% 90%;
  transition: transform 0.65s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hero__pencil:hover:not(.batted) {
  transform: rotate(-3deg) translateY(-1px);
}

.hero__pencil.batted {
  transform: rotate(44deg) translate(32px, 20px);
  cursor: default;
}

.hero__pencil-reset {
  margin-top: var(--s2);
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  border-bottom: 1px dashed var(--border);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-mid) ease, color var(--t-fast) ease;
}

.hero__pencil-reset.visible {
  opacity: 0.85;
  pointer-events: auto;
}

.hero__pencil-reset:hover {
  color: var(--text);
  border-bottom-style: solid;
}

/* ── 8. WORK SECTION (EAR-NOTCH GEOMETRY) ─────────── */
/* Signature Device #3: Two tiny triangular notches on top edge like cat ears */
.project--flagship {
  margin-bottom: var(--s7);
}

.project--flagship .project__card-inner {
  padding: var(--s7);
}

.project--flagship .project__name {
  font-size: 1.85rem;
}

.project--mid {
  margin-left: var(--s7);
  margin-bottom: var(--s6);
  max-width: 600px;
}

.project--slim {
  max-width: 530px;
  margin-left: auto;
  margin-bottom: var(--s6);
}

/* Outer border wrapper that carries the ear-notch cut */
.project__card {
  position: relative;
  background: var(--border);
  padding: 1px;
  clip-path: polygon(
    0 0,
    22px 0,
    30px 8px,
    38px 0,
    calc(100% - 38px) 0,
    calc(100% - 30px) 8px,
    calc(100% - 22px) 0,
    100% 0,
    100% 100%,
    0 100%
  );
  transition: transform var(--t-mid) var(--ease-spring),
              filter var(--t-mid) var(--ease-spring);
}

.project__card:hover {
  filter: drop-shadow(0 8px 18px var(--shadow));
}

/* Inner card surface */
.project__card-inner {
  background: var(--card-bg);
  padding: var(--s6);
  clip-path: polygon(
    0 0,
    22px 0,
    30px 8px,
    38px 0,
    calc(100% - 38px) 0,
    calc(100% - 30px) 8px,
    calc(100% - 22px) 0,
    100% 0,
    100% 100%,
    0 100%
  );
}

/* Nudge on hover: pushes aside like cat swatting a pen */
.project__card.nudge {
  transform: rotate(var(--nudge-rotate, -1.2deg))
             translate(var(--nudge-x, -5px), var(--nudge-y, 2px));
}

.project--flagship .project__card {
  --nudge-rotate: -1.4deg;
  --nudge-x: -6px;
  --nudge-y: 3px;
}

.project--mid .project__card {
  --nudge-rotate: 1.2deg;
  --nudge-x: 5px;
  --nudge-y: -2px;
}

.project--slim .project__card {
  --nudge-rotate: -0.9deg;
  --nudge-x: -4px;
  --nudge-y: 2px;
}

.project__flag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--rose);
  text-transform: lowercase;
  margin-bottom: var(--s3);
  display: block;
}

.project__name {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 500;
  margin-bottom: var(--s2);
  color: var(--text);
}

.project__tagline {
  font-size: 0.92rem;
  color: var(--text-body);
  opacity: 0.9;
  margin-bottom: var(--s4);
  font-style: italic;
}

.project__desc {
  font-size: 0.94rem;
  color: var(--text-body);
  line-height: 1.62;
  margin-bottom: var(--s5);
  max-width: 52ch;
}

.project__stack {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-bottom: var(--s5);
}

.project__stack span {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--text-body);
  font-weight: 500;
  border: 1px solid var(--border-strong);
  padding: 3px var(--s2);
  border-radius: 2px;
  background: var(--bg);
}

.project__link {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1.5px solid var(--border-strong);
  padding-bottom: 2px;
  transition: color var(--t-fast), border-color var(--t-fast);
  display: inline-flex;
  align-items: center;
}

.project__link:hover {
  color: var(--rose);
  border-color: var(--rose);
}

/* Also-built slim list */
.also-built {
  margin-top: var(--s7);
  border-top: 1px solid var(--border);
  padding-top: var(--s5);
}

.also-built__label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  margin-bottom: var(--s4);
}

.also-built__list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.also-built__list li {
  display: flex;
  align-items: baseline;
  gap: var(--s4);
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.also-built__list li:last-child {
  border-bottom: none;
}

.also-built__list strong {
  font-weight: 500;
  min-width: 120px;
  color: var(--text);
}

.also-built__list span {
  color: var(--text-body);
  font-size: 0.88rem;
}

.also-built__note {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
}

/* Research — styled like a journal entry */
.research {
  margin-top: var(--s7);
  border-left: 2px solid var(--rose);
  padding-left: var(--s6);
  background: var(--bg-alt);
  padding-top: var(--s5);
  padding-bottom: var(--s5);
  padding-right: var(--s5);
  border-radius: 0 4px 4px 0;
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.research__label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--rose);
  font-weight: 500;
  margin-bottom: var(--s2);
  display: block;
}

.research__title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 400;
  font-style: italic;
  margin-bottom: var(--s2);
  color: var(--text);
}

.research__meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.04em;
  margin-bottom: var(--s3);
}

.research__details {
  font-size: 0.92rem;
  color: var(--text-body);
  line-height: 1.65;
  max-width: 58ch;
}

/* ── 9. WINS SECTION ─────────────────────────────── */
.wins-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.wins-list li {
  display: grid;
  grid-template-columns: 3.5rem 1fr auto;
  align-items: center;
  gap: var(--s4);
  padding: var(--s3) var(--s2);
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast), transform var(--t-fast);
}

.wins-list li:last-child {
  border-bottom: none;
}

.wins-list li:hover {
  background: var(--bg-alt);
  border-radius: 2px;
  transform: translateX(3px);
}

.wins-year {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-body);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.wins-event {
  font-size: 0.96rem;
  color: var(--text);
  font-weight: 500;
}

.wins-result {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-align: right;
  min-width: fit-content;
  border: 1px solid var(--border-strong);
  padding: 3px var(--s2);
  border-radius: 2px;
  background: var(--bg);
}

/* ── 10. SKILLS SECTION ───────────────────────────── */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: var(--s5) var(--s7);
  margin-top: var(--s7);
  padding-top: var(--s6);
  border-top: 1px solid var(--border);
}

.skill-group__label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--text);
  font-weight: 500;
  margin-bottom: var(--s3);
  display: block;
}

.skill-group__items {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}

.skill-group__items li {
  font-size: 0.92rem;
  color: var(--text-body);
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: var(--s2);
}

.skill-group__items li::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--sage);
  flex-shrink: 0;
}

/* ── 11. ABOUT SECTION ───────────────────────────── */
.about__bio {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  margin-bottom: var(--s6);
}

.about__bio p {
  font-size: 1.05rem;
  color: var(--text-body);
  line-height: 1.6;
  max-width: 58ch;
}

/* Education table */
.edu-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--s5);
  font-size: 0.92rem;
}

.edu-table th {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-align: left;
  font-weight: 500;
  padding: var(--s2) var(--s3);
  border-bottom: 1px solid var(--border);
}

.edu-table td {
  padding: var(--s3) var(--s3);
  border-bottom: 1px solid var(--border);
  color: var(--text-body);
  vertical-align: top;
}

.edu-table tr:last-child td {
  border-bottom: none;
}

.edu-table td.score {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.edu-table td.years {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

/* Polaroid-style photo frame (Hero & About) */
.polaroid-frame,
.about__frame {
  margin-top: var(--s2);
  display: inline-block;
  background: var(--card-bg);
  padding: 12px 12px 26px 12px;
  border: 1px solid var(--border-strong);
  box-shadow: 0 8px 28px var(--shadow);
  transform: rotate(2.5deg);
  transition: transform var(--t-mid) var(--ease-spring), box-shadow var(--t-mid) ease;
  position: relative;
  border-radius: 4px;
}

.polaroid-frame:hover,
.about__frame:hover {
  transform: rotate(0deg) translateY(-4px) scale(1.02);
  box-shadow: 0 14px 36px var(--shadow);
}

/* Washi tape strip on top of polaroid */
.polaroid-frame::before,
.about__frame::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 52px;
  height: 18px;
  background: rgba(233, 184, 176, 0.65);
  border-left: 1px dashed rgba(59, 47, 42, 0.22);
  border-right: 1px dashed rgba(59, 47, 42, 0.22);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  z-index: 5;
}

/* Cute curious kitten perched on top right corner of polaroid */
.polaroid-frame__peeker,
.about__frame-peeker {
  position: absolute;
  top: -40px;
  right: -22px;
  width: 76px;
  height: 98px;
  z-index: 10;
  pointer-events: none;
  transition: transform var(--t-mid) var(--ease-spring);
}

.polaroid-frame:hover .polaroid-frame__peeker,
.about__frame:hover .about__frame-peeker {
  transform: translateY(-6px) rotate(-4deg);
}

.polaroid-frame__photo,
.about__frame-photo {
  width: 185px;
  height: 200px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  border-radius: 2px;
}

.polaroid-frame__img,
.about__portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  filter: contrast(1.03) saturate(1.02);
}

.polaroid-frame__caption,
.about__frame-caption {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-align: center;
  margin-top: 10px;
  display: block;
}

.about__kitten {
  width: 100px;
  height: auto;
}

/* ── 12. CONTACT SECTION ─────────────────────────── */
.contact__line {
  font-size: 1.15rem;
  color: var(--text-body);
  margin-bottom: var(--s5);
}

.contact__email {
  display: inline-block;
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 3.2vw, 2.2rem);
  font-weight: 400;
  font-style: italic;
  color: var(--text);
  text-decoration: none;
  border-bottom: 2px solid var(--border-strong);
  padding-bottom: 3px;
  margin-bottom: var(--s6);
  transition: border-color var(--t-fast), color var(--t-fast);
}

.contact__email:hover {
  border-color: var(--rose);
  color: var(--rose);
}

.contact__links {
  display: flex;
  gap: var(--s6);
  flex-wrap: wrap;
}

.contact__links a {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1.5px solid var(--border-strong);
  padding-bottom: 2px;
  transition: color var(--t-fast), border-color var(--t-fast);
}

.contact__links a:hover {
  color: var(--rose);
  border-color: var(--rose);
}

/* Contact kitten — stretch pose settled in returned sunbeam */
.contact__kitten {
  margin-top: var(--s7);
  width: 200px;
  height: auto;
  opacity: 0.9;
}

/* ── 13. FOOTER ──────────────────────────────────── */
footer {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s4);
  padding: var(--s6) var(--s7);
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

footer a {
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color var(--t-fast), border-color var(--t-fast);
}

footer a:hover {
  color: var(--text);
  border-color: var(--text);
}

/* ── 14. INLINE KITTEN SVGs (Strokes and Colors) ─── */
.kitten-svg {
  display: block;
  overflow: visible;
}

/* Strokes & pupils adapt seamlessly to current theme variable */
.kitten-svg path[stroke="#3B2F2A"],
.kitten-svg line[stroke="#3B2F2A"] {
  stroke: var(--kitten-stroke);
  transition: stroke var(--t-fast) ease;
}

.kitten-svg circle[fill="#3B2F2A"],
.kitten-svg ellipse[fill="#3B2F2A"] {
  fill: var(--kitten-stroke);
  transition: fill var(--t-fast) ease;
}

/* ── 15. SCROLL FADE-IN ──────────────────────────── */
.fade-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--t-slow) var(--ease-soft),
              transform var(--t-slow) var(--ease-soft);
}

.fade-in.visible {
  opacity: 1;
  transform: none;
}

/* ── 16. RESPONSIVE & MOBILE-FRIENDLY UX ─────────── */
@media (max-width: 820px) {
  html, body {
    overflow-x: hidden;
    width: 100%;
  }

  .rail-layout {
    display: flex;
    flex-direction: column;
    min-height: auto;
  }

  /* Sticky high-contrast mobile header — completely smooth, non-button */
  .rail {
    position: sticky;
    top: 0;
    height: auto;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0.65rem 1.15rem 0 1.15rem;
    background: rgba(var(--bg-rgb), 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: none;
    border-bottom: 1px solid var(--border);
    z-index: 100;
    box-shadow: 0 1px 8px var(--shadow);
    gap: 0.45rem;
  }

  .rail__top {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    order: 1;
  }

  .rail__brand {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    text-decoration: none;
    order: 1;
    margin-bottom: 0;
  }

  .rail__name {
    font-size: 1.08rem;
    line-height: 1.15;
    white-space: nowrap;
    color: var(--text);
  }

  .rail__role {
    font-size: 0.64rem;
    color: var(--text-muted);
  }

  .rail__theme {
    margin: 0;
    padding: 0.25rem 0;
    background: none;
    border: none;
    order: 2;
  }

  /* Smooth Mobile Nav Track — completely flat typography, zero button box */
  .rail__nav-wrapper {
    order: 2;
    width: 100%;
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
  }

  .rail__nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
    gap: 0;
  }

  .rail__nav li {
    flex: 1;
    display: flex;
    justify-content: center;
    margin: 0;
    padding: 0;
  }

  .rail__nav-link {
    width: 100%;
    min-height: 40px;
    padding: 0.5rem 0.2rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    gap: 0.35rem;
    position: relative;
    transition: color var(--t-fast) ease;
  }

  .rail__nav-num {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-dim);
    transition: color var(--t-fast) ease;
  }

  .rail__nav-label {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    font-weight: 500;
    transition: color var(--t-fast) ease;
  }

  /* Smooth hairline thread indicator at the bottom of the active tab */
  .rail__nav-link::before {
    display: none;
  }

  .rail__nav-link::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 18%;
    right: 18%;
    height: 2px;
    background: var(--sage);
    border-radius: 2px 2px 0 0;
    transform: scaleX(0);
    transition: transform var(--t-mid) var(--ease-spring);
  }

  .rail__nav-link:hover .rail__nav-label,
  .rail__nav-link.active .rail__nav-label {
    color: var(--text);
    font-weight: 600;
  }

  .rail__nav-link:hover .rail__nav-num,
  .rail__nav-link.active .rail__nav-num {
    color: var(--rose);
  }

  .rail__nav-link.active::after {
    transform: scaleX(1);
  }

  .rail__status {
    display: none;
  }

  section {
    scroll-margin-top: 5.8rem;
  }

  /* Content area */
  .content-wrapper {
    width: 100%;
    overflow-x: hidden;
  }

  .content {
    padding: 2.5rem 1.25rem 4.5rem 1.25rem;
    width: 100%;
    box-sizing: border-box;
    max-width: 100vw;
  }

  /* Hero */
  #hero {
    min-height: auto;
    padding-top: 1.5rem;
    padding-bottom: 3.5rem;
  }

  .hero__name {
    font-size: clamp(2.4rem, 8.5vw, 3.8rem);
    line-height: 1.08;
    margin-bottom: var(--s3);
  }

  .hero__headline {
    font-size: clamp(1.05rem, 4vw, 1.25rem);
    line-height: 1.45;
    margin-bottom: var(--s4);
  }

  .hero__meta {
    gap: var(--s4);
    margin-bottom: var(--s5);
  }

  .hero__stage {
    gap: var(--s4);
    align-items: flex-end;
  }

  .hero__kitten {
    width: 150px;
    height: 112px;
  }

  /* Work cards */
  .project--flagship,
  .project--mid,
  .project--slim {
    margin-left: 0;
    margin-right: 0;
    max-width: 100%;
    margin-bottom: var(--s5);
  }

  .project__card-inner {
    padding: 1.35rem 1.15rem;
  }

  .project__name {
    font-size: 1.35rem;
  }

  .project__desc {
    font-size: 0.92rem;
    line-height: 1.58;
  }

  .project__link {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    font-size: 0.8rem;
  }

  /* Wins list on mobile */
  .wins-list li {
    grid-template-columns: 3.2rem 1fr;
    padding: 0.85rem 0.3rem;
    gap: 0.5rem;
  }

  .wins-result {
    grid-column: 2;
    grid-row: 2;
    margin-top: 2px;
    justify-self: start;
  }

  /* Skills grid on mobile — 2 balanced columns */
  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--s5) var(--s4);
    margin-top: var(--s6);
    padding-top: var(--s5);
  }

  /* Hide yarn on narrow screens to prevent overlap */
  .yarn-svg {
    display: none;
  }

  /* Contact on mobile */
  .contact__email {
    font-size: clamp(1.2rem, 5.2vw, 1.85rem);
    word-break: break-all;
    line-height: 1.25;
    margin-bottom: var(--s5);
  }

  .contact__links {
    gap: var(--s3);
  }

  .contact__links a {
    padding: 0.45rem 0.8rem;
    background: var(--bg-alt);
    border-radius: 4px;
    border: 1px solid var(--border-strong);
    min-height: 40px;
    display: inline-flex;
    align-items: center;
  }

  .contact__kitten {
    width: 160px;
    height: auto;
  }

  footer {
    flex-direction: column;
    align-items: flex-start;
    padding: var(--s5) 1.25rem;
    gap: var(--s3);
  }
}

/* Card layout for Education table on phones */
@media (max-width: 640px) {
  .edu-table thead {
    display: none;
  }

  .edu-table,
  .edu-table tbody,
  .edu-table tr,
  .edu-table td {
    display: block;
    width: 100%;
  }

  .edu-table tr {
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border);
  }

  .edu-table td {
    padding: 0.15rem 0;
    border: none;
  }

  .edu-table td:nth-child(1) {
    font-family: var(--font-serif);
    font-size: 1.08rem;
    font-weight: 500;
    color: var(--text);
  }

  .edu-table td:nth-child(2) {
    font-size: 0.9rem;
    color: var(--text-body);
  }

  .edu-table td.score {
    display: inline-block;
    margin-right: 0.85rem;
    color: var(--rose);
    font-weight: 600;
  }

  .edu-table td.years {
    display: inline-block;
    color: var(--text-muted);
    font-size: 0.8rem;
  }
}

/* Very narrow devices (iPhone SE, 360px Android) */
@media (max-width: 440px) {
  .rail {
    padding: 0.55rem 0.85rem 0 0.85rem;
    gap: 0.35rem;
  }

  .rail__name {
    font-size: 1rem;
  }

  .rail__role {
    font-size: 0.62rem;
  }

  .rail__theme {
    font-size: 0.66rem;
  }

  .rail__nav-link {
    min-height: 38px;
    padding: 0.4rem 0.15rem;
    gap: 0.25rem;
  }

  .rail__nav-num {
    font-size: 0.62rem;
  }

  .rail__nav-label {
    font-size: 0.72rem;
    letter-spacing: 0.02em;
  }

  .content {
    padding: 2rem 0.95rem 3.5rem 0.95rem;
  }

  .skills-grid {
    grid-template-columns: 1fr;
    gap: var(--s4);
  }

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

/* ── 17. REDUCED MOTION ──────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .sunbeam { display: none; }
  .yarn-svg { display: none; }
  .fade-in { opacity: 1; transform: none; }
}

/* ── 18. PRINT ───────────────────────────────────── */
@media print {
  .rail { position: static; }
  .sunbeam, .yarn-svg { display: none; }
  body::before { display: none; }
  .kitty-chat-trigger, .kitty-chat-window { display: none !important; }
}

/* ── 19. KITTY CHATBOT (Miso Assistant) ────────────── */
.kitty-chat-trigger {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 990;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--card-bg);
  border: 1px solid var(--border-strong);
  box-shadow: 0 4px 20px var(--shadow);
  padding: 0.45rem 0.85rem 0.45rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease-spring), box-shadow var(--t-fast) ease, border-color var(--t-fast) ease;
}

.kitty-chat-trigger:hover {
  transform: translateY(-2px) scale(1.02);
  border-color: var(--rose);
  box-shadow: 0 6px 24px var(--shadow);
}

.kitty-chat-trigger__icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.kitty-chat-trigger__icon svg {
  width: 24px;
  height: 24px;
}

.kitty-chat-trigger__label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text);
  font-weight: 500;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* Chat Modal Window */
.kitty-chat-window {
  position: fixed;
  bottom: 5.5rem;
  right: 1.5rem;
  width: 370px;
  max-width: calc(100vw - 2rem);
  height: 520px;
  max-height: calc(100vh - 7rem);
  background: var(--card-bg);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: 0 16px 40px var(--shadow);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transition: opacity 220ms ease, transform 240ms var(--ease-spring);
}

.kitty-chat-window.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Chat Header */
.kitty-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.kitty-chat-header__profile {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.kitty-chat-header__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.kitty-chat-header__avatar svg {
  width: 22px;
  height: 22px;
}

.kitty-chat-header__name {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.15;
}

.kitty-chat-header__sub {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.kitty-chat-header__actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.kitty-chat-btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: color var(--t-fast), background var(--t-fast);
}

.kitty-chat-btn-icon:hover {
  color: var(--text);
  background: var(--card-bg);
}

/* Key settings popover bar */
.kitty-chat-key-bar {
  display: none;
  padding: 0.5rem 0.85rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  gap: 0.4rem;
  align-items: center;
}

.kitty-chat-key-bar.is-visible {
  display: flex;
}

.kitty-chat-key-input {
  flex: 1;
  background: var(--card-bg);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 0.35rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text);
  outline: none;
}

.kitty-chat-key-save {
  background: var(--rose);
  color: #fff;
  border: none;
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  cursor: pointer;
}

/* Messages area */
.kitty-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  scroll-behavior: smooth;
}

.kitty-msg {
  display: flex;
  gap: 0.5rem;
  max-width: 88%;
}

.kitty-msg--bot {
  align-self: flex-start;
}

.kitty-msg--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.kitty-msg__bubble {
  padding: 0.65rem 0.85rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  line-height: 1.48;
}

.kitty-msg--bot .kitty-msg__bubble {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 12px 12px 12px 2px;
  color: var(--text);
}

.kitty-msg--user .kitty-msg__bubble {
  background: var(--rose);
  color: #FFFFFF;
  border-radius: 12px 12px 2px 12px;
}

[data-theme="light"] .kitty-msg--user .kitty-msg__bubble {
  background: var(--text);
  color: var(--cream);
}

.kitty-msg__avatar {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  margin-top: 2px;
}

.kitty-msg__avatar svg {
  width: 100%;
  height: 100%;
}

/* Suggestion chips */
.kitty-chat-chips {
  padding: 0.45rem 0.85rem;
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
  border-top: 1px solid var(--border);
  background: var(--card-bg);
}

.kitty-chat-chips::-webkit-scrollbar {
  display: none;
}

.kitty-chip {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-body);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--t-fast) ease;
}

.kitty-chip:hover {
  background: var(--bg);
  border-color: var(--sage);
  color: var(--text);
}

/* Typing indicator */
.kitty-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.45rem 0.75rem;
  background: var(--bg-alt);
  border-radius: 10px;
  width: fit-content;
}

.kitty-typing span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing 1.4s infinite ease-in-out;
}

.kitty-typing span:nth-child(2) { animation-delay: 0.2s; }
.kitty-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1.1); opacity: 1; }
}

/* Input Bar */
.kitty-chat-input-bar {
  display: flex;
  align-items: center;
  padding: 0.65rem 0.85rem;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  gap: 0.5rem;
}

.kitty-chat-input {
  flex: 1;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-family: var(--font-body);
  font-size: 0.84rem;
  color: var(--text);
  outline: none;
  transition: border-color var(--t-fast);
}

.kitty-chat-input:focus {
  border-color: var(--border-strong);
}

.kitty-chat-send {
  background: var(--card-bg);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  transition: all var(--t-fast) var(--ease-soft);
}

.kitty-chat-send:hover {
  background: var(--bg);
  border-color: var(--rose);
  color: var(--rose);
}

@media (max-width: 640px) {
  .kitty-chat-window {
    bottom: 4.8rem;
    right: 0.85rem;
    left: 0.85rem;
    width: auto;
    max-width: 380px;
    margin: 0 0 0 auto;
    height: 52vh;
    max-height: 420px;
    min-height: 290px;
    border-radius: 14px;
    box-shadow: 0 10px 32px var(--shadow);
  }
  .kitty-chat-trigger {
    bottom: 1rem;
    right: 1rem;
    padding: 0.35rem 0.65rem 0.35rem 0.4rem;
  }
}

@media (max-width: 400px) {
  .kitty-chat-window {
    right: 0.5rem;
    left: 0.5rem;
    height: 50vh;
    max-height: 380px;
  }
  .polaroid-frame__photo,
  .about__frame-photo {
    width: 160px;
    height: 175px;
  }
}
