/* ============ DESIGN TOKENS: seven colors, spacing, fonts and motion (see .claude/rules/) ============ */
:root {
  --paper: #ffffff;
  --ink: #111111;
  --muted: #595959;
  --charcoal: #262626;
  --sand: #c8b48c;
  --line: #d9d9d9;
  --on-dark: #f5f5f5;

  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 48px;
  --space-section: 64px;

  /* Type scale: one size per text role */
  --fs-lede: 1.1rem;
  --fs-card: 1.25rem;
  --fs-small: 0.88rem;
  --fs-caption: 0.82rem;
  --fs-label: 0.72rem;
  --max: 1100px;
  --nav-h: 64px;

  /* Hangul (Korean view) uses the system Korean font, else Noto Sans KR (loaded by lang.js); Latin keeps Poppins/Inter */
  --font-head: "Poppins", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Inter", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, -apple-system, "Segoe UI", sans-serif;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur-fast: 200ms;
  --dur: 600ms;
  --dur-slow: 800ms;
  --stagger: 90ms;
  --rise-hero: 48px;
  --rise-block: 80px;
  --wipe: 35%;
}

/* ============ BASE ============ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + var(--space-2)); }
body {
  margin: 0;
  padding-top: var(--nav-h);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--font-head); color: inherit; margin: 0 0 var(--space-2); }
h1, h2 { font-weight: 800; line-height: 1.0; letter-spacing: -0.02em; }
h2 { font-size: clamp(2.5rem, 7vw, 5.5rem); margin: 0; overflow-wrap: break-word; }
h3 { font-size: var(--fs-card); font-weight: 700; line-height: 1.25; }
p { margin: 0 0 var(--space-2); }
ul, ol { padding-left: 1.2em; margin: 0 0 var(--space-2); }
li { margin-bottom: 6px; }
strong { font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-small); }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
/* Filled buttons: ring in the page color, so it shows against the page, not the button */
.btn-primary:focus-visible { outline-color: var(--ink); }
.contact .btn-primary:focus-visible { outline-color: var(--on-dark); }

.wrap { max-width: var(--max); margin: 0 auto; padding-left: var(--space-2); padding-right: var(--space-2); }
/* Each section gets the section space above and a clear gap below its last block */
.section { padding-top: var(--space-section); padding-bottom: var(--space-5); }

/* Section heading: small numbered label ("01. About") above the big title */
.section-head { margin-bottom: var(--space-5); }
.label, .when, .facts dt, .contact-grid dt {
  margin: 0 0 var(--space-1); color: var(--muted);
  font-size: var(--fs-label); font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em;
}
.section-head .label { margin-bottom: var(--space-2); }
.lede { font-size: var(--fs-lede); max-width: 62ch; }

/* Skip link: hidden until a keyboard user tabs to it */
.skip {
  position: absolute; left: var(--space-2); top: -60px; z-index: 46;
  padding: 10px 16px; background: var(--ink); color: var(--paper); font-weight: 600; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ============ NAV: fixed bar, hamburger on mobile ============ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 45; height: var(--nav-h);
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 100%; }
.brand {
  display: flex; align-items: center; gap: 10px; white-space: nowrap;
  font-family: var(--font-head); font-weight: 700; font-size: 1rem; color: var(--ink); text-decoration: none;
}
.mark {
  display: grid; place-items: center; width: 32px; height: 32px;
  background: var(--ink); color: var(--paper); font-size: 0.75rem; font-weight: 800;
}
.nav-toggle { display: block; background: none; border: 0; padding: 11px; cursor: pointer; }
/* Language switch (added by lang.js): outlined button beside the menu on phones, after Contact on desktop */
.lang-btn {
  margin-left: auto; min-height: 40px; padding: 6px 12px;
  border: 1px solid var(--ink); background: var(--paper); color: var(--ink); cursor: pointer;
  font-family: var(--font-head); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.lang-btn:hover { background: var(--ink); color: var(--paper); }
.lang-btn:focus-visible { outline-color: var(--ink); }
.lang-btn:lang(ko) { letter-spacing: 0.04em; }
/* Read by screen readers only (the language-change announcement) */
.sr-only { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Korean view: break lines between words, and ease letter spacing meant for Latin capitals */
html:lang(ko) { word-break: keep-all; }
html:lang(ko) :is(.label, .status, .when, .btn, .nav-links a, .facts dt, .contact-grid dt, .footer) { letter-spacing: 0.04em; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--ink); margin: 5px 0; }
.nav-links {
  display: none; position: absolute; top: var(--nav-h); left: 0; right: 0;
  flex-direction: column; padding: var(--space-1) var(--space-2) var(--space-2);
  background: var(--paper); border-bottom: 1px solid var(--line);
  max-height: calc(100vh - var(--nav-h)); overflow-y: auto; /* phones in landscape can scroll the menu */
}
.nav-links.open { display: flex; animation: menu-in var(--dur-fast) var(--ease); }
@keyframes menu-in { from { opacity: 0; transform: translateY(-6px); } }
.nav-links a {
  padding: 10px 0; color: var(--muted); text-decoration: none;
  font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em;
}
.nav-links a:hover, .nav-links a.active, .nav-links .nav-cta { color: var(--ink); }

/* ============ BUTTONS ============ */
.btn {
  display: inline-block; padding: 12px 22px; border: 1px solid var(--ink);
  font-family: var(--font-head); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em;
  text-decoration: none; transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--paper); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }

