:root {
  color-scheme: dark;
  --bg: #0c0b10;
  --bg-deep: #07070a;
  --panel: #151219;
  --panel-2: #1d1720;
  --aubergine: #2c001e;
  --aubergine-light: #4b103e;
  --orange: #e95420;
  --orange-soft: #ff7848;
  --green: #87d67c;
  --blue: #72a8ff;
  --yellow: #f5c86b;
  --text: #f5f2f4;
  --muted: #aaa2ac;
  --dim: #6e6872;
  --line: #302a33;
  --line-bright: #4b414d;
  --shadow: 0 30px 80px rgb(0 0 0 / 38%);
  --tint: rgb(255 255 255 / 1.5%);
  --tint-strong: rgb(255 255 255 / 4%);
  --grid-line: rgb(255 255 255 / 2%);
  --header-bg: rgb(12 11 16 / 86%);
  --header-border: rgb(255 255 255 / 8%);
  --scanline: rgb(0 0 0 / 12%);
  --glow-1: rgb(111 18 76 / 16%);
  --glow-2: rgb(233 84 32 / 7%);
  --on-accent: #fff;
  --terminal-bg: linear-gradient(145deg, rgb(29 23 32 / 96%), rgb(15 13 18 / 98%));
  --surface-solid: rgb(15 13 18 / 75%);
  --backdrop: rgb(5 3 6 / 78%);
  --titlebar-bg: linear-gradient(#39323b, #29232b);
  --titlebar-text: #d6cfd7;
  --dialog-bg: #110e13;
  --contact-bg: linear-gradient(145deg, #1d1520, #100d12);
  --mono: Consolas, "Cascadia Mono", "Cascadia Code", "DejaVu Sans Mono", "Liberation Mono", "Noto Sans Mono CJK JP", "Noto Sans CJK JP", monospace;
  --sans: var(--mono);
  --max: 1400px;
}

/* ── light theme: "paper terminal" ─────────────────────────────── */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f2ede9;
  --bg-deep: #e4dcd5;
  --panel: #fdfbf9;
  --panel-2: #f2ebe5;
  --aubergine: #f0e2ec;
  --aubergine-light: #c9a8bf;
  --orange: #c2410c;
  --orange-soft: #9a3208;
  --green: #2f7d32;
  --blue: #1f5fbf;
  --yellow: #9a6b00;
  --text: #1d1720;
  --muted: #58505c;
  --dim: #857d89;
  --line: #ded4dc;
  --line-bright: #b9adb8;
  --shadow: 0 24px 60px rgb(44 0 30 / 10%);
  --tint: rgb(44 0 30 / 2%);
  --tint-strong: rgb(44 0 30 / 5%);
  --grid-line: rgb(44 0 30 / 4%);
  --header-bg: rgb(253 251 249 / 88%);
  --header-border: rgb(44 0 30 / 12%);
  --scanline: rgb(44 0 30 / 3%);
  --glow-1: rgb(233 84 32 / 10%);
  --glow-2: rgb(114 168 255 / 10%);
  --on-accent: #fff;
  --terminal-bg: linear-gradient(145deg, #fffdfb 0%, #f7f1eb 100%);
  --surface-solid: rgb(255 253 251 / 78%);
  --backdrop: rgb(44 0 30 / 40%);
  --titlebar-bg: linear-gradient(#efe7ea, #e2d8de);
  --titlebar-text: #3b2f3c;
  --dialog-bg: #fdfbf9;
  --contact-bg: linear-gradient(145deg, #fffdfb, #f4ece6);
}

html[data-theme="light"] .page-noise {
  opacity: 0.3;
  mix-blend-mode: multiply;
}

html[data-theme="light"] .photo-frame::after {
  background: linear-gradient(to top, rgb(44 0 30 / 16%), transparent 45%);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scrollbar-color: var(--orange) var(--bg-deep);
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 18% 8%, var(--glow-1), transparent 32rem),
    radial-gradient(circle at 92% 34%, var(--glow-2), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  overflow-x: clip;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 44px 44px;
  content: "";
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

.page-noise {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0.18;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 3px, var(--scanline) 4px);
  mix-blend-mode: overlay;
}

::selection {
  background: var(--orange);
  color: #fff;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--orange-soft);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.7rem 1rem;
  transform: translateY(-150%);
  border-radius: 0.25rem;
  background: var(--orange);
  color: var(--on-accent);
  font-family: var(--mono);
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 15;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 68px;
  padding: 0 2.2rem;
  border-bottom: 1px solid var(--header-border);
  background: var(--header-bg);
  box-shadow: 0 8px 30px rgb(0 0 0 / 15%);
  backdrop-filter: blur(18px);
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  width: max-content;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid var(--orange);
  border-radius: 7px;
  color: var(--orange-soft);
  font-size: 0.8rem;
}

.language-switcher {
  display: flex;
  gap: 0.2rem;
  padding: 0.22rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: var(--bg-deep);
}

.language-switcher button {
  min-width: 2.35rem;
  min-height: 2rem;
  padding: 0.3rem 0.55rem;
  border: 0;
  border-radius: 0.28rem;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  transition: 160ms ease;
}

.language-switcher button:hover {
  color: var(--text);
}

.language-switcher button.active {
  background: var(--orange);
  color: var(--on-accent);
  box-shadow: 0 3px 15px rgb(233 84 32 / 28%);
}

.header-download {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
  text-decoration: none;
  transition: color 150ms ease;
}

.header-download:hover {
  color: var(--orange-soft);
}

.shell-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  width: min(100%, var(--max));
  margin: 0 auto;
  padding-top: 68px;
}

.sidebar {
  position: sticky;
  top: 68px;
  align-self: start;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 68px);
  padding: 2.4rem 1.5rem 2rem;
  border-right: 1px solid var(--line);
}

.sidebar-status {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  color: var(--green);
  font-family: var(--mono);
  font-size: 0.68rem;
  line-height: 1.35;
}

.status-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgb(135 214 124 / 10%), 0 0 14px rgb(135 214 124 / 45%);
}

.side-nav {
  display: grid;
  gap: 0.38rem;
  margin-top: 3.5rem;
}

.side-nav a {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.75rem;
  align-items: center;
  padding: 0.68rem 0.75rem;
  border-left: 2px solid transparent;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.76rem;
  text-decoration: none;
  transition: 160ms ease;
}

.side-nav a span:first-child {
  color: #56505a;
  font-size: 0.63rem;
}

.side-nav a:hover,
.side-nav a.active {
  border-left-color: var(--orange);
  background: linear-gradient(90deg, rgb(233 84 32 / 10%), transparent);
  color: var(--text);
}

.side-nav a.active span:first-child {
  color: var(--orange-soft);
}

.sidebar-foot {
  margin-top: auto;
}

.sidebar-hint {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.55rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.66rem;
  text-align: left;
  transition: color 160ms ease;
}

.sidebar-hint:hover {
  color: var(--orange-soft);
}

.sidebar-hint:hover .key {
  border-color: var(--orange);
  color: var(--orange-soft);
}

.key {
  display: inline-grid;
  min-width: 1.6rem;
  min-height: 1.5rem;
  place-items: center;
  padding: 0 0.35rem;
  border: 1px solid var(--line-bright);
  border-bottom-width: 2px;
  border-radius: 0.25rem;
  background: var(--panel-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.64rem;
}

main {
  min-width: 0;
}

.section {
  position: relative;
  padding: clamp(5rem, 9vw, 8.5rem) clamp(2rem, 5.5vw, 6rem);
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 68px;
}

.hero {
  min-height: calc(100vh - 68px);
  padding-top: clamp(3.5rem, 6vw, 6rem);
  padding-bottom: 3rem;
}

.terminal-window {
  overflow: hidden;
  border: 1px solid var(--line-bright);
  border-radius: 0.55rem;
  background: var(--terminal-bg);
  box-shadow: var(--shadow);
}

.window-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 42px;
  padding: 0 0.9rem;
  border-bottom: 1px solid var(--line);
  background: var(--titlebar-bg);
  color: var(--titlebar-text);
  font-family: var(--sans);
  font-size: 0.69rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.window-controls {
  display: flex;
  gap: 0.52rem;
}

.window-controls span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 18%);
}

