/* ============================================================
   Reset & base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

:root {
  /* Dark (default) */
  --bg: #0b0c0f;
  --bg-elev: #131519;
  --surface: #16181d;
  --border: #23262e;
  --text: #e8e9ec;
  --text-dim: #9aa0ac;
  --text-faint: #6b7280;
  --accent: #7dd3fc;
  --accent-strong: #38bdf8;
  --shadow: 0 1px 0 rgba(255,255,255,0.02), 0 20px 40px -24px rgba(0,0,0,0.8);

  --maxw: 960px;
  --gutter: clamp(1.25rem, 5vw, 3rem);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN",
          "Noto Sans JP", "Segoe UI", Meiryo, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

:root[data-theme="light"] {
  --bg: #f7f8fa;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --border: #e4e7ec;
  --text: #14161a;
  --text-dim: #545a66;
  --text-faint: #8a909c;
  --accent: #0284c7;
  --accent-strong: #0369a1;
  --shadow: 0 1px 2px rgba(16,24,40,0.04), 0 12px 32px -20px rgba(16,24,40,0.25);
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .3s ease, color .3s ease;
}

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }
h1, h2, h3 { line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--accent-strong); color: #001018; padding: .6rem 1rem; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

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

/* ============================================================
   Header / Nav
   ============================================================ */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(140%) blur(12px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease, background-color .3s ease;
}
.site-header.is-scrolled { border-bottom-color: var(--border); }

.nav { display: flex; align-items: center; gap: 1.5rem; height: 64px; }
.nav__brand { font-weight: 800; font-size: 1.15rem; letter-spacing: .02em; }
.nav__dot { color: var(--accent-strong); }
.nav__links { display: flex; gap: 1.5rem; margin-left: auto; }
.nav__links a { color: var(--text-dim); font-size: .92rem; transition: color .2s ease; }
.nav__links a:hover { color: var(--text); }

.theme-toggle {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: 50%;
  background: var(--surface); color: var(--text); cursor: pointer;
  transition: border-color .2s ease, transform .15s ease;
}
.theme-toggle:hover { border-color: var(--accent-strong); }
.theme-toggle:active { transform: scale(.94); }
.theme-toggle__icon { width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle at 32% 32%, var(--text) 0 48%, transparent 50%);
  box-shadow: inset -3px -3px 0 0 var(--text);
}
:root[data-theme="light"] .theme-toggle__icon {
  background: var(--accent-strong); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-strong) 30%, transparent);
}

@media (max-width: 560px) {
  .nav__links { display: none; }
}

/* ============================================================
   Hero
   ============================================================ */
.hero { padding-block: clamp(4rem, 14vh, 8rem) clamp(3rem, 8vh, 5rem); text-align: center; }
.hero__eyebrow {
  font-family: var(--mono); font-size: .8rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 1.2rem;
}
.hero__title { font-size: clamp(2.4rem, 8vw, 4.4rem); letter-spacing: -0.03em; }
.hero__lead { color: var(--text-dim); max-width: 46ch; margin: 1.6rem auto 0; font-size: 1.05rem; }
.hero__note { display: block; margin-top: .6rem; font-size: .78rem; color: var(--text-faint); }
.hero__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .9rem; margin-top: 2.4rem; }

.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.4rem; border-radius: 999px; font-size: .95rem; font-weight: 600;
  border: 1px solid transparent; transition: transform .15s ease, background-color .2s ease, border-color .2s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: #0284c7; color: #ffffff; font-weight: 700; }
.btn--primary:hover { background: #0369a1; color: #ffffff; }
.btn--ghost {
  background: var(--surface);
  border-color: var(--text-dim);
  color: var(--text);
}
.btn--ghost:hover { border-color: var(--accent-strong); color: var(--accent); background: var(--bg-elev); }

/* ============================================================
   Section shell
   ============================================================ */
.section { padding-block: clamp(3rem, 9vh, 6rem); border-top: 1px solid var(--border); text-align: center; }
.section__index { font-family: var(--mono); font-size: .8rem; color: var(--text-faint); letter-spacing: .1em; text-align: center; }
.section__title { font-size: clamp(1.6rem, 4vw, 2.2rem); margin-top: .4rem; margin-bottom: 2.2rem; text-align: center; }

/* Reveal on scroll */
.section, .hero { opacity: 1; }
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }

/* ============================================================
   About
   ============================================================ */
.about__grid { display: grid; gap: 2.2rem; align-items: start; max-width: 620px; margin-inline: auto; }
.about__text { color: var(--text-dim); font-size: 1.02rem; }
.about__facts { display: grid; gap: .9rem; }
.about__facts li {
  display: flex; justify-content: space-between; gap: 1rem;
  padding-bottom: .8rem; border-bottom: 1px solid var(--border); font-size: .95rem;
}
.about__facts-key { color: var(--text-faint); }

/* ============================================================
   Skills
   ============================================================ */
.skills { display: grid; grid-template-columns: 1fr; gap: 2rem; max-width: 620px; margin-inline: auto; }
.skills__label { font-size: .82rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-faint); margin-bottom: .9rem; text-align: left; }
.skills .tags { justify-content: flex-start; }
.tags { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
.tags li {
  font-family: var(--mono); font-size: .82rem;
  padding: .35rem .7rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text-dim);
}
.tags--sm li { font-size: .74rem; padding: .25rem .55rem; }
@media (max-width: 640px) { .skills { grid-template-columns: 1fr; gap: 1.4rem; } }

/* ============================================================
   Works
   ============================================================ */
.works { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.2rem; }
.work-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.4rem 1.5rem; box-shadow: var(--shadow);
  transition: transform .2s ease, border-color .2s ease;
}
.work-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent-strong) 40%, var(--border)); }
.work-card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .7rem; }
.work-card__title { font-size: 1.2rem; }
.work-card__year { font-family: var(--mono); font-size: .78rem; color: var(--text-faint); }
.work-card__desc { color: var(--text-dim); font-size: .95rem; margin-bottom: 1rem; }
.work-card__links { display: flex; justify-content: center; gap: 1.2rem; margin-top: 1rem; }
.work-card__links a { font-size: .85rem; color: var(--accent); font-weight: 600; transition: color .2s ease; }
.work-card__links a:hover { color: var(--accent-strong); }
@media (max-width: 640px) { .works { grid-template-columns: 1fr; } }

/* ============================================================
   Career timeline
   ============================================================ */
.timeline { display: grid; gap: 0; position: relative; max-width: 620px; margin-inline: auto; text-align: left; }
.timeline__item { display: grid; grid-template-columns: 160px 1fr; gap: 1.5rem; padding-bottom: 2rem; position: relative; }
.timeline__item::before {
  content: ""; position: absolute; left: 168px; top: .5rem; bottom: -.5rem; width: 1px; background: var(--border);
}
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item:last-child::before { display: none; }
.timeline__period { font-family: var(--mono); font-size: .8rem; color: var(--text-faint); padding-top: .1rem; }
.timeline__body { position: relative; padding-left: 1.6rem; }
.timeline__body::before {
  content: ""; position: absolute; left: -8px; top: .55rem; width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent-strong); box-shadow: 0 0 0 4px var(--bg);
}
.timeline__role { font-size: 1.1rem; }
.timeline__org { color: var(--accent); font-size: .9rem; margin: .1rem 0 .4rem; }
.timeline__desc { color: var(--text-dim); font-size: .92rem; }
@media (max-width: 640px) {
  .timeline__item { grid-template-columns: 1fr; gap: .4rem; }
  .timeline__item::before { display: none; }
  .timeline__body { padding-left: 0; }
  .timeline__body::before { display: none; }
}

/* ============================================================
   Contact
   ============================================================ */
.contact__lead { color: var(--text-dim); margin-bottom: 1.8rem; }
.contact__links { display: flex; justify-content: center; flex-wrap: wrap; gap: 1rem; }
.contact__links a {
  padding: .7rem 1.5rem; border: 1px solid var(--border); border-radius: 999px;
  font-weight: 600; font-size: .95rem; transition: border-color .2s ease, color .2s ease;
}
.contact__links a:hover { border-color: var(--accent-strong); color: var(--accent); }

/* ============================================================
   Footer
   ============================================================ */
.site-footer { border-top: 1px solid var(--border); padding-block: 2rem; margin-top: 2rem; }
.site-footer__inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; color: var(--text-faint); font-size: .85rem; }
.site-footer__top { transition: color .2s ease; }
.site-footer__top:hover { color: var(--accent); }