/* ============ HERO ============ */
.hero { padding-top: var(--space-5); padding-bottom: var(--space-5); }
.status { margin: 0 0 var(--space-3); color: var(--muted); font-size: var(--fs-label); font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; }
h1 { font-size: clamp(2.4rem, 9vw, 6rem); margin-bottom: var(--space-3); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: var(--space-4) 0 var(--space-5); }
.facts { display: grid; grid-template-columns: 1fr; margin: 0; border-top: 1px solid var(--ink); }
.facts div { padding: var(--space-2) 0; border-bottom: 1px solid var(--line); }
.facts dd, .contact-grid dd { margin: 4px 0 0; font-weight: 500; overflow-wrap: anywhere; }

/* ============ ABOUT: body paragraphs use the same body size as the rest of the page ============ */
.about > p:not(.lede) { max-width: 70ch; }

/* ============ FLOATECH: charcoal intro band with three function cards, then details ============ */
.band-dark { background: var(--charcoal); color: var(--on-dark); padding: var(--space-section) 0 var(--space-5); }
.band-dark .label { color: var(--on-dark); }
.functions { list-style: none; padding: 0; margin: var(--space-5) 0 0; display: grid; grid-template-columns: 1fr; gap: var(--space-4); }
.functions > li { margin: 0; padding-top: var(--space-3); border-top: 1px solid var(--on-dark); }
.functions p:last-child { margin: 0; }
.feature-body { padding-top: var(--space-5); }
.project { display: grid; grid-template-columns: 1fr; gap: var(--space-4); }
.checks { list-style: none; padding: 0; }
.checks li { position: relative; padding-left: 28px; }
.checks li::before { content: "\2014"; position: absolute; left: 0; color: var(--muted); }

/* ============ PHOTOS: grayscale until scrolled into view (JS adds .tone) ============ */
figure { margin: 0; }
.gallery { display: grid; grid-template-columns: 1fr; gap: var(--space-2); margin-top: var(--space-5); }
.job .gallery { margin-top: var(--space-3); }
.gallery img, .project-photo img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; cursor: zoom-in; }
.gallery-2 img, .project-photo img { aspect-ratio: 4 / 3; }
figcaption { margin-top: var(--space-1); color: var(--muted); font-size: var(--fs-caption); line-height: 1.5; }
/* Without JS photos stay in color; with JS they start gray and fill with color as they come into view */
img.tone { filter: grayscale(100%); transition: filter var(--dur) var(--ease); }

/* ============ FLOATECH POND ANIMATION: flat drawing in the charcoal band ============ */
/* Intro text and drawing: stacked on phones, side by side from 960px */
.feature-intro { display: grid; grid-template-columns: 1fr; gap: var(--space-5); align-items: center; }
.pond { margin: 0; max-width: 560px; }
.pond-frame { border: 1px solid var(--on-dark); }
.pond-art { display: block; width: 100%; height: auto; }
.pond figcaption {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-1);
  margin-top: var(--space-1); color: var(--on-dark);
}
.pond figcaption .label { margin: 0; }
/* Drawing colors come from the seven tokens */
.p-sand { fill: var(--sand); stroke: var(--ink); stroke-width: 1.5; }
.p-silver { fill: var(--line); stroke: var(--ink); stroke-width: 1.5; }
.p-panel { fill: var(--ink); stroke: var(--on-dark); stroke-width: 1; }
.p-frame { fill: none; stroke: var(--on-dark); stroke-width: 2; }
.p-thin { fill: none; stroke: var(--on-dark); stroke-width: 1; }
.p-thin-ink { fill: none; stroke: var(--ink); stroke-width: 1; }
.p-faint { opacity: 0.5; }
.p-cable { fill: none; stroke: var(--on-dark); stroke-width: 1.5; }
.p-ondark { fill: var(--on-dark); }
.p-ring { fill: none; stroke: var(--on-dark); stroke-width: 1.5; }
.p-water { fill: var(--ink); opacity: 0.88; }
.p-fish { fill: var(--sand); opacity: 0.45; }
.p-text { fill: var(--ink); font: 700 13px "Poppins", sans-serif; letter-spacing: 0.02em; }


/* The loop: everything waits (paused) until script.js says the drawing is on screen (pond and project toys) */
.pond .anim, .toy .anim { animation-play-state: paused; animation-iteration-count: infinite; }
.pond.is-playing .anim, .toy.is-playing .anim { animation-play-state: running; }
/* Without JavaScript the drawings are plain still pictures */
.pond:not(.is-ready) .anim, .toy:not(.is-ready) .anim { animation: none; }
/* Moving bits only appear once the loop can run, so the still drawing has no stray dots */
.pond:not(.is-ready) .particle, .toy:not(.is-ready) .particle { display: none; }
.bob { animation: bob 5s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(3px); } }
.wave1 { animation: wave-left 6s linear infinite; }
.wave2 { animation: wave-right 9s linear infinite; }
@keyframes wave-left { to { transform: translateX(-80px); } }
@keyframes wave-right { from { transform: translateX(-80px); } to { transform: none; } }
/* Feeding: the thrower disc spins and broadcasts pellets in low arcs past the barrels; they ripple where they land
   in open water, and fish rise to eat */