.window-controls .close { background: #e95420; }
.window-controls .minimize { background: #e3a52c; }
.window-controls .maximize { background: #67b650; }

.window-title {
  text-align: center;
}

.hero-content {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(230px, 0.62fr);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: center;
  min-height: min(650px, calc(100vh - 220px));
  padding: clamp(2rem, 5vw, 5rem);
}

.command-line {
  margin: 0 0 1.6rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: clamp(0.72rem, 1.2vw, 0.82rem);
}

.prompt {
  color: var(--green);
  font-weight: 700;
}

.eyebrow,
.section-index {
  margin: 0;
  color: var(--orange-soft);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 16ch;
  margin: 0.65rem 0 1.25rem;
  font-family: var(--mono);
  font-size: clamp(2.55rem, 5.2vw, 4.75rem);
  font-weight: 700;
  letter-spacing: -0.075em;
  line-height: 0.95;
}

h1 span {
  color: var(--orange-soft);
}

.hero-katakana {
  margin: -0.45rem 0 1.25rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: clamp(0.72rem, 1.15vw, 0.88rem);
  letter-spacing: 0.08em;
}

.hero-role {
  max-width: 60ch;
  margin: 0 0 1.2rem;
  color: var(--yellow);
  font-family: var(--mono);
  font-size: clamp(0.86rem, 1.4vw, 1.02rem);
  line-height: 1.55;
}

.hero-summary {
  max-width: 67ch;
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.92rem, 1.25vw, 1.04rem);
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2.2rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 44px;
  padding: 0.74rem 1rem;
  border: 1px solid transparent;
  border-radius: 0.25rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button.primary {
  background: var(--orange);
  color: var(--on-accent);
  box-shadow: 0 10px 26px rgb(233 84 32 / 20%);
}

.button.primary:hover {
  background: var(--orange-soft);
}

.button.secondary {
  border-color: var(--line-bright);
  background: var(--tint-strong);
  color: var(--text);
}

.button.secondary:hover {
  border-color: var(--orange);
  background: rgb(233 84 32 / 7%);
}

.button-prompt {
  color: var(--aubergine);
}

.profile-visual {
  width: min(100%, 330px);
  justify-self: end;
}

.photo-frame {
  position: relative;
  aspect-ratio: 5 / 6;
  padding: 8px;
  border: 1px solid var(--line-bright);
  background: #100d12;
}

.photo-frame::after {
  position: absolute;
  inset: 8px;
  background: linear-gradient(to top, rgb(44 0 30 / 36%), transparent 45%);
  content: "";
  pointer-events: none;
}

.photo-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.72) contrast(1.07);
}

.photo-scan {
  position: absolute;
  z-index: 2;
  top: 8px;
  right: 8px;
  left: 8px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--orange-soft), transparent);
  box-shadow: 0 0 12px var(--orange);
  opacity: 0.65;
  animation: scan 5.5s ease-in-out infinite;
}

