@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=Instrument+Serif:ital@0;1&family=DM+Mono:wght@300;400&display=swap');

:root {
  --bg: #0a0a0a;
  --surface: #111111;
  --surface2: #1c1c1c;
  --border: #2a2a2a;
  --accent: #cc2222;
  --accent2: #e05555;
  --text: #e8e8e8;
  --muted: #888;
  --dim: #444;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Mono', monospace;
  font-weight: 300;
  min-height: 100vh;
  overflow-x: hidden;
  cursor: default;
}

/* Noise overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1;
  opacity: 0.4;
}

/* ── NAV ── */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.2rem 3rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(10,10,10,0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.nav-logo {
  text-decoration: none;
  display: flex;
  align-items: center;
  background: none;
  line-height: 0;
}

.nav-logo img {
  height: 150px;
  width: auto;
  display: block;
}

.nav-logo span { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 2.5rem;
  list-style: none;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: color 0.2s;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--accent);
}
.nav-links a:hover::after, .nav-links a.active::after {
  width: 100%;
}

/* ── HERO ── */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10rem 3rem 4rem;
  position: relative;
  overflow: hidden;
}

.hero-photo-bg {
  position: absolute;
  inset: 0;
  background: url('japan_river.jpg') center center / cover no-repeat;
  filter: brightness(0.35) saturate(0.7);
  z-index: 0;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    rgba(10,10,10,0.85) 0%,
    rgba(10,10,10,0.65) 50%,
    rgba(10,10,10,0.2) 100%
  );
  z-index: 1;
}

.hero > *:not(.hero-photo-bg):not(.hero-overlay) {
  position: relative;
  z-index: 2;
}

.hero-bg {
  display: none;
}

.hero-eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.hero-eyebrow::before {
  content: '';
  width: 40px;
  height: 1px;
  background: var(--accent);
}

.hero h1 {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(3.5rem, 9vw, 8rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  margin-bottom: 2rem;
}

.hero h1 em {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}

.hero-sub {
  max-width: 480px;
  font-size: 0.85rem;
  line-height: 1.8;
  color: var(--muted);
  margin-bottom: 3rem;
}

.hero-actions {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.8rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid var(--border);
  cursor: none;
  transition: all 0.25s ease;
}

.btn-primary {
  background: var(--accent);
  color: #0a0a0a;
  border-color: var(--accent);
  font-weight: 400;
}

.btn-primary:hover {
  background: transparent;
  color: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--text);
  background: rgba(240,237,232,0.05);
}

/* Scroll indicator */
.scroll-hint {
  position: absolute;
  bottom: 2.5rem;
  left: 3rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
}

.scroll-line {
  width: 60px;
  height: 1px;
  background: var(--dim);
  position: relative;
  overflow: hidden;
}

.scroll-line::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%;
  height: 100%;
  background: var(--accent);
  animation: scrollSlide 2s ease-in-out infinite;
}

@keyframes scrollSlide {
  0% { left: -100%; }
  50% { left: 0; }
  100% { left: 100%; }
}

/* ── SECTION BASE ── */
.section {
  padding: 6rem 3rem;
  position: relative;
}

.section-label {
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.section-label::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--accent);
}

.section-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 3rem;
}

/* ── STATS STRIP ── */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  margin: 0 3rem;
}

.stat {
  padding: 2.5rem 2rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.stat-num {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 2.8rem;
  letter-spacing: -0.03em;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.4rem;
}

.stat-label {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── PAGE HEADER ── */
.page-header {
  padding: 10rem 3rem 4rem;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.page-header-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 50% 80% at 80% 50%, rgba(200,240,74,0.03) 0%, transparent 70%);
}

.page-header-num {
  font-family: 'Syne', sans-serif;
  font-size: clamp(6rem, 15vw, 14rem);
  font-weight: 800;
  color: var(--surface2);
  line-height: 1;
  position: absolute;
  right: 2rem;
  top: 50%;
  transform: translateY(-40%);
  letter-spacing: -0.05em;
  user-select: none;
}

.page-header h1 {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(2.5rem, 6vw, 5rem);
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 1rem;
  position: relative;
}

.page-header p {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.8;
  max-width: 500px;
  position: relative;
}

/* ── RESUME PAGE ── */
.resume-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 0;
}

.resume-sidebar {
  border-right: 1px solid var(--border);
  padding: 4rem 3rem;
  position: sticky;
  top: 70px;
  height: fit-content;
}

.resume-main {
  padding: 4rem 3rem;
}

.sidebar-section { margin-bottom: 3rem; }