.spinner { transform-box: fill-box; transform-origin: center; animation: spin 0.35s linear infinite; }
@keyframes spin { 50% { transform: scaleX(0.25); } }
.pellet-x { animation: pellet-x 2.4s linear infinite; }
.pellet-y { animation: pellet-y 2.4s infinite; }
.splash { transform-box: fill-box; transform-origin: center; animation: splash 2.4s ease-out infinite; opacity: 0; }
.px1 { --dx: -212px; --h: -16px; } .px1, .px1 .pellet-y, .sp1 { animation-delay: 0s; }
.px2 { --dx: -186px; --h: -22px; } .px2, .px2 .pellet-y, .sp2 { animation-delay: -2.1s; }
.px3 { --dx: -162px; --h: -14px; } .px3, .px3 .pellet-y, .sp3 { animation-delay: -1.8s; }
.px4 { --dx: -140px; --h: -20px; } .px4, .px4 .pellet-y, .sp4 { animation-delay: -1.5s; }
.px5 { --dx: 140px; --h: -18px; } .px5, .px5 .pellet-y, .sp5 { animation-delay: -1.2s; }
.px6 { --dx: 162px; --h: -22px; } .px6, .px6 .pellet-y, .sp6 { animation-delay: -0.9s; }
.px7 { --dx: 188px; --h: -14px; } .px7, .px7 .pellet-y, .sp7 { animation-delay: -0.6s; }
.px8 { --dx: 214px; --h: -20px; } .px8, .px8 .pellet-y, .sp8 { animation-delay: -0.3s; }
@keyframes pellet-x { from { transform: none; } 70%, to { transform: translateX(var(--dx)); } }
@keyframes pellet-y {
  0% { transform: none; opacity: 1; animation-timing-function: ease-out; }
  30% { transform: translateY(var(--h)); animation-timing-function: ease-in; }
  70% { transform: translateY(22px); opacity: 1; }
  71%, 100% { transform: translateY(22px); opacity: 0; }
}
@keyframes splash {
  0%, 69% { transform: scale(1); opacity: 0; }
  70% { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(4, 2); opacity: 0; }
}
.p-fish--feeding { opacity: 0.7; }
.feeder-fish { animation: nibble 2.4s ease-in-out infinite; }
@keyframes nibble {
  0%, 100% { transform: translate(0, 10px); }
  45% { transform: translate(6px, -14px); }
  60% { transform: translate(4px, -12px); }
}
.ff2 { animation-name: nibble-left; animation-delay: -1.2s; }
@keyframes nibble-left {
  0%, 100% { transform: translate(0, 10px); }
  45% { transform: translate(-6px, -14px); }
  60% { transform: translate(-4px, -12px); }
}
/* Microbubbles: a fine plume that wobbles, grows a little as it rises and fades at the surface */
.mb { transform-box: fill-box; transform-origin: center; animation: microbubble 2s ease-in infinite; }
.mb1 { --x: 1.1px; animation-duration: 1.8s; animation-delay: -1.4s; }
.mb2 { --x: -3.5px; animation-duration: 2.01s; animation-delay: -1.31s; }
.mb3 { --x: 1.4px; animation-duration: 1.67s; animation-delay: -0.49s; }
.mb4 { --x: 0.7px; animation-duration: 2.07s; animation-delay: -0.75s; }
.mb5 { --x: 2.4px; animation-duration: 2.1s; animation-delay: -0.72s; }
.mb6 { --x: 0.6px; animation-duration: 2.37s; animation-delay: -0.59s; }
.mb7 { --x: 1.8px; animation-duration: 2.18s; animation-delay: -2.1s; }
.mb8 { --x: -3.1px; animation-duration: 1.92s; animation-delay: -2.35s; }
.mb9 { --x: -2.8px; animation-duration: 2.06s; animation-delay: -1.82s; }
.mb10 { --x: 1.3px; animation-duration: 2.14s; animation-delay: -0.09s; }
.mb11 { --x: 3.0px; animation-duration: 2.44s; animation-delay: -1.38s; }
.mb12 { --x: 0.8px; animation-duration: 1.95s; animation-delay: -1.67s; }
.mb13 { --x: 2.7px; animation-duration: 2.24s; animation-delay: -1.09s; }
.mb14 { --x: 1.3px; animation-duration: 2.64s; animation-delay: -1.14s; }
@keyframes microbubble {
  0% { transform: translate(0, 0) scale(0.6); opacity: 0; }
  10% { opacity: 0.9; }
  40% { transform: translate(var(--x), -20px) scale(0.9); }
  70% { transform: translate(calc(var(--x) * -0.5), -38px) scale(1.1); opacity: 0.8; }
  100% { transform: translate(var(--x), -54px) scale(1.3); opacity: 0; }
}
/* Surface fizz above the diffuser */
.boil { transform-box: fill-box; transform-origin: center; animation: boil 1.6s ease-out infinite; }
.boil2 { animation-delay: -0.8s; }
@keyframes boil { from { transform: scaleX(1); opacity: 0.8; } to { transform: scaleX(3); opacity: 0; } }
/* Sensor: a ring spreads from the probe */
.pulse { transform-box: fill-box; transform-origin: center; animation: pulse 2.4s ease-out infinite; }
@keyframes pulse { from { transform: scale(1); opacity: 0.9; } to { transform: scale(4); opacity: 0; } }
/* GSM: signal arcs light up outward from the antenna */
.signal { animation: signal 1.8s ease-in-out infinite; opacity: 0; }
.s2 { animation-delay: 0.3s; } .s3 { animation-delay: 0.6s; }
@keyframes signal { 30% { opacity: 1; } 60%, 100% { opacity: 0; } }
/* Fish drift slowly across the pond */
.fish1 { animation: fish 22s linear infinite; }
.fish2 { animation: fish 30s linear infinite; animation-delay: -14s; }
@keyframes fish { from { transform: translateX(920px); } to { transform: none; } }