@keyframes scan {
  0%, 100% { transform: translateY(0); opacity: 0; }
  10%, 85% { opacity: 0.6; }
  90% { transform: translateY(calc(min(23vw, 365px) - 20px)); opacity: 0; }
}

.corner {
  position: absolute;
  z-index: 3;
  width: 16px;
  height: 16px;
  border-color: var(--orange-soft);
  border-style: solid;
}

.top-left { top: 2px; left: 2px; border-width: 2px 0 0 2px; }
.top-right { top: 2px; right: 2px; border-width: 2px 2px 0 0; }
.bottom-left { bottom: 2px; left: 2px; border-width: 0 0 2px 2px; }
.bottom-right { right: 2px; bottom: 2px; border-width: 0 2px 2px 0; }

.photo-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 0.55rem;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.52rem;
  letter-spacing: 0.03em;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 1.4rem;
  border: 1px solid var(--line);
  background: var(--surface-solid);
}

.metrics > div {
  display: flex;
  align-items: baseline;
  gap: 0.72rem;
  padding: 1.15rem 1.25rem;
  border-right: 1px solid var(--line);
}

.metrics > div:last-child {
  border-right: 0;
}

.metrics strong {
  color: var(--orange-soft);
  font-family: var(--mono);
  font-size: 1.35rem;
  line-height: 1;
}

.metrics span {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.64rem;
  line-height: 1.2;
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(15rem, 0.7fr);
  gap: 2.5rem 5rem;
  margin-bottom: 3.4rem;
}

