/* ============================================================
   self-hosted fonts
   ============================================================ */

@font-face {
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/space-mono-regular.woff2') format('woff2');
}

@font-face {
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/space-mono-bold.woff2') format('woff2');
}

@font-face {
  font-family: 'Space Mono';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/space-mono-italic.woff2') format('woff2');
}

@font-face {
  font-family: 'Space Mono';
  font-style: italic;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/space-mono-bold-italic.woff2') format('woff2');
}

/* ============================================================
   design language tokens — japanese minimalism
   ============================================================ */

:root {
  /* base palette */
  --base:          #F7F5F2;
  --lightest-band: #C0BBB4;
  --light-band:    #A8A39C;
  --mid-band:      #8A8580;
  --dark-band:     #5C5650;
  --sumi:          #2C2C2A;

  /* band gradient (full range for charts) */
  --band-1: #C0BBB4;
  --band-2: #B4AFA8;
  --band-3: #A8A39C;
  --band-4: #AEA9A2;
  --band-5: #9A9590;
  --band-6: #8A8580;
  --band-7: #767170;
  --band-8: #6A6560;
  --band-9: #5C5650;

  /* accents */
  --tetsu: #3B4F5E; /* functional — hover, active, links, focus */
  --shu:   #C45A3C; /* story — use sparingly */

  /* surface */
  --surface:     #F7F5F2;
  --stack-tint:  #EDEAE6;

  /* typography */
  --font-mono: 'Space Mono', monospace;

  /* spacing */
  --space-xs:  0.25rem;
  --space-sm:  0.5rem;
  --space-md:  1rem;
  --space-lg:  2rem;
  --space-xl:  4rem;
  --space-2xl: 8rem;
}

/* ============================================================
   dark mode — sumi (ink stone)
   ============================================================ */

.dark {
  --base:          #1C1B19;
  --surface:       #242320;
  --lightest-band: #333130;
  --light-band:    #444240;
  --mid-band:      #8A8580;
  --dark-band:     #AEA9A2;
  --sumi:          #E8E5E1;
  --tetsu:         #6B8B9E;
  --shu:           #D06A4C;
  --stack-tint:    #232220;

  --band-1: #5C5650;
  --band-2: #6A6560;
  --band-3: #767170;
  --band-4: #8A8580;
  --band-5: #9A9590;
  --band-6: #AEA9A2;
  --band-7: #C4BFB8;
  --band-8: #D4CFC9;
  --band-9: #E0DCD7;
}

/* ============================================================
   reset
   ============================================================ */

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

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

body {
  font-family: var(--font-mono);
  font-size: clamp(0.9rem, 0.8rem + 0.3vw, 1.15rem);
  line-height: 1.6;
  color: var(--sumi);
  background-color: var(--base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

a:hover {
  text-decoration: underline;
}

a:focus-visible {
  outline: 2px solid var(--tetsu);
  outline-offset: 2px;
}

/* ============================================================
   skip link (a11y)
   ============================================================ */

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  z-index: 9999;
  padding: var(--space-sm) var(--space-md);
  background: var(--sumi);
  color: var(--base);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-decoration: none;
  border-radius: 0 0 3px 3px;
  transition: top 0.15s;
}

.skip-link:focus {
  top: 0;
}

/* ============================================================
   layout — main has no max-width; each section handles itself
   ============================================================ */

main {
  min-height: 100vh;
}

/* ============================================================
   nav
   ============================================================ */

.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  background: transparent;
  transition: background 0.35s ease, box-shadow 0.35s ease;
}

.site-nav.scrolled {
  background: var(--base);
  box-shadow: 0 1px 0 rgba(44, 44, 42, 0.08);
}

.nav-logo {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--sumi);
  letter-spacing: 0.04em;
}

.nav-logo:hover {
  text-decoration: none;
  color: var(--tetsu);
}

.nav-links {
  display: flex;
  gap: var(--space-lg);
  align-items: center;
}

.nav-links a {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mid-band);
  text-decoration: none;
  transition: color 0.2s;
  position: relative;
  padding-bottom: 2px;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--sumi);
  transition: width 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.nav-links a:hover {
  color: var(--sumi);
  text-decoration: none;
}

.nav-links a:hover::after {
  width: 100%;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--lightest-band);
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: var(--mid-band);
  font-family: var(--font-mono);
  transition: border-color 0.2s, color 0.2s;
}

.theme-toggle:hover {
  border-color: var(--tetsu);
  color: var(--tetsu);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--tetsu);
  outline-offset: 2px;
}

/* ============================================================
   typography
   ============================================================ */

h1, h2, h3, h4 {
  font-family: var(--font-mono);
  font-weight: 700;
  line-height: 1.2;
}

p {
  max-width: 40em;
}

/* ============================================================
   utilities
   ============================================================ */