/* ============ PROJECT TOYS: small looping drawings on the Other projects cards ============ */
.toy { margin: 0 0 var(--space-2); }
.toy svg { display: block; width: 100%; max-width: 176px; height: auto; overflow: hidden; }
.t-body { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.t-ink { fill: var(--ink); }
.t-accent { fill: var(--sand); stroke: var(--ink); stroke-width: 1.5; }
.t-accent-flat { fill: var(--sand); }
.t-thin { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.t-trace { fill: none; stroke: var(--sand); stroke-width: 1.5; }
.t-grid { fill: none; stroke: var(--on-dark); stroke-width: 0.5; opacity: 0.25; }
.t-leg-far { fill: var(--line); stroke: var(--ink); stroke-width: 1; }
.t-dash { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 8 6; }
.t-note { fill: var(--ink); font: 700 14px "Inter", sans-serif; }
/* Pivots: each moving part turns around its own joint */
.knob, .cone, .eye, .vu, .leg, .type, .note { transform-box: fill-box; }
.knob, .cone, .eye { transform-origin: center; }
.vu { transform-origin: 50% 100%; }
.leg { transform-origin: 50% 0; }
.type { transform-origin: 0 50%; }
/* Function generator */
.fg-wave { animation: fg-wave 3.6s linear infinite; }
@keyframes fg-wave { to { transform: translateX(-120px); } }
.knob-a { animation: knob 4s ease-in-out infinite; }
.knob-b { animation: knob 3s ease-in-out infinite reverse; }
@keyframes knob { 50% { transform: rotate(240deg); } }
.blink { animation: blink 1.2s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0.15; } }
/* Mono amplifier and speaker */
.vu { animation: vu 0.9s ease-in-out infinite; }
.v2 { animation-duration: 0.7s; } .v3 { animation-duration: 1.1s; } .v4 { animation-duration: 0.6s; }
@keyframes vu { 0%, 100% { transform: scaleY(0.25); } 50% { transform: scaleY(1); } }
.cone { animation: cone 0.45s ease-in-out infinite; }
@keyframes cone { 50% { transform: scale(1.12); } }
.sound { animation: signal 1.35s ease-in-out infinite; opacity: 0; }
.w2 { animation-delay: 0.2s; } .w3 { animation-delay: 0.4s; }
.note { animation: note 2.6s ease-out infinite; opacity: 0; }
.n2 { animation-delay: 1.3s; }
@keyframes note { 0% { transform: none; opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(12px, -18px) rotate(15deg); opacity: 0; } }
/* Walking cobot */
.ground { animation: ground 0.8s linear infinite; }
@keyframes ground { to { transform: translateX(-14px); } }
.bot { animation: bot 0.4s ease-in-out infinite; }
@keyframes bot { 50% { transform: translateY(-2px); } }
/* Diagonal pairs move together, like a four-legged walk */
.leg-a { animation: swing 0.8s ease-in-out infinite; }
.leg-b { animation: swing 0.8s ease-in-out infinite; animation-delay: -0.4s; }
@keyframes swing { 0%, 100% { transform: rotate(16deg); } 50% { transform: rotate(-16deg); } }
.eye { animation: eye 3.5s ease-in-out infinite; }
@keyframes eye { 0%, 92%, 100% { transform: none; } 96% { transform: scaleY(0.1); } }
/* This website: lines type in one after another, then clear */
.type { animation: type 4.8s ease-out infinite; animation-fill-mode: both; }
.t2 { animation-name: type2; } .t3 { animation-name: type3; } .t4 { animation-name: type4; }
@keyframes type { 0% { transform: scaleX(0); } 12%, 88% { transform: scaleX(1); } 100% { transform: scaleX(0); } }
@keyframes type2 { 0%, 12% { transform: scaleX(0); } 26%, 88% { transform: scaleX(1); } 100% { transform: scaleX(0); } }
@keyframes type3 { 0%, 26% { transform: scaleX(0); } 38%, 88% { transform: scaleX(1); } 100% { transform: scaleX(0); } }
@keyframes type4 { 0%, 38% { transform: scaleX(0); } 52%, 88% { transform: scaleX(1); } 100% { transform: scaleX(0); } }

/* ============ FLOATECH CALLOUTS: numbered labels on the pond photo ============ */
/* The photo keeps its own shape here (no crop), so the percentage positions land on the right parts */
.annotated { position: relative; }
.project-photo .annotated img { aspect-ratio: 1400 / 787; }
.callouts { position: absolute; inset: 0; margin: 0; padding: 0; list-style: none; pointer-events: none; }
/* Each callout is a point on the part: a small square marker, a 1px leader line and a label */
.callout { position: absolute; width: 0; height: 0; }
.callout::before {
  content: ""; position: absolute; left: -5px; top: -5px; width: 10px; height: 10px;
  background: var(--paper); border: 1px solid var(--ink);
}
.callout::after {
  content: ""; position: absolute; top: 0; width: 28px; height: 1px; background: var(--paper);
  transform-origin: left center;
}
.callout span {
  position: absolute; top: -12px; padding: 4px 6px; white-space: nowrap;
  background: var(--paper); color: var(--ink); border: 1px solid var(--ink);
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.04em; line-height: 1.2;
}
.callout--right::after { left: 5px; }
.callout--right span { left: 33px; }
.callout--left::after { right: 5px; transform-origin: right center; }
.callout--left span { right: 33px; }
/* Positions on floatech-photo.jpg (1400 × 787) */
.callout--1 { left: 55%; top: 55%; }  /* feeder: the silver feed thrower below the blue box */
.callout--2 { left: 63%; top: 29%; }  /* GSM module: top of the blue box */
.callout--3 { left: 51.5%; top: 87.5%; }  /* sensor probe hanging at the front */
.callout--4 { left: 62.5%; top: 82.5%; }  /* bubbles from the diffuser under the frame */
/* The longest label gets a shorter line so it stays inside the photo */
.callout--4::after { width: 14px; }
.callout--4 span { left: 19px; }
/* Where the photo is a half-width column, the longest label wraps onto two lines to stay inside it */
@media (min-width: 960px) and (max-width: 1299px) { .callout--4 span { white-space: normal; width: 7.5em; } }
/* On phones the photo is too small for names: only the numbers show, and the list below names each part */
.callout em { display: none; font-style: normal; }
.callout-list {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px var(--space-2); margin: var(--space-1) 0 0; padding: 0;
  list-style: none; font-size: 0.8125rem; font-weight: 600;
}
img.tone.in-view { filter: grayscale(0%); }

/* ============ TAG CHIPS: outlined, square, uppercase; no skill levels ============ */
.chips { list-style: none; padding: 0; margin: var(--space-3) 0 0; display: flex; flex-wrap: wrap; gap: var(--space-1); }
.chips li, .badge-ai {
  display: inline-block; margin: 0; padding: 5px 10px; border: 1px solid var(--ink);
  font-size: var(--fs-label); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; line-height: 1.4;
}
.card .badge-ai { margin-top: var(--space-2); }

/* ============ OTHER PROJECTS ============ */
.mini-projects { display: grid; grid-template-columns: 1fr; column-gap: var(--space-4); }
.card { padding: var(--space-3) 0; border-top: 1px solid var(--line); }
.card p { margin: 0 0 4px; }
.card .label { margin-bottom: var(--space-1); }
.mini-projects .card > p:not(.badge-ai) { color: var(--muted); }

/* ============ SKILLS ============ */
.skills { display: grid; grid-template-columns: 1fr; gap: var(--space-5); }
.skills h3 { padding-bottom: var(--space-1); border-bottom: 1px solid var(--ink); }
.skills .chips { margin-top: var(--space-2); }

/* ============ EXPERIENCE ============ */
.job { padding: var(--space-4) 0; border-top: 1px solid var(--line); }
.year { margin: 0 0 var(--space-1); font-family: var(--font-head); font-size: var(--fs-label); font-weight: 700; letter-spacing: 0.12em; }
.org { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-small); }
.logo { height: 26px; width: auto; }