.section-heading .command-line {
  grid-column: 1 / -1;
  margin-bottom: -1rem;
}

.section-heading.compact {
  grid-template-columns: 1fr;
}

.section-heading h2,
.contact-content h2 {
  max-width: 16ch;
  margin: 0.75rem 0 0;
  font-size: clamp(2rem, 4.4vw, 4.2rem);
  letter-spacing: -0.055em;
  line-height: 1.03;
}

.section-heading.compact h2 {
  max-width: 20ch;
}

.section-intro {
  align-self: end;
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.8;
}

.expertise-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.expertise-card {
  min-height: 290px;
  padding: 1.8rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--tint);
  transition: background 180ms ease, transform 180ms ease;
}

.expertise-card:hover {
  background: linear-gradient(145deg, rgb(233 84 32 / 9%), var(--tint-strong));
  transform: translateY(-3px);
}

.expertise-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--aubergine-light);
  border-radius: 0.3rem;
  background: var(--aubergine);
  color: var(--orange-soft);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.expertise-card h3 {
  margin: 2.4rem 0 0.8rem;
  font-family: var(--mono);
  font-size: 1rem;
}

.expertise-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.75;
}

.stack-line {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.6rem;
  align-items: start;
  margin-top: 2rem;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
}

.stack-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.stack-tags span,
.tag {
  padding: 0.28rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.61rem;
  letter-spacing: 0;
}

.timeline {
  position: relative;
  display: grid;
}

.timeline::before {
  position: absolute;
  top: 0.55rem;
  bottom: 0.55rem;
  left: 8.9rem;
  width: 1px;
  background: var(--line-bright);
  content: "";
}

.timeline-entry {
  position: relative;
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 2rem;
  padding: 0 0 3rem;
}

.timeline-entry.hidden-entry {
  display: none;
}

.timeline-period {
  padding-top: 0.2rem;
  color: var(--orange-soft);
  font-family: var(--mono);
  font-size: 0.73rem;
  text-align: right;
}

.timeline-body {
  position: relative;
  padding-left: 1.3rem;
}

.timeline-body::before {
  position: absolute;
  top: 0.4rem;
  left: -1.32rem;
  width: 9px;
  height: 9px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 1px var(--orange), 0 0 14px rgb(233 84 32 / 32%);
  content: "";
}

.timeline-body h3 {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(1rem, 2vw, 1.3rem);
  line-height: 1.35;
}

.timeline-org {
  margin: 0.3rem 0 0;
  color: var(--yellow);
  font-size: 0.82rem;
}

.timeline-location {
  margin: 0.25rem 0 0;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.68rem;
}

.timeline-description {
  max-width: 78ch;
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.75;
}

.text-button {
  margin-left: 10rem;
  padding: 0;
  border: 0;
  border-bottom: 1px dashed var(--orange);
  background: transparent;
  color: var(--orange-soft);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.72rem;
}

.research-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(250px, 0.65fr);
  gap: 1.25rem;
  align-items: start;
}

.subsection-title {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.subsection-title h3 {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.85rem;
}

.subsection-title > span {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.58rem;
}

.publication-list {
  border: 1px solid var(--line);
}

.publication {
  display: grid;
  grid-template-columns: 4.2rem 1fr auto;
  gap: 1rem;
  align-items: start;
  min-height: 94px;
  padding: 1.15rem;
  border-bottom: 1px solid var(--line);
  transition: background 160ms ease;
}

.publication:last-child {
  border-bottom: 0;
}

.publication:hover {
  background: rgb(233 84 32 / 5%);
}

.publication-year {
  color: var(--orange-soft);
  font-family: var(--mono);
  font-size: 0.7rem;
}

.publication h4 {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.5;
}

.publication p {
  margin: 0.35rem 0 0;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.62rem;
  line-height: 1.5;
}

.publication a {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  text-decoration: none;
  transition: 150ms ease;
}

.publication a:hover {
  border-color: var(--orange);
  color: var(--orange-soft);
  transform: translate(2px, -2px);
}

.projects-panel,
.activity-panel {
  padding: 1.25rem;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, var(--panel-2), var(--tint));
}

.project {
  padding: 1.15rem 0;
  border-top: 1px solid var(--line);
}

.project:first-child {
  border-top: 0;
}