.sidebar-title {
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.2rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

.contact-item {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.8rem;
}

.contact-label {
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
}

.contact-val {
  font-size: 0.8rem;
  color: var(--text);
}

.contact-val a {
  color: var(--accent2);
  text-decoration: none;
}

.skill-item {
  margin-bottom: 1rem;
}

.skill-name {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  margin-bottom: 0.35rem;
}

.skill-bar {
  height: 2px;
  background: var(--border);
  position: relative;
}

.skill-fill {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  background: var(--accent);
  transition: width 1s ease;
}

/* Resume sections */
.resume-section { margin-bottom: 4rem; }

.resume-section-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 2rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.resume-entry {
  margin-bottom: 2.5rem;
  padding-left: 1.2rem;
  border-left: 2px solid var(--border);
  transition: border-color 0.3s;
}

.resume-entry:hover { border-color: var(--accent); }

.entry-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.3rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.entry-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.entry-date {
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}

.entry-org {
  font-size: 0.75rem;
  color: var(--accent2);
  margin-bottom: 0.7rem;
}

.entry-desc {
  font-size: 0.8rem;
  line-height: 1.8;
  color: var(--muted);
}

/* ── TOOLS PAGE ── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 0;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  margin-top: 1rem;
}

.tool-card {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 2.5rem;
  transition: background 0.25s;
  position: relative;
  overflow: hidden;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 2px;
  height: 0;
  background: var(--accent);
  transition: height 0.35s ease;
}

.tool-card:hover { background: var(--surface); }
.tool-card:hover::before { height: 100%; }

.tool-icon {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  display: block;
}

.tool-name {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}

.tool-tag {
  display: inline-block;
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--border);
  color: var(--muted);
  margin-bottom: 1rem;
}

.tool-desc {
  font-size: 0.78rem;
  line-height: 1.75;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.tool-link {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: gap 0.2s;
}

.tool-link:hover { gap: 0.7rem; }

/* ── PLACEHOLDER card ── */
.tool-card.placeholder {
  opacity: 0.35;
  border-style: dashed;
}

.tool-card.placeholder:hover { background: transparent; }

/* ── FOOTER ── */
footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  color: var(--dim);
  letter-spacing: 0.05em;
}

footer a {
  color: var(--dim);
  text-decoration: none;
  transition: color 0.2s;
}

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

/* ── ANIMATIONS ── */
.fade-up {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.fade-up.visible {
  opacity: 1;
  transform: none;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  nav { padding: 1.2rem 1.5rem; }
  .nav-links { gap: 1.5rem; }
  .hero, .section { padding-left: 1.5rem; padding-right: 1.5rem; }
  .stats-strip { grid-template-columns: 1fr 1fr; margin: 0 1.5rem; }
  .resume-grid { grid-template-columns: 1fr; }
  .resume-sidebar { position: static; border-right: none; border-bottom: 1px solid var(--border); padding: 2rem 1.5rem; }
  .resume-main { padding: 2rem 1.5rem; }
  .page-header { padding: 8rem 1.5rem 3rem; }
  .page-header-num { font-size: 5rem; }
  footer { flex-direction: column; gap: 0.5rem; text-align: center; }
}

/* ── STACK PILLS ── */
.stack-pill {
  display: inline-block;
  padding: 0.45rem 1rem;
  border: 1px solid var(--border);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: var(--surface);
  transition: border-color 0.2s, color 0.2s;
}
.stack-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── CERT CARDS ── */
.cert-card {
  border: 1px solid var(--border);
  padding: 2rem;
  position: relative;
  overflow: hidden;
  transition: background 0.2s;
}
.cert-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px;
  height: 100%;
  background: var(--accent);
}
.cert-card:hover { background: var(--surface); }

/* ── CTA BANNER ── */
.cta-banner {
  margin: 0 3rem 6rem;
  border: 1px solid var(--border);
  padding: 4rem 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 2rem;
  background: var(--surface);
  position: relative;
  overflow: hidden;
}

@media (max-width: 768px) {
  .cta-banner { margin: 0 1.5rem 4rem; padding: 2.5rem 1.5rem; }
}

/* ── HEADSHOT ── */
.headshot-wrap {
  position: relative;
  width: 100%;
  max-width: 320px;
}

.headshot-wrap img {
  width: 100%;
  display: block;
  filter: grayscale(20%);
  transition: filter 0.4s ease;
}

.headshot-wrap:hover img {
  filter: grayscale(0%);
}

.headshot-wrap::before {
  display: none;
}

/* ============================================
   RESPONSIVE IMPROVEMENTS — appended, nothing removed
   ============================================ */

/* Remove tap flash on mobile */
a, button { -webkit-tap-highlight-color: transparent; }

/* Fix cursor on buttons for mobile */
.btn { cursor: pointer; }

/* ── DESKTOP: max-width centering on wide screens ── */
@media (min-width: 1200px) {
  nav {
    padding-left: max(3rem, calc((100vw - 1140px) / 2));
    padding-right: max(3rem, calc((100vw - 1140px) / 2));
  }
  .hero {
    padding-left: max(3rem, calc((100vw - 1140px) / 2));
    padding-right: max(3rem, calc((100vw - 1140px) / 2));
  }
  .section {
    padding-left: max(3rem, calc((100vw - 1140px) / 2));
    padding-right: max(3rem, calc((100vw - 1140px) / 2));
  }
  .page-header {
    padding-left: max(3rem, calc((100vw - 1140px) / 2));
    padding-right: max(3rem, calc((100vw - 1140px) / 2));
  }
  footer {
    padding-left: max(3rem, calc((100vw - 1140px) / 2));
    padding-right: max(3rem, calc((100vw - 1140px) / 2));
  }
  .stats-strip {
    margin-left: max(3rem, calc((100vw - 1140px) / 2));
    margin-right: max(3rem, calc((100vw - 1140px) / 2));
  }
  .cta-banner {
    margin-left: max(3rem, calc((100vw - 1140px) / 2));
    margin-right: max(3rem, calc((100vw - 1140px) / 2));
  }
  /* Tools page inner padding */
  .tools-page-inner {
    padding-left: max(3rem, calc((100vw - 1140px) / 2));
    padding-right: max(3rem, calc((100vw - 1140px) / 2));
  }
}

