/* ---------- tokens ---------- */
:root {
  --bg: #f5f7fa;
  --bg-alt: #eef2f6;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #1f2937;
  --muted: #5b6673;
  --line: #d9e0e8;
  --accent: #1f3a5f;
  --accent-contrast: #ffffff;
  --accent-soft: #e4ebf4;
  --amber: #c9841a;
  --amber-soft: #fbf1df;
  --blue: #2e86ab;
  --blue-soft: #e3f1f6;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px -12px rgba(16, 24, 40, .18);
  --radius: 14px;
  --font: "Inter", "Noto Sans JP", "Hiragino Sans", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f172a; --bg-alt: #111c32; --surface: #172238; --surface-2: #1c2a44;
    --text: #e6eaf0; --muted: #9aa6b8; --line: #2a3a55;
    --accent: #9cc3ea; --accent-contrast: #0f172a; --accent-soft: #1d3252;
    --amber: #f0b85a; --amber-soft: #3a2f16; --blue: #6cc1e2; --blue-soft: #163241;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f172a; --bg-alt: #111c32; --surface: #172238; --surface-2: #1c2a44;
  --text: #e6eaf0; --muted: #9aa6b8; --line: #2a3a55;
  --accent: #9cc3ea; --accent-contrast: #0f172a; --accent-soft: #1d3252;
  --amber: #f0b85a; --amber-soft: #3a2f16; --blue: #6cc1e2; --blue-soft: #163241;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.7;
  font-feature-settings: "palt";
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.3; margin: 0; font-weight: 700; letter-spacing: .01em; }
ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
.container { width: min(1120px, 100% - 32px); margin-inline: auto; }
@media (min-width: 720px) { .container { width: min(1120px, 100% - 48px); } }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-contrast); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.brand { color: var(--text); font-weight: 700; white-space: nowrap; font-size: 17px; letter-spacing: .02em; }
.brand:hover { text-decoration: none; }
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.nav a { color: var(--muted); font-size: 14px; font-weight: 500; padding: 6px 10px; border-radius: 8px; }
.nav a:hover { color: var(--text); background: var(--accent-soft); text-decoration: none; }
.theme-toggle {
  margin-left: 4px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); display: inline-grid; place-items: center; cursor: pointer;
}
.theme-toggle:hover { color: var(--text); }
.theme-toggle svg { grid-area: 1 / 1; }
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
:root[data-theme="dark"] .icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-moon { display: block; }
  :root:not([data-theme="light"]) .icon-sun { display: none; }
}
@media (max-width: 719px) {
  .brand { font-size: 16px; }
  .nav { gap: 2px; }
  .nav a { padding: 5px 5px; font-size: 12.5px; }
  .nav a[href^="http"] { display: none; }
  .theme-toggle { width: 32px; height: 32px; margin-left: 2px; }
}

/* ---------- hero ---------- */
.hero { padding: 56px 0 48px; background:
  radial-gradient(900px 400px at 10% -10%, var(--accent-soft) 0%, transparent 60%),
  radial-gradient(600px 300px at 100% 0%, var(--blue-soft) 0%, transparent 60%); }