.project h4 {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  line-height: 1.55;
}

.project p {
  margin: 0.5rem 0 0;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.62rem;
}

.project-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--green);
  font-family: var(--mono);
  font-size: 0.58rem;
}

.project-status::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.activity-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-top: 3.5rem;
}

.log-entry {
  display: grid;
  grid-template-columns: 3.2rem 1fr;
  gap: 0.9rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
}

.log-entry time {
  color: var(--orange-soft);
  font-family: var(--mono);
  font-size: 0.65rem;
}

.log-entry h4 {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.5;
}

.log-entry p {
  margin: 0.25rem 0 0;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.59rem;
}

.education-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.education-card {
  position: relative;
  min-height: 300px;
  padding: 1.6rem;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
}

.education-card::before {
  position: absolute;
  top: 0;
  right: 0;
  width: 64px;
  height: 64px;
  border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: var(--aubergine);
  content: attr(data-level);
  color: var(--orange-soft);
  font-family: var(--mono);
  font-size: 0.7rem;
  display: grid;
  place-items: center;
}

.education-card time {
  color: var(--orange-soft);
  font-family: var(--mono);
  font-size: 0.68rem;
}

.education-card h3 {
  max-width: 14ch;
  margin: 2.5rem 0 0.8rem;
  font-family: var(--mono);
  font-size: 1.05rem;
  line-height: 1.4;
}

.education-card .school {
  margin: 0;
  color: var(--yellow);
  font-size: 0.78rem;
}

.education-card .thesis {
  margin: 1.5rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.6;
}

.credentials-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1.28fr);
  gap: 2rem;
  margin-top: 4rem;
}

.credential-list {
  border-top: 1px solid var(--line);
}

.credential {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.credential h4 {
  margin: 0;
  font-size: 0.78rem;
}

.credential p,
.credential time {
  margin: 0.35rem 0 0;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.6rem;
}

.course-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.course-chip {
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.25rem;
  background: var(--tint);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.62rem;
  line-height: 1.4;
}

.course-chip:hover {
  border-color: var(--aubergine-light);
  color: var(--text);
}

.contact-section {
  padding-top: 6rem;
  padding-bottom: 6rem;
}

.contact-terminal {
  background:
    radial-gradient(circle at 85% 50%, rgb(233 84 32 / 10%), transparent 32%),
    var(--contact-bg);
}

.contact-content {
  padding: clamp(2.5rem, 7vw, 6rem);
}

.contact-content h2 {
  max-width: 18ch;
}

.contact-content > p:not(.command-line, .section-index) {
  max-width: 66ch;
  margin: 1.5rem 0 0;
  color: var(--muted);
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-top: 2.5rem;
}

.email-link {
  color: var(--orange-soft);
  font-family: var(--mono);
  font-size: clamp(0.9rem, 2vw, 1.35rem);
  text-underline-offset: 0.35rem;
}

.copy-button {
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line-bright);
  border-radius: 0.25rem;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.64rem;
}

.copy-button:hover {
  border-color: var(--orange);
  color: var(--text);
}

.contact-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem 2rem;
  margin-top: 3.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.63rem;
}

.contact-meta > span {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: 1.5rem 2.2rem;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.6rem;
}

.site-footer p {
  margin: 0;
}

.site-footer .accent {
  color: var(--orange-soft);
}

.footer-katakana {
  color: var(--muted);
}

.site-footer button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
}

.command-palette {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: start center;
  padding: min(14vh, 8rem) 1rem 1rem;
}

.command-palette[hidden] {
  display: none;
}

.palette-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--backdrop);
  backdrop-filter: blur(7px);
}

.palette-dialog {
  position: relative;
  width: min(680px, 100%);
  overflow: hidden;
  border: 1px solid var(--line-bright);
  border-radius: 0.5rem;
  background: var(--dialog-bg);
  box-shadow: 0 30px 100px rgb(0 0 0 / 60%);
}

.palette-close {
  justify-self: end;
  padding: 0.22rem 0.4rem;
  border: 1px solid #57505a;
  border-radius: 0.2rem;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.58rem;
}