/* ============ AWARDS: sand band; only --ink text on sand (contrast) ============ */
.band-sand { background: var(--sand); color: var(--ink); }
.band-sand .label, .band-sand figcaption { color: var(--ink); }
.awards { display: grid; grid-template-columns: 1fr; gap: var(--space-2); }
.award { padding: var(--space-3); background: var(--paper); }
.award p:last-child { margin: 0; }
.award-title { margin: 0 0 4px; font-family: var(--font-head); font-size: var(--fs-card); font-weight: 700; line-height: 1.25; }

/* ============ EDUCATION ============ */
.edu { display: grid; grid-template-columns: 1fr; column-gap: var(--space-4); }
.edu h3 { margin-bottom: 4px; }
.training { margin-top: var(--space-5); }

/* ============ CAREER ROADMAP: timeline with a visible time axis ============ */
.roadmap {
  list-style: none; margin: var(--space-5) 0 0; padding: 0 0 0 var(--space-4);
  border-left: 2px solid var(--ink);
}
.roadmap > li { position: relative; margin: 0; padding-bottom: var(--space-5); }
.roadmap > li:last-child { padding-bottom: 0; }
/* Square marker sitting on the axis */
.roadmap > li::before {
  content: ""; position: absolute; top: 4px; left: calc(var(--space-4) * -1 - 8px);
  width: 14px; height: 14px; background: var(--paper); border: 2px solid var(--ink);
}
.roadmap .when { color: var(--ink); }
.roadmap ul { margin-bottom: 0; }