.hero-inner { display: grid; gap: 40px; align-items: start; }
@media (min-width: 900px) { .hero-inner { grid-template-columns: 1.4fr 1fr; gap: 56px; } .hero { padding: 80px 0 64px; } }
.eyebrow { margin: 0 0 10px; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--blue); }
.hero h1.name { font-size: clamp(38px, 5.5vw, 56px); letter-spacing: -.01em; }
.roles { margin: 10px 0 0; font-weight: 600; color: var(--accent); font-size: 17px; }
.roles .sep { margin: 0 10px; color: var(--muted); font-weight: 400; }
.tagline { margin: 20px 0 0; font-size: 17px; max-width: 60ch; }
.pr { margin: 16px 0 0; display: grid; gap: 6px; color: var(--muted); font-size: 15px; }
.pr li { padding-left: 18px; position: relative; }
.pr li::before { content: ""; position: absolute; left: 0; top: .72em; width: 8px; height: 8px; border-radius: 2px; background: var(--amber); }
.cta { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 600; font-size: 15px;
  box-shadow: var(--shadow);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 16px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px;
}
.stat-value { font-size: 28px; font-weight: 700; color: var(--accent); letter-spacing: -.01em; line-height: 1.1; }
.stat-label { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* ---------- sections ---------- */
.section { padding: 64px 0; }
@media (min-width: 900px) { .section { padding: 88px 0; } }
.section-alt { background: var(--bg-alt); border-block: 1px solid var(--line); }
.section-head { margin-bottom: 36px; }
.section-head h2 { font-size: clamp(26px, 3.4vw, 34px); }
.section-desc { margin: 10px 0 0; color: var(--muted); max-width: 70ch; }
section[id] { scroll-margin-top: 70px; }

/* ---------- highlights ---------- */
.highlight {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px;
  box-shadow: var(--shadow); margin-bottom: 24px;
}
@media (min-width: 720px) { .highlight { padding: 32px; } }
.tag {
  display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: 12px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; background: var(--accent); color: var(--accent-contrast);
}
.highlight h3 { font-size: 24px; margin-top: 12px; }
.lead { margin: 14px 0 6px; font-weight: 600; }
.bullets { display: grid; gap: 4px; color: var(--muted); font-size: 15px; }
.bullets li { padding-left: 16px; position: relative; }
.bullets li::before { content: ""; position: absolute; left: 2px; top: .78em; width: 6px; height: 6px; border-radius: 50%; background: var(--blue); }
.fig-grid { margin-top: 24px; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.fig-grid-2 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.fig-grid-1 { grid-template-columns: minmax(0, 560px); }
@media (min-width: 900px) {
  .highlight-side { display: grid; grid-template-columns: 1.1fr 1fr; gap: 32px; align-items: start; }
  .highlight-side .fig-grid { margin-top: 0; grid-template-columns: 1fr; }
  .highlight-side .fig-btn { height: 300px; }
}
.fig { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.fig-btn {
  padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface-2);
  cursor: zoom-in; height: 240px; width: 100%; display: block;
}
.fig-btn img { width: 100%; height: 100%; object-fit: contain; }
.fig-tall .fig-btn img { object-fit: cover; object-position: top; }
.fig-btn:hover img { opacity: .92; }
.fig-extras { display: flex; flex-wrap: wrap; gap: 6px; }
.fig-extras img { height: 28px; width: auto; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.fig figcaption { font-size: 13px; line-height: 1.5; display: flex; flex-direction: column; gap: 2px; }
.fig-caption { font-weight: 600; }
.fig-note { color: var(--amber); font-weight: 600; }

/* ---------- skills ---------- */
.skills { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.skill-group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.skill-group h3 { font-size: 14px; color: var(--muted); font-weight: 600; letter-spacing: .04em; margin-bottom: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 13.5px; font-weight: 500;
  background: var(--accent-soft); color: var(--text); border: 1px solid transparent;
}
.chip-sm { font-size: 12px; padding: 2px 9px; background: var(--surface-2); border-color: var(--line); color: var(--muted); }

/* ---------- projects ---------- */
.filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.filter-btn {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; font-size: 14px; font-weight: 500; color: var(--muted);
}
.filter-btn .count { font-size: 12px; opacity: .7; margin-left: 2px; }
.filter-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.projects { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); }
.project {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
  display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow);
}
.project[hidden] { display: none; }
.project-head { display: flex; flex-direction: column; gap: 8px; }
.project-meta-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 12.5px; }
.cat { padding: 2px 9px; border-radius: 6px; font-weight: 600; font-size: 11.5px; letter-spacing: .02em; }
.cat-algorithm { background: var(--accent-soft); color: var(--accent); }
.cat-application { background: var(--blue-soft); color: var(--blue); }
.cat-robotics { background: var(--amber-soft); color: var(--amber); }
.cat-personal { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.period { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 500; }
.period .now { color: var(--amber); font-weight: 600; }
.duration { color: var(--muted); }
.duration::before { content: "·"; margin-right: 8px; }
.project h3 { font-size: 17px; }
.project-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12.5px; color: var(--muted); align-items: center; }
.role { padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); font-weight: 600; }
.role-lead { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.project .bullets { font-size: 14px; }
.position { margin: 0; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--muted); line-height: 1.55; }

/* ---------- education ---------- */
.education { display: grid; gap: 10px; max-width: 720px; }
.education li { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 14px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.edu-period { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 14px; }
.edu-school { font-weight: 600; }
.edu-degree { margin-left: 8px; font-size: 12px; font-weight: 500; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }
@media (max-width: 540px) { .education li { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0; font-size: 13.5px; color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.footer-inner p { margin: 0; }

/* ---------- lightbox ---------- */
.lightbox { border: 0; padding: 0; background: transparent; max-width: min(96vw, 1400px); max-height: 96vh; }
.lightbox::backdrop { background: rgba(10, 15, 30, .82); }
.lightbox img { max-width: 96vw; max-height: 86vh; object-fit: contain; margin: 0 auto; border-radius: 8px; background: #fff; }
.lightbox p { margin: 10px 0 0; text-align: center; color: #fff; font-size: 14px; }
.lightbox-close {
  position: fixed; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.15); color: #fff; font-size: 24px; line-height: 1; cursor: pointer;
}
.lightbox-close:hover { background: rgba(255,255,255,.3); }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .btn:hover { transform: none; } }
@media print {
  .site-header, .theme-toggle, .cta, .filter, .lightbox { display: none !important; }
  .project, .highlight, .skill-group { break-inside: avoid; box-shadow: none; }
}