.palette-output {
  max-height: min(46vh, 420px);
  min-height: 120px;
  padding: 1.25rem 1.3rem 0.5rem;
  overflow-y: auto;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.palette-output p {
  margin: 0 0 0.6rem;
}

.palette-output strong,
.palette-output .output-command {
  color: var(--orange-soft);
}

.palette-form {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1.3rem 1.2rem;
}

.palette-form input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  caret-color: var(--orange-soft);
  font-family: var(--mono);
  font-size: 0.8rem;
}

.input-cursor {
  width: 7px;
  height: 1rem;
  background: var(--orange-soft);
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.palette-form:focus-within .input-cursor {
  display: none;
}

.palette-help {
  margin: 0;
  padding: 0.7rem 1.3rem;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.58rem;
}

.palette-help .key {
  min-width: auto;
  min-height: 1.2rem;
}

.noscript {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  z-index: 100;
  padding: 1rem;
  border: 1px solid var(--orange);
  background: var(--panel);
  color: var(--text);
  font-family: var(--mono);
  text-align: center;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 550ms ease, transform 550ms ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

html[lang="ja"] body {
  line-height: 1.75;
}

html[lang="ja"] h1,
html[lang="ja"] h2,
html[lang="ja"] h3 {
  letter-spacing: -0.035em;
}

/* ── scroll progress ───────────────────────────────────────────── */
.scroll-progress {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 18;
  height: 2px;
  background: linear-gradient(90deg, var(--orange), var(--orange-soft));
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
  will-change: transform;
}

/* ── header actions / theme toggle ─────────────────────────────── */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-self: end;
}

.header-actions .header-download {
  justify-self: auto;
}

.icon-button {
  display: grid;
  min-width: 2.15rem;
  min-height: 2.15rem;
  place-items: center;
  padding: 0 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: var(--bg-deep);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.72rem;
  transition: 160ms ease;
}

.icon-button:hover {
  border-color: var(--orange);
  color: var(--orange-soft);
}

/* ── mobile section nav ────────────────────────────────────────── */
.mobile-nav {
  display: none;
  position: sticky;
  top: 68px;
  z-index: 14;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--header-border);
  background: var(--header-bg);
  backdrop-filter: blur(18px);
  scrollbar-width: none;
}

.mobile-nav::-webkit-scrollbar {
  display: none;
}

.mobile-nav a {
  flex: 0 0 auto;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 0.3rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  text-decoration: none;
  white-space: nowrap;
}

.mobile-nav a.active {
  border-color: var(--orange);
  color: var(--orange-soft);
  background: var(--tint-strong);
}

/* ── sidebar scroll readout ────────────────────────────────────── */
.sidebar-progress {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
}

.sidebar-progress .bar {
  flex: 1;
  height: 3px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-deep);
}

.sidebar-progress .bar > span {
  display: block;
  height: 100%;
  background: var(--orange);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

/* ── grep filter for publications ──────────────────────────────── */
.grep-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  background: var(--bg-deep);
  transition: border-color 160ms ease;
}

.grep-field:focus-within {
  border-color: var(--orange);
}

.grep-field .prompt {
  flex: 0 0 auto;
  font-size: 0.72rem;
}

.grep-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.78rem;
  outline: none;
}

.grep-field input::placeholder {
  color: var(--dim);
}

.grep-field button {
  flex: 0 0 auto;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 0.25rem;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.65rem;
}

.grep-field button:hover {
  border-color: var(--orange);
  color: var(--orange-soft);
}

.grep-field button[hidden] {
  display: none;
}

.empty-result {
  padding: 1.1rem 0.2rem;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.78rem;
}

mark {
  padding: 0 0.12em;
  border-radius: 2px;
  background: rgb(233 84 32 / 26%);
  color: inherit;
}

/* ── publication cite button ───────────────────────────────────── */
.publication-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.cite-button {
  padding: 0.2rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 0.25rem;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  transition: 160ms ease;
}

.cite-button:hover {
  border-color: var(--orange);
  color: var(--orange-soft);
}

.cite-button.done {
  border-color: var(--green);
  color: var(--green);
}

/* ── boot sequence ─────────────────────────────────────────────── */
.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  align-content: start;
  gap: 0.15rem;
  padding: clamp(1.2rem, 6vw, 4rem);
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--muted);
  font-family: var(--mono);
  font-size: clamp(0.68rem, 1.6vw, 0.82rem);
  line-height: 1.7;
  transition: opacity 420ms ease;
}