.text-muted  { color: var(--mid-band); }
.text-accent { color: var(--tetsu); }
.text-story  { color: var(--shu); }

::selection {
  background-color: var(--tetsu);
  color: var(--base);
}

.label {
  font-size: clamp(0.75rem, 0.6rem + 0.3vw, 1rem);
  color: var(--mid-band);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: var(--space-sm);
}

/* ============================================================
   animations / keyframes
   ============================================================ */

@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* typewriter — chars pre-rendered invisible, revealed one-by-one by typewriter.js */
.tw-char {
  opacity: 0;
}

.tw-char.tw-visible {
  opacity: 1;
}

/* scroll reveal — applied by animations.js */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   hero
   ============================================================ */

/* hero: side-by-side flex — text left (narrow), viz right (flex:1) */
.section-hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  background: var(--base);
}

/* gradient behind transparent nav so links stay readable over the canvas */
.section-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(to bottom, var(--base) 0%, transparent 100%);
  z-index: 1;
  pointer-events: none;
}

/* viz: right flex column */
.hero-viz {
  flex: 1;
  position: relative;
  order: 2;
  min-height: 100vh; /* reserve space before JS runs to prevent CLS */
  max-width: 900px;
}

.hero-viz canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* error state — shown when contributions.csv fails to load */
.viz-error {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Space Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--sumi);
  text-align: center;
  pointer-events: none;
}

/* text zone: wider left column, text pinned to bottom */
.hero-text {
  order: 1;
  width: 55%;
  max-width: 52rem;
  min-width: 28rem;
  padding: var(--space-xl) var(--space-lg) var(--space-2xl) var(--space-lg);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.hero-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--mid-band);
  margin-bottom: var(--space-md);
  animation: fade-in 0.5s ease both;
  animation-delay: 0.1s;
}

.hero-text h1 {
  font-size: clamp(3rem, 6vw + 1rem, 8rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin-bottom: var(--space-lg);
}

.hero-text h1 .cursor {
  color: var(--tetsu);
  animation: blink 1s step-end infinite;
  animation-delay: 1.5s; /* start after typewriter finishes (~26 chars × 35-75ms ≈ 1-2s) */
}

.hero-tagline {
  font-size: clamp(0.85rem, 0.8rem + 0.4vw, 1rem);
  color: var(--mid-band);
  line-height: 1.75;
  max-width: 52em;
  padding: var(--space-md) var(--space-lg);
  background: var(--base);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.hero-tagline.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   section heading — editorial
   ============================================================ */

.section-heading {
  font-size: clamp(0.8rem, 3.2vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: var(--space-2xl);
  color: var(--sumi);
  white-space: nowrap;
}

.heading-prefix {
  color: var(--shu);
}

/* ============================================================
   projects
   ============================================================ */

.section-projects,
.section-stack,
.section-about,
.section-contact {
  scroll-margin-top: 4rem;
}

.section-projects {
  max-width: 72rem;
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-lg);
}

/* scroll entrance — cards start invisible, JS adds .visible */
.project-card {
  border-bottom: 1px solid var(--lightest-band);
  opacity: 0;
  transform: translateY(16px);
}

.project-card:first-of-type {
  border-top: 1px solid var(--lightest-band);
}

.project-card.visible {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.project-card.visible:hover .project-title {
  color: var(--tetsu);
}

.project-card.visible:hover .project-toggle {
  border-color: var(--tetsu);
  color: var(--tetsu);
  transform: scale(1.15);
}

.project-card.visible:hover .project-header[aria-expanded="true"] .project-toggle {
  transform: rotate(45deg) scale(1.15);
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: none;
  border: none;
  padding: var(--space-lg) 0;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-mono);
  color: inherit;
  gap: var(--space-lg);
}

.project-header:focus-visible {
  outline: 2px solid var(--tetsu);
  outline-offset: -2px;
}

.project-header-left {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  flex: 1;
  min-width: 0;
}

.project-title {
  font-size: clamp(1.4rem, 1.8vw + 0.5rem, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  transition: color 0.2s;
  color: var(--sumi);
}

.project-summary {
  font-size: 0.85rem;
  color: var(--mid-band);
  line-height: 1.5;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-xs);
}

.tag {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.25em 0.6em;
  border: 1px solid var(--lightest-band);
  color: var(--mid-band);
  transition: border-color 0.2s, color 0.2s;
}

.tag:hover {
  border-color: var(--tetsu);
  color: var(--tetsu);
}

/* expand toggle — + rotates to × when open */
.project-toggle {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--lightest-band);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mid-band);
  font-size: 1.1rem;
  font-weight: 400;
  line-height: 1;
  transition: border-color 0.2s, color 0.2s,
              transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  user-select: none;
  align-self: center;
}