/* ============ CONTACT: charcoal block ============ */
.contact {
  display: grid; grid-template-columns: 1fr; gap: var(--space-4);
  margin-top: var(--space-section); padding: var(--space-section) var(--space-2) var(--space-5);
  background: var(--charcoal); color: var(--on-dark);
}
.contact > div { width: 100%; max-width: var(--max); margin: 0 auto; }
.contact .label, .contact dt { color: var(--on-dark); }
.contact h2 { margin-bottom: var(--space-3); }
.contact .btn-primary { background: var(--on-dark); color: var(--charcoal); border-color: var(--on-dark); }
.contact .btn-primary:hover { background: transparent; color: var(--on-dark); }
.resume-btn { margin-top: var(--space-2); }
.email-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: var(--space-4); }
.email {
  font-family: var(--font-head); font-size: clamp(1.05rem, 4vw, 1.6rem); font-weight: 700;
  text-decoration: none; border-bottom: 2px solid var(--on-dark); overflow-wrap: anywhere;
}
.copy-btn {
  font: inherit; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em;
  padding: 10px 14px; cursor: pointer; background: transparent; color: var(--on-dark); border: 1px solid var(--on-dark);
}
.contact-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-3); margin: 0; }
/* Links in the contact details get a comfortable tap height */
.contact-grid dd a { display: inline-block; padding: 6px 0; }

/* ============ FOOTER ============ */
.footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px;
  /* Extra bottom space so "Back to top" stays clear of the chat button in the corner */
  padding: var(--space-3) var(--space-2) calc(56px + var(--space-4)); color: var(--muted);
  font-size: var(--fs-label); font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em;
}
.footer p { margin: 0; }
/* Privacy note about the visitor counter, on its own line in sentence case */
.footer .footer-note { flex-basis: 100%; font-weight: 400; text-transform: none; letter-spacing: 0; }.footer a { display: inline-block; padding: 11px 0; color: var(--muted); text-decoration: none; }
.footer a:hover { color: var(--ink); }

/* ============ LIGHTBOX ============ */
.lightbox {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  padding: var(--space-3); background: var(--charcoal); cursor: zoom-out;
  visibility: hidden; opacity: 0; transition: opacity var(--dur-fast) var(--ease), visibility 0s linear var(--dur-fast);
}
.lightbox.open { visibility: visible; opacity: 1; transition: opacity var(--dur-fast) var(--ease), visibility 0s; }
.lightbox img { max-height: 90vh; max-width: 100%; }

/* ============ CHATBOT: floating round button + square chatbox (see .claude/rules/chatbot.md) ============ */
/* Round button (approved exception to border-radius 0); chatbot.js sets --chat-x/--chat-y while dragging */
.chat-fab {
  position: fixed; left: 0; top: 0; z-index: 40; width: 56px; height: 56px; padding: 0;
  display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--paper);
  background: var(--ink); color: var(--paper); cursor: grab; touch-action: none; user-select: none;
  transform: translate3d(var(--chat-x, calc(100vw - 72px)), var(--chat-y, calc(100vh - 72px)), 0);
  visibility: hidden;
}
/* The edge-snap glide is enabled only after the first placement, so the saved position appears without a jump */
.chat-fab.is-ready { visibility: visible; transition: transform 250ms var(--ease); }
/* While the chatbox is open the button steps aside, so it never covers the conversation */
.chat-fab.is-active { visibility: hidden; }
.chat-fab.is-dragging { transition: none; cursor: grabbing; }
/* Hover and focus invert the button, so the change shows on both light and dark sections */
.chat-fab:hover, .chat-fab:focus-visible { background: var(--paper); color: var(--ink); border-color: var(--ink); }
.chat-fab:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

/* Chatbox panel: near full-screen on phones, a 380px panel beside the button on wider screens */
.chat-panel {
  position: fixed; z-index: 39; inset: calc(var(--nav-h) + var(--space-1)) var(--space-1) var(--space-1) var(--space-1);
  display: flex; flex-direction: column; background: var(--paper); color: var(--ink); border: 1px solid var(--ink);
  visibility: hidden; opacity: 0; transform: translateY(12px) scale(0.98); transform-origin: bottom right;
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), visibility 0s linear var(--dur-fast);
}
.chat-panel.is-left { transform-origin: bottom left; }
.chat-panel.is-open { visibility: visible; opacity: 1; transform: none; transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), visibility 0s; }
.chat-panel:focus { outline: none; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-2); border-bottom: 1px solid var(--line); }
.chat-head .label { margin: 0 0 2px; }
.chat-head h2 { font-size: 1.3rem; line-height: 1.2; letter-spacing: -0.01em; margin: 0; }
.chat-close { width: 44px; height: 44px; flex: none; border: 0; background: none; color: var(--ink); font-size: 1.1rem; cursor: pointer; }