.boot-screen[hidden] {
  display: none;
}

.boot-screen.dismissing {
  opacity: 0;
  pointer-events: none;
}

.boot-screen p {
  margin: 0;
}

.boot-screen .ok {
  color: var(--green);
}

.boot-screen .warn {
  color: var(--yellow);
}

.boot-screen .accent {
  color: var(--orange-soft);
}

/* Con el log completo, una ventana apaisada y baja recortaría las últimas
   líneas: se comprime la tipografía en vez de perderlas. */
@media (max-height: 520px) {
  .boot-screen {
    padding-block: 1rem;
    font-size: 0.62rem;
    line-height: 1.45;
  }

  .boot-skip {
    bottom: 0.8rem;
    right: 0.8rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.62rem;
  }
}

.boot-skip {
  position: fixed;
  right: clamp(1.2rem, 6vw, 4rem);
  bottom: clamp(1.2rem, 6vw, 4rem);
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--line-bright);
  border-radius: 0.3rem;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.7rem;
}

.boot-skip:hover {
  border-color: var(--orange);
  color: var(--orange-soft);
}

/* ── typewriter caret ──────────────────────────────────────────── */
.type-caret {
  display: inline-block;
  width: 0.6ch;
  margin-left: 0.15ch;
  background: var(--orange);
  color: transparent;
  animation: blink 1s steps(1) infinite;
}

.type-caret.done {
  display: none;
}

/* ── palette upgrades ──────────────────────────────────────────── */
.palette-form .prompt {
  flex: 0 0 auto;
  white-space: nowrap;
}

.palette-input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.palette-ghost {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.8rem;
  pointer-events: none;
  white-space: pre;
  overflow: hidden;
}

.palette-ghost span {
  color: transparent;
}

.palette-output .cmd-list pre {
  margin: 0;
}

.palette-output .out-ok { color: var(--green); }
.palette-output .out-err { color: var(--orange-soft); }
.palette-output .out-dim { color: var(--dim); }
.palette-output .out-key { color: var(--blue); }

.palette-output pre {
  margin: 0.2rem 0 0.6rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  font-size: 0.76rem;
  line-height: 1.6;
  color: var(--muted);
}

.palette-output a {
  color: var(--blue);
}

.shortcut-table {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.9rem;
  margin: 0.3rem 0 0.7rem;
  font-size: 0.76rem;
}

.shortcut-table dt {
  color: var(--blue);
}

.shortcut-table dd {
  margin: 0;
  color: var(--muted);
}