/* ── MOBILE ── */
@media (max-width: 768px) {

  /* Nav */
  nav {
    padding: 0 1.25rem;
    height: 70px;
  }
  .nav-logo img { height: 100px; }
  .nav-links { gap: 1.25rem; }
  .nav-links a { font-size: 0.7rem; }

  /* Hero */
  .hero {
    padding: 6rem 1.25rem 3rem;
    min-height: 100svh;
  }
  .hero h1 {
    font-size: clamp(3rem, 14vw, 5rem);
    margin-bottom: 1.2rem;
  }
  .hero-sub {
    font-size: 0.8rem;
    margin-bottom: 2rem;
    max-width: 100%;
  }
  .hero-actions { gap: 0.75rem; }
  .btn { padding: 0.75rem 1.4rem; font-size: 0.7rem; }

  /* Stats strip — 2 cols on mobile */
  .stats-strip {
    grid-template-columns: 1fr 1fr;
    margin: 0 1.25rem;
  }
  .stat { padding: 1.5rem 1rem; }
  .stat-num { font-size: 2.2rem; }

  /* Sections */
  .section { padding: 3rem 1.25rem; }
  .section-title {
    font-size: clamp(1.75rem, 7vw, 2.5rem);
    margin-bottom: 1.5rem;
  }

  /* Index: two-col "Who I Am" grid → single col */
  .section > div[style*="grid-template-columns:1fr 1fr"],
  .section > div[style*="grid-template-columns: 1fr 1fr"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 1.5rem !important;
    max-width: 100% !important;
  }

  /* Cert cards grid → single col */
  .section div[style*="grid-template-columns:1fr 1fr"],
  .section div[style*="grid-template-columns: 1fr 1fr"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
    max-width: 100% !important;
  }

  /* Page header (About / Tools) */
  .page-header {
    padding: 6.5rem 1.25rem 2.5rem;
  }
  .page-header h1 {
    font-size: clamp(2.2rem, 10vw, 3.5rem);
  }
  .page-header-num {
    font-size: 4.5rem;
    opacity: 0.3;
  }
  /* About page header: name + headshot row → column */
  .page-header > div[style*="display:flex"],
  .page-header > div[style*="display: flex"] {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 1.5rem !important;
  }
  .headshot-wrap {
    max-width: 160px !important;
  }

  /* Resume layout → single col */
  .resume-grid { grid-template-columns: 1fr; }
  .resume-sidebar {
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 2rem 1.25rem;
  }
  .resume-main { padding: 2rem 1.25rem; }

  /* Entry meta: wrap date below title on small screens */
  .entry-meta { flex-direction: column; gap: 0.2rem; }

  /* CTA banner → stack */
  .cta-banner {
    margin: 0 1.25rem 4rem;
    padding: 2rem 1.25rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
  }

  /* Tools page padding */
  div[style*="padding:0 3rem 6rem"] {
    padding: 0 1.25rem 4rem !important;
  }
  div[style*="padding: 0 3rem 6rem"] {
    padding: 0 1.25rem 4rem !important;
  }
  /* Filter strip */
  div[style*="padding:2rem 3rem"][style*="border-bottom"] {
    padding: 1.25rem !important;
  }
  div[style*="padding: 2rem 3rem"][style*="border-bottom"] {
    padding: 1.25rem !important;
  }
  .tools-grid { grid-template-columns: 1fr; }
  .tool-card { padding: 1.75rem 1.25rem; }

  /* Stack pills */
  .stack-pill { font-size: 0.68rem; padding: 0.35rem 0.75rem; }

  /* Footer */
  footer {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
    padding: 2rem 1.25rem;
  }
}

/* ── iOS notch / home bar safe area ── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  footer {
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
  }
}

/* ── FADE-UP FALLBACK: ensure content always visible ── */
/* If the IntersectionObserver hasn't fired (e.g. already in view on load),
   force visible after a short delay via animation */
.fade-up {
  animation: fadeUpFallback 0.8s ease forwards;
  animation-delay: 0.3s;
}
@keyframes fadeUpFallback {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: none; }
}
/* When JS adds .visible, transition takes over — keep it snappy */
.fade-up.visible {
  opacity: 1 !important;
  transform: none !important;
  animation: none;
}

/*  For offline stream show in red */
.chat-text-input.offline::placeholder {
  color: #ff3b3b !important;
}