/* Conversation: assistant on the left, visitor on the right */
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: var(--space-2); }
.chat-thread { display: flex; flex-direction: column; gap: 12px; }
.chat-msg { max-width: 88%; padding: 10px 12px; font-size: 0.92rem; line-height: 1.5; }
.chat-msg p { margin: 0; }
.chat-msg--bot { align-self: flex-start; border: 1px solid var(--line); border-left: 3px solid var(--ink); }
.chat-msg--user { align-self: flex-end; background: var(--ink); color: var(--paper); }
.chat-link { display: inline-flex; align-items: center; min-height: 44px; margin: 4px 16px 0 0; font-size: 0.85rem; font-weight: 600; }

/* Suggested questions: tap targets of at least 44px */
/* Suggestions sit in the conversation after the latest answer; the bottom padding lets a short answer still scroll to the top */
.chat-suggest { display: flex; flex-wrap: wrap; gap: var(--space-1); padding: 4px 0 0; }
.chat-log::after { content: ""; flex: none; height: 40%; }
.chat-chip {
  min-height: 44px; padding: 8px 12px; border: 1px solid var(--ink); background: var(--paper); color: var(--ink);
  font: inherit; font-size: 0.84rem; line-height: 1.3; text-align: left; cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.chat-chip:hover { background: var(--ink); color: var(--paper); }

/* Typed question field and privacy line */
.chat-form { display: flex; border-top: 1px solid var(--line); }
.chat-input { flex: 1; min-width: 0; padding: 14px var(--space-2); border: 0; background: var(--paper); color: var(--ink); font: inherit; font-size: 1rem; }
.chat-input:focus-visible { outline-offset: -3px; }
.chat-send {
  padding: 0 var(--space-3); border: 0; background: var(--ink); color: var(--paper); cursor: pointer;
  font-family: var(--font-head); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em;
}
.chat-send:focus-visible { outline-color: var(--paper); outline-offset: -4px; outline-width: 3px; }
.chat-note { margin: 0; padding: var(--space-1) var(--space-2) 12px; color: var(--muted); font-size: 0.72rem; }
.chat-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (min-width: 640px) {
  /* Names fit on the photo from 640px, so the list below is kept for screen readers only */
  .callout em { display: inline; }
  .callout-list { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .chat-panel {
    inset: auto var(--space-2) 88px auto; width: 380px;
    height: min(600px, calc(100vh - var(--nav-h) - 120px));
  }
  .chat-panel.is-left { inset: auto auto 88px var(--space-2); }
}
@media print { .chat-fab, .chat-panel { display: none; } }

/* ============ MOTION (see .claude/rules/motions.md) ============ */
/* Hero: label, name, lead, buttons and facts rise in one after another on page load */
@keyframes rise { from { opacity: 0; transform: translateY(var(--rise-hero)); } }
.hero .status, .hero h1, .hero .lede, .hero-actions, .hero .facts { animation: rise var(--dur-slow) var(--ease) both; }
.hero h1 { animation-delay: calc(var(--stagger) * 1); }
.hero .lede { animation-delay: calc(var(--stagger) * 2); }
.hero-actions { animation-delay: calc(var(--stagger) * 3); }
.hero .facts { animation-delay: calc(var(--stagger) * 4); }

/* Fallback for browsers without scroll-linked animation: each block fades and rises as it enters, no delays */
.reveal { opacity: 0; transform: translateY(var(--rise-block)); transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease); }
.reveal.visible { opacity: 1; transform: none; }
.section-head.reveal { transform: translateX(calc(var(--rise-block) * -1)); }
.section-head.reveal.visible { transform: none; }

/* Scroll-linked motion: blocks, titles and photos move continuously with the scroll position, no waiting */
@supports (animation-timeline: view()) {
  @keyframes block-in { from { opacity: 0; transform: translateY(var(--rise-block)); } to { opacity: 1; transform: none; } }
  @keyframes title-in { from { opacity: 0; transform: translateX(calc(var(--rise-block) * -1)); } to { opacity: 1; transform: none; } }
  @keyframes photo-in {
    /* The wipe ends 8px outside the photo, so a keyboard focus ring around it isn't clipped */
    from { filter: grayscale(100%); clip-path: inset(var(--wipe) -8px -8px -8px); }
    to { filter: grayscale(0%); clip-path: inset(-8px); }
  }
  .reveal, img.tone {
    transition: none;
    animation-timing-function: linear; animation-fill-mode: both;
    animation-duration: 1ms; animation-duration: auto;
    animation-timeline: view();
  }
  /* Blocks and titles finish once they're about a third of the way up the screen */
  .reveal { opacity: 1; transform: none; animation-name: block-in; animation-range: entry 0% cover 30%; }
  .section-head.reveal { transform: none; animation-name: title-in; }
  /* Photos uncover from the bottom up and fill with color until they're near the middle */
  img.tone { animation-name: photo-in; animation-range: entry 0% cover 45%; }
  /* Callouts draw in one after another as the photo moves up: the line grows, then the label fades in */
  @keyframes line-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  @keyframes label-in { from { opacity: 0; } to { opacity: 1; } }
  .annotated { view-timeline-name: --callouts; }
  .annotated img.tone ~ .callouts .callout::before,
  .annotated img.tone ~ .callouts .callout::after,
  .annotated img.tone ~ .callouts .callout span {
    animation-timing-function: linear; animation-fill-mode: both;
    animation-duration: 1ms; animation-duration: auto;
    animation-timeline: --callouts;
  }
  .annotated img.tone ~ .callouts .callout::before { animation-name: label-in; }
  .annotated img.tone ~ .callouts .callout::after { animation-name: line-in; }
  .annotated img.tone ~ .callouts .callout span { animation-name: label-in; }
  .callout--1::before, .callout--1::after, .callout--1 span { animation-range: cover 25% cover 35%; }
  .callout--2::before, .callout--2::after, .callout--2 span { animation-range: cover 30% cover 40%; }
  .callout--3::before, .callout--3::after, .callout--3 span { animation-range: cover 35% cover 45%; }
  .callout--4::before, .callout--4::after, .callout--4 span { animation-range: cover 40% cover 50%; }
}
/* Browsers without scroll-linked motion: the callouts fade in together once the photo is in view */
@supports not (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .annotated img.tone ~ .callouts .callout { opacity: 0; transition: opacity var(--dur-slow) var(--ease); }
    .annotated img.tone.in-view ~ .callouts .callout { opacity: 1; }
  }
}