.project-header[aria-expanded="true"] .project-toggle {
  transform: rotate(45deg);
  border-color: var(--tetsu);
  color: var(--tetsu);
}

/* ── accordion: JS-measured max-height — reliable across all mobile browsers ── */
.project-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.project-body-inner {
  padding-bottom: var(--space-xl);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  align-items: start;
}

.project-desc {
  font-size: 0.9rem;
  color: var(--dark-band);
  line-height: 1.8;
}

.project-desc p {
  margin-bottom: var(--space-md);
  max-width: none;
}

.project-desc p:last-child {
  margin-bottom: 0;
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-lg);
  margin-top: var(--space-md);
}

.project-links a {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--tetsu);
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  position: relative;
  padding-bottom: 2px;
  transition: letter-spacing 0.2s;
}

.project-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: currentColor;
  transition: width 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.project-links a:hover {
  text-decoration: none;
  letter-spacing: 0.1em;
}

.project-links a:hover::after {
  width: 100%;
}

/* screenshot inside expanded body */
.project-screenshot {
  overflow: hidden;
}

.project-screenshot img {
  display: block;
  width: 100%;
  height: auto;
}

.project-diagram {
  margin-top: var(--space-lg);
}

.project-diagram svg {
  width: 100%;
  height: auto;
  display: block;
}

.project-screenshot-placeholder {
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-screenshot-placeholder span {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

/* ── gallery (spending-app multi-image with lightbox) ── */

.project-gallery {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.gallery-main {
  border: 1px solid var(--lightest-band);
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.gallery-main img {
  width: 100%;
  height: auto;
  display: block;
  transition: opacity 0.15s ease;
}

.gallery-main:hover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(44, 44, 42, 0.04);
}

.gallery-thumbs {
  display: flex;
  gap: var(--space-sm);
}

.gallery-thumb {
  flex: 1;
  border: 1px solid var(--lightest-band);
  overflow: hidden;
  cursor: pointer;
  background: none;
  padding: 0;
  opacity: 0.6;
  transition: opacity 0.3s ease, border-color 0.3s ease;
}

.gallery-thumb:hover,
.gallery-thumb.active {
  opacity: 1;
  border-color: var(--tetsu);
}

.gallery-thumb img {
  width: 100%;
  height: auto;
  display: block;
}

.gallery-label {
  font-size: 0.6rem;
  color: var(--mid-band);
  letter-spacing: 0.04em;
  text-align: center;
  padding: 4px 0;
  font-family: var(--font-mono);
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(28, 27, 25, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  cursor: pointer;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, visibility 0s 0.25s;
}

.gallery-lightbox.open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.25s, visibility 0s;
}

.gallery-lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}

.gallery-lightbox-nav {
  position: absolute;
  bottom: var(--space-lg);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: var(--space-md);
}

.gallery-lightbox-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s;
}

.gallery-lightbox-dot.active {
  background: rgba(255, 255, 255, 0.9);
}

.gallery-lightbox-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.5rem;
  cursor: pointer;
  font-family: var(--font-mono);
  line-height: 1;
  padding: var(--space-sm);
  transition: color 0.2s;
}

.gallery-lightbox-close:hover {
  color: rgba(255, 255, 255, 0.9);
}

.gallery-lightbox-prev,
.gallery-lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(247, 245, 242, 0.07);
  border: 1px solid rgba(247, 245, 242, 0.15);
  color: rgba(247, 245, 242, 0.65);
  font-family: var(--font-mono);
  font-size: 1rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.gallery-lightbox-prev { left: var(--space-md); }
.gallery-lightbox-next { right: var(--space-md); }

.gallery-lightbox-prev:hover,
.gallery-lightbox-next:hover {
  background: rgba(247, 245, 242, 0.14);
  border-color: rgba(247, 245, 242, 0.35);
  color: rgba(247, 245, 242, 1);
}

.gallery-lightbox-close:focus-visible,
.gallery-lightbox-dot:focus-visible,
.gallery-lightbox-prev:focus-visible,
.gallery-lightbox-next:focus-visible {
  outline: 2px solid var(--tetsu);
  outline-offset: 2px;
}

/* ============================================================
   stack — warm cream tint
   ============================================================ */

.section-stack {
  background: var(--stack-tint);
  border-top: 1px solid var(--lightest-band);
  border-bottom: 1px solid var(--lightest-band);
}

.section-stack-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-lg);
}

.stack-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-xl) var(--space-lg);
}

.stack-col h4 {
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--mid-band);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--lightest-band);
}

.stack-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.stack-item {
  font-size: 0.85rem;
  color: var(--dark-band);
  cursor: default;
  transition: color 0.15s, transform 0.15s;
  padding: 0.15em 0;
}

.stack-item[data-tech] {
  cursor: crosshair;
}

.stack-item[data-tech]:hover,
.stack-item.active {
  color: var(--tetsu);
  transform: translateX(5px);
}