/* ── live region ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  z-index: 120;
  padding: 0.6rem 0.95rem;
  border: 1px solid var(--green);
  border-radius: 0.3rem;
  background: var(--panel);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.74rem;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1050px) {
  .shell-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .mobile-nav {
    display: flex;
  }

  .hero-content {
    gap: 2.5rem;
  }

  .section {
    padding-inline: clamp(1.5rem, 5vw, 4rem);
    scroll-margin-top: 116px;
  }

  .research-layout {
    grid-template-columns: 1fr;
  }

  .projects-panel {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 1.5rem;
  }

  .projects-panel > .subsection-title {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .palette-form {
    flex-wrap: wrap;
    row-gap: 0.3rem;
  }

  .palette-form .prompt {
    flex: 1 0 100%;
    font-size: 0.74rem;
  }
}

@media (max-width: 760px) {
  .site-header {
    grid-template-columns: auto 1fr auto;
    min-height: 62px;
    padding: 0 1rem;
  }

  .site-brand > span:last-child,
  .header-download {
    display: none;
  }

  .icon-button {
    min-width: 1.95rem;
    min-height: 1.95rem;
    padding: 0 0.35rem;
  }

  .header-actions {
    gap: 0.3rem;
  }

  .language-switcher {
    justify-self: end;
  }

  .language-switcher button {
    min-width: 2rem;
    min-height: 1.85rem;
    padding: 0.25rem 0.4rem;
    font-size: 0.64rem;
  }

  .shell-layout {
    padding-top: 62px;
  }

  .mobile-nav {
    top: 62px;
    padding: 0.45rem 0.75rem;
  }

  .section {
    scroll-margin-top: 108px;
  }

  .toast {
    right: 0.75rem;
    left: 0.75rem;
    bottom: 0.75rem;
    text-align: center;
  }

  .section {
    padding: 4.5rem 1rem;
    scroll-margin-top: 62px;
  }

  .hero {
    padding-top: 1rem;
  }

  .window-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hero-content {
    grid-template-columns: 1fr;
    padding: 1.5rem;
  }

  .profile-visual {
    grid-row: 1;
    width: min(64vw, 245px);
    justify-self: start;
  }

  .photo-meta {
    display: none;
  }

  h1 {
    font-size: clamp(2.4rem, 13vw, 4rem);
  }

  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .metrics > div:nth-child(2) {
    border-right: 0;
  }

  .metrics > div:nth-child(-n+2) {
    border-bottom: 1px solid var(--line);
  }

  .section-heading {
    grid-template-columns: 1fr;
    gap: 1.4rem;
  }

  .expertise-grid,
  .education-grid,
  .activity-grid,
  .credentials-layout {
    grid-template-columns: 1fr;
  }

  .expertise-card {
    min-height: 0;
  }

  .stack-line {
    grid-template-columns: 1fr;
  }

  .timeline::before {
    left: 0.3rem;
  }

  .timeline-entry {
    grid-template-columns: 1fr;
    gap: 0.65rem;
    padding-left: 1.6rem;
  }

  .timeline-period {
    text-align: left;
  }

  .timeline-body {
    padding-left: 0;
  }

  .timeline-body::before {
    top: -1.95rem;
    left: -1.62rem;
  }

  .text-button {
    margin-left: 1.6rem;
  }

  .projects-panel {
    display: block;
  }

  .publication {
    grid-template-columns: 3.2rem 1fr auto;
    gap: 0.65rem;
    padding: 0.85rem;
  }

  .activity-grid {
    margin-top: 2.5rem;
  }

  .credentials-layout {
    margin-top: 3rem;
  }

  .contact-content {
    padding: 2.2rem 1.5rem;
  }

  .contact-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-footer {
    flex-direction: column;
    padding: 1.3rem 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  .type-caret {
    display: none;
  }
}

@media print {
  .skip-link,
  .site-header,
  .sidebar,
  .mobile-nav,
  .scroll-progress,
  .boot-screen,
  .toast,
  .grep-field,
  .cite-button,
  .page-noise,
  .command-palette,
  .hero-actions,
  .text-button,
  .copy-button,
  .site-footer button {
    display: none !important;
  }

  :root,
  html[data-theme] {
    color-scheme: light;
    --bg: white;
    --bg-deep: white;
    --panel: white;
    --panel-2: #f3f3f3;
    --aubergine: #f3f3f3;
    --aubergine-light: #ccc;
    --orange: #a33208;
    --orange-soft: #7d2606;
    --green: #1f6b22;
    --text: #111;
    --muted: #444;
    --dim: #666;
    --line: #ccc;
    --line-bright: #999;
    --tint: transparent;
    --tint-strong: transparent;
    --grid-line: transparent;
    --scanline: transparent;
    --glow-1: transparent;
    --glow-2: transparent;
    --shadow: none;
    --terminal-bg: white;
    --contact-bg: white;
    --surface-solid: white;
    --titlebar-bg: #f3f3f3;
    --titlebar-text: #111;
    --dialog-bg: white;
  }

  body {
    background: white;
    color: #111;
  }

  .shell-layout {
    display: block;
    padding: 0;
  }

  .section {
    padding: 1.6rem 0;
    break-inside: auto;
  }

  /* Keep individual cards whole instead of whole sections, which never fit. */
  .metrics,
  .expertise-card,
  .education-card,
  .timeline-entry,
  .publication,
  .credential,
  .log-entry,
  .project {
    break-inside: avoid;
  }

  .section-heading,
  .subsection-title {
    break-after: avoid;
  }

  .expertise-card,
  .education-card {
    min-height: 0;
    padding: 1rem;
  }

  .hero,
  .hero-content {
    min-height: auto;
  }

  .hero-content {
    padding: 1.5rem;
  }

  .terminal-window,
  .expertise-card,
  .education-card,
  .projects-panel,
  .activity-panel {
    background: white;
    box-shadow: none;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