/* Printing shows everything in its final state, in color */
@media print {
  .reveal { opacity: 1; transform: none; animation: none; }
  img.tone { filter: none; clip-path: none; animation: none; }
  .callout::before, .callout::after, .callout span { opacity: 1; transform: none; animation: none; }
  .pond .particle, .toy .particle { display: none !important; }
  .pond .anim, .toy .anim { animation: none !important; }
  /* Keep the dark bands dark on paper, so their light text stays readable */
  .band-dark, .contact { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ============ TABLET: 640px and up ============ */
@media (min-width: 640px) {
  .wrap { padding-left: var(--space-4); padding-right: var(--space-4); }
  /* The three-photo FLOATech gallery goes straight to three across, so no photo is left alone on a row */
  .gallery { grid-template-columns: repeat(3, 1fr); }
  .facts, .contact-grid, .awards, .edu, .mini-projects, .skills, .functions, .gallery-4, .gallery-2 { grid-template-columns: 1fr 1fr; }
  .facts { column-gap: var(--space-4); }
}

/* ============ DESKTOP: 960px and up ============ */
@media (min-width: 960px) {
  .feature-intro { grid-template-columns: 1fr 1fr; gap: var(--space-5); }
  .feature-intro .pond { justify-self: end; width: 100%; }
  :root { --space-section: 96px; }
  .nav-toggle { display: none; }
  .lang-btn { order: 2; margin-left: var(--space-2); }
  .nav-links {
    order: 1; display: flex; position: static; flex-direction: row; gap: var(--space-2); margin-left: auto;
    padding: 0; border: 0; background: none;
  }
  .nav-links a { padding: 4px 0; position: relative; font-size: 0.7rem; letter-spacing: 0.1em; }
  /* Thin underline slides in under the hovered or current link */
  .nav-links a::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--ink);
    transform: scaleX(0); transform-origin: left; transition: transform var(--dur-fast) var(--ease);
  }
  .nav-links a:hover::after, .nav-links a.active::after { transform: scaleX(1); }
  .hero { padding-top: var(--space-section); }
  .facts { grid-template-columns: repeat(4, 1fr); }
  .functions, .awards, .gallery { grid-template-columns: repeat(3, 1fr); }
  .gallery-4 { grid-template-columns: repeat(4, 1fr); }
  /* The two certificates stay two-up, even though they also carry the .gallery class */
  .gallery-2 { grid-template-columns: 1fr 1fr; }
  .project { grid-template-columns: 1fr 1fr; gap: var(--space-5); align-items: start; }
  .job { display: grid; grid-template-columns: 120px 1fr; gap: var(--space-4); }
  /* Roadmap turns horizontal: the time axis runs across the top, one marker per stage */
  .roadmap {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4);
    padding: var(--space-4) 0 0; border-left: 0; border-top: 2px solid var(--ink);
  }
  .roadmap > li { padding-bottom: 0; }
  .roadmap > li::before { top: calc(var(--space-4) * -1 - 8px); left: 0; }
  .contact { grid-template-columns: 1fr 1fr; padding: var(--space-section) var(--space-4) var(--space-5); }
  .contact > div { max-width: calc(var(--max) / 2); }
  .contact > div:first-child { margin-right: 0; }
  .contact > div:last-child { margin-left: 0; }
}

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal, .section-head.reveal { opacity: 1; transform: none; }
  img.tone { filter: none; clip-path: none; }
  /* The pond and project drawings stay still: no moving feed, bubbles, signals or notes */
  .pond .particle, .toy .particle { display: none !important; }
}