/* ============================================================
   tech float — appears above hovered stack item
   ============================================================ */

.tech-float {
  position: fixed;
  z-index: 500;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.tech-float.visible {
  opacity: 1;
  transform: translateY(0);
}

.tech-float-card {
  background: var(--base);
  border: 1px solid var(--lightest-band);
  border-left: 2px solid var(--tetsu);
  padding: 0.5rem 0.75rem;
  white-space: nowrap;
}

.tech-float-card-num {
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: var(--mid-band);
  text-transform: uppercase;
}

.tech-float-card-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--sumi);
  margin: 0.1rem 0;
}

.tech-float-card-desc {
  font-size: 0.68rem;
  color: var(--mid-band);
  line-height: 1.4;
}

/* ============================================================
   about
   ============================================================ */

.section-about {
  max-width: 72rem;
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-lg);
  border-top: 1px solid var(--lightest-band);
}

.about-statement {
  font-size: clamp(1.8rem, 2.5vw + 0.5rem, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  max-width: 16em;
  margin-bottom: var(--space-xl);
  color: var(--sumi);
}

.about-body p {
  font-size: 0.95rem;
  color: var(--dark-band);
  line-height: 1.8;
  max-width: 44em;
  margin-bottom: var(--space-md);
}

.about-body p:last-child {
  margin-bottom: 0;
}

/* ============================================================
   contact
   ============================================================ */

.section-contact {
  max-width: 72rem;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg) var(--space-2xl);
  border-top: 1px solid var(--lightest-band);
}

.contact-intro {
  margin-bottom: var(--space-lg);
}

.contact-intro h2 {
  font-size: clamp(1.3rem, 1rem + 0.8vw, 2.2rem);
  margin-bottom: var(--space-md);
}

.contact-intro p {
  font-size: 0.9rem;
  color: var(--dark-band);
  line-height: 1.7;
}

.contact-links {
  display: flex;
  gap: var(--space-lg);
  list-style: none;
  flex-wrap: wrap;
}

.contact-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mid-band);
  text-decoration: none;
  position: relative;
  padding-bottom: 2px;
  transition: color 0.2s;
}

.contact-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: currentColor;
  transition: width 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.contact-links a:hover {
  color: var(--sumi);
  text-decoration: none;
}

.contact-links a:hover::after {
  width: 100%;
}

/* ============================================================
   responsive — mobile
   ============================================================ */

@media (max-width: 768px) {
  .site-nav {
    padding: var(--space-sm) var(--space-md);
    flex-wrap: wrap;
    gap: var(--space-xs);
  }

  .nav-links {
    gap: var(--space-sm);
    flex-wrap: wrap;
  }

  .nav-links a {
    font-size: 0.65rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .theme-toggle {
    min-width: 44px;
    min-height: 44px;
  }

  /* hero: revert to overlay layout on mobile */
  .section-hero {
    position: relative;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
    min-height: 100svh;
  }

  .hero-viz {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    flex: none;
    min-height: 0;
  }

  .hero-viz::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 45%;
    background: linear-gradient(to bottom, transparent 0%, var(--base) 70%);
    pointer-events: none;
    z-index: 1;
  }

  .hero-text {
    position: relative;
    z-index: 2;
    background: transparent;
    width: auto;
    min-width: 0;
    max-width: none;
    padding: var(--space-md) var(--space-md) var(--space-lg);
  }

  .hero-text h1 {
    font-size: clamp(2.5rem, 10vw, 4rem);
  }

  .hero-tagline {
    padding: var(--space-md) var(--space-md);
    transition-delay: 0.2s;
  }

  /* section headings: allow wrap, larger base on mobile */
  .section-heading {
    font-size: clamp(1.2rem, 6vw, 2.2rem);
    white-space: normal;
    margin-bottom: var(--space-xl);
  }

  .section-projects,
  .section-about,
  .section-contact {
    padding: var(--space-xl) var(--space-md);
  }

  .section-stack-inner {
    padding: var(--space-xl) var(--space-md);
  }

  .project-header {
    padding: var(--space-md) 0;
    min-height: 44px;
  }

  .project-title {
    font-size: clamp(1.1rem, 5vw, 1.6rem);
  }

  /* project body: single column on mobile */
  .project-body-inner {
    grid-template-columns: 1fr;
  }

  .stack-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
  }

  /* hide float on mobile — no hover on touch */
  .tech-float {
    display: none;
  }

  .about-statement {
    font-size: clamp(1.4rem, 6vw, 2.5rem);
  }

  .contact-links {
    gap: var(--space-md);
  }

  .gallery-thumbs {
    gap: var(--space-xs);
  }

  .gallery-lightbox {
    padding: var(--space-sm);
  }

  p {
    max-width: none;
  }
}
