/* ============================================================
   OSAKA JADE — developer portfolio design system
   deep charcoal · jade accent · monospace · japanese restraint
   ============================================================ */

:root {
  /* palette */
  --bg: #0c110f;
  --surface: #101613;
  --surface-2: #141b17;
  --surface-3: #18211c;
  --border: #232e28;
  --border-strong: #31413a;

  --jade: #43bd8d;
  --jade-bright: #63d9a8;
  --jade-deep: #1d4d3b;
  --jade-dim: #2b6b52;
  --jade-line: #1d4d3b;

  --text: #e7ede9;
  --text-muted: #8fa399;
  --text-faint: #64736a;

  /* theme-dependent surfaces */
  --header-bg: rgba(12, 17, 15, 0.88);
  --grid-opacity: 0.14;
  --on-jade: #07130d;
  --glow: rgba(67, 189, 141, 0.15);
  --glow-faint: rgba(67, 189, 141, 0.04);

  /* typography */
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, "IBM Plex Sans Arabic", monospace;
  --font-ar: "IBM Plex Sans Arabic", "Noto Naskh Arabic", "Segoe UI", Tahoma, sans-serif;
  --fs-xs: 0.75rem;
  --fs-sm: 0.85rem;
  --fs-base: 0.95rem;
  --fs-md: 1.1rem;
  --fs-lg: 1.4rem;
  --fs-xl: clamp(2.2rem, 6vw, 4.2rem);
  --fs-h2: clamp(1.7rem, 4vw, 2.6rem);

  /* layout */
  --container: 1140px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --section-pad: clamp(4.5rem, 10vw, 8rem);

  /* motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --speed: 160ms;

  /* directional */
  --term-shadow-x: 18px;
}

/* ---------- light theme (osaka jade on paper) ---------- */
[data-theme="light"] {
  --bg: #f4f7f4;
  --surface: #edf2ee;
  --surface-2: #ffffff;
  --surface-3: #e7ede8;
  --border: #d8e0da;
  --border-strong: #bcc8c0;

  --jade: #1a7150;
  --jade-bright: #125c3f;
  --jade-deep: #cfe6da;
  --jade-dim: #3d8f6d;
  --jade-line: #a8cfbc;

  --text: #17221c;
  --text-muted: #4f6157;
  --text-faint: #6b7a71;

  --header-bg: rgba(244, 247, 244, 0.9);
  --grid-opacity: 0.3;
  --on-jade: #f4f7f4;
  --glow: rgba(26, 113, 80, 0.22);
  --glow-faint: rgba(26, 113, 80, 0.07);
}

/* ---------- arabic / RTL ---------- */
html[lang="ar"] {
  --fs-xs: 0.78rem;
  --fs-sm: 0.9rem;
  --fs-base: 1rem;
  --fs-md: 1.15rem;
  --fs-lg: 1.5rem;
}
html[lang="ar"] body {
  font-family: var(--font-ar);
  line-height: 1.9;
}
[dir="rtl"] { --term-shadow-x: -18px; }
[dir="rtl"] * { letter-spacing: 0 !important; }
[dir="rtl"] .nav-link::before { transform: translate(14px, -50%); }
[dir="rtl"] .nav-link.active::before { transform: translate(12px, -50%); }
[dir="rtl"] .meta-card:hover { transform: translateX(-3px); }
[dir="rtl"] .timeline-marker { transform: translateX(-4px); }
[dir="rtl"] .btn-arrow, [dir="rtl"] .ext-arrow, [dir="rtl"] .project-modal-arrow { transform: scaleX(-1); display: inline-block; }
[dir="rtl"] .contact-list li::before { content: "‹"; }

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--fs-base);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.35s var(--ease), color 0.35s var(--ease);
}

/* subtle background grid — terminal graph paper, very low contrast */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 72px 72px;
  opacity: var(--grid-opacity);
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, black 20%, transparent 75%);
  pointer-events: none;
  z-index: 0;
}

::selection { background: var(--jade-deep); color: var(--jade-bright); }

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
img, svg { display: block; max-width: 100%; }

strong { color: var(--text); font-weight: 700; }
em { color: var(--jade-bright); font-style: italic; }
code { color: var(--jade-bright); font-family: var(--font-mono); font-size: 0.9em; }

:focus-visible {
  outline: 2px solid var(--jade);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: -100px;
  inset-inline-start: 1rem;
  z-index: 100;
  background: var(--jade);
  color: var(--bg);
  padding: 0.6rem 1rem;
  font-weight: 700;
  transition: top var(--speed) var(--ease);
}
.skip-link:focus { top: 1rem; }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
  position: relative;
  z-index: 1;
}

.accent { color: var(--jade); }
.accent-period { color: var(--jade-bright); }

/* ---------- status dot ---------- */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--jade);
  box-shadow: 0 0 0 3px var(--glow);
  animation: pulse 2.6s var(--ease) infinite;
  flex-shrink: 0;
}
.status-dot.dim { background: var(--jade-dim); box-shadow: none; animation: none; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--glow); }
  50% { box-shadow: 0 0 0 6px var(--glow-faint); }
}

/* ---------- header / nav ---------- */
.site-header {
  position: fixed;
  top: 0;
  inset-inline: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  transition: border-color var(--speed) var(--ease), background-color 0.35s var(--ease);
}
.site-header.scrolled { border-bottom-color: var(--border-strong); }

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-logo {
  font-weight: 700;
  font-size: var(--fs-md);
  letter-spacing: -0.02em;
  transition: color var(--speed);
}
.nav-logo:hover { color: var(--jade-bright); }
.nav-logo-prompt { color: var(--jade); }
.nav-logo-cursor {
  color: var(--jade);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.nav-link {
  position: relative;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  padding: 0.35rem 0.15rem;
  transition: color var(--speed);
}
.nav-link:hover { color: var(--text); }
.nav-link::before {
  content: "";
  position: absolute;
  inset-inline-start: 0.15rem;
  top: 50%;
  width: 6px;
  height: 6px;
  background: var(--jade);
  transform: translate(-14px, -50%);
  opacity: 0;
  transition: transform var(--speed) var(--ease), opacity var(--speed);
}
.nav-link.active { color: var(--jade-bright); }
.nav-link.active::before {
  transform: translate(-12px, -50%);
  opacity: 1;
}

.nav-status { display: flex; align-items: center; }
.nav-status .status-dot { width: 7px; height: 7px; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 1px solid var(--border-strong);
  padding: 0.6rem 0.55rem;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  transition: transform var(--speed) var(--ease), opacity var(--speed);
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.lang-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 0.55rem;
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: color var(--speed), border-color var(--speed);
}
.lang-toggle:hover {
  color: var(--jade-bright);
  border-color: var(--jade);
}
.lang-icon { display: inline-flex; }
.lang-icon-ar { font-family: var(--font-ar); font-size: 0.95rem; font-weight: 500; }
html[lang="ar"] .lang-icon-ar { display: none; }
html:not([lang="ar"]) .lang-icon-en { display: none; }

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  transition: color var(--speed), border-color var(--speed);
}
.theme-toggle:hover {
  color: var(--jade-bright);
  border-color: var(--jade);
}

.theme-icon { display: inline-flex; }
[data-theme="light"] .theme-icon-moon { display: none; }
html:not([data-theme="light"]) .theme-icon-sun { display: none; }

/* ---------- sections ---------- */
.section {
  padding-block: var(--section-pad);
  border-bottom: 1px solid var(--border);
  position: relative;
  scroll-margin-top: 64px;
}
.section-alt {
  background: var(--surface);
  transition: background-color 0.35s var(--ease);
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2rem 3rem;
  margin-bottom: clamp(2.5rem, 6vw, 4.5rem);
  align-items: start;
}

.section-index {
  grid-column: 1 / -1;
  font-size: var(--fs-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.section-slash { color: var(--jade-dim); }
.section-kanji {
  color: var(--jade);
  font-size: 0.95rem;
  opacity: 0.7;
  margin-inline-start: auto;
}

.section-title {
  font-size: var(--fs-h2);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

/* ---------- hero ---------- */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 7.5rem;
  padding-bottom: 4rem;
  border-bottom: 1px solid var(--border);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: center;
}

.eyebrow {
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  text-transform: lowercase;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.eyebrow-dot { color: var(--jade); font-size: 0.6rem; }

.hero-title {
  font-size: var(--fs-xl);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.02;
  margin-bottom: 1.5rem;
}

.hero-sub {
  color: var(--text-muted);
  max-width: 36rem;
  font-size: var(--fs-base);
  margin-bottom: 1.75rem;
}

.hero-status {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: var(--fs-sm);
  margin-bottom: 2.25rem;
}
.mono-line {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.mono-line .status-dot { width: 7px; height: 7px; }
.mono-line.secondary {
  color: var(--text-faint);
  padding-inline-start: 1.1rem;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.72rem 1.4rem;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--speed), color var(--speed), border-color var(--speed), transform var(--speed) var(--ease);
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--jade);
  color: var(--on-jade);
}
.btn-primary:hover {
  background: var(--jade-bright);
  border-color: var(--jade-bright);
}

.btn-ghost {
  color: var(--text);
  border-color: var(--border-strong);
  background: transparent;
}
.btn-ghost:hover {
  border-color: var(--jade);
  color: var(--jade-bright);
}

/* ---------- terminal window ---------- */
.hero-terminal {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  font-size: var(--fs-sm);
  box-shadow: var(--term-shadow-x) 18px 0 -14px var(--jade-deep), -1px -1px 0 var(--border);
  transition: transform var(--speed) var(--ease), border-color var(--speed), background-color 0.35s var(--ease);
}
.hero-terminal:hover {
  transform: translateY(-3px);
  border-color: var(--jade-dim);
}

.term-bar {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.55rem 0.9rem;
  background: var(--surface-3);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--text-faint);
  transition: background-color 0.35s var(--ease);
}
.term-dots { display: flex; gap: 5px; }
.term-dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--border-strong);
}
.term-dots i:first-child { background: var(--jade-dim); }
.term-title { margin-inline-end: auto; }
.term-kanji { color: var(--jade); opacity: 0.6; }

.term-body {
  padding: 1.1rem 1.1rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  overflow: hidden;
}
.term-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term-prompt { color: var(--jade); }
.term-out { color: var(--text-muted); padding-inline-start: 1.1rem; }
.term-cursor {
  color: var(--jade);
  animation: blink 1.1s steps(1) infinite;
}

/* ---------- about ---------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr);
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: start;
}

.about-copy p {
  color: var(--text-muted);
  margin-bottom: 1.2rem;
  max-width: 42rem;
}
.about-copy strong { color: var(--text); }
.about-closing { color: var(--text); }

.about-meta {
  display: grid;
  gap: 0.9rem;
}

.meta-card {
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 0.9rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: border-color var(--speed), transform var(--speed) var(--ease), background-color 0.35s var(--ease);
}
.meta-card:hover {
  border-color: var(--jade-dim);
  transform: translateX(3px);
}
.meta-key {
  font-size: var(--fs-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.meta-val { font-size: var(--fs-sm); font-weight: 500; text-align: end; }

/* ---------- skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
}

.skill-card {
  grid-column: span 4;
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 1.4rem 1.4rem 1.5rem;
  transition: border-color var(--speed), transform var(--speed) var(--ease), background-color 0.35s var(--ease);
}
.skill-card:hover {
  border-color: var(--jade-dim);
  transform: translateY(-3px);
  background: var(--surface-2);
}
.skill-card:nth-child(4), .skill-card:nth-child(5) { grid-column: span 6; }

.skill-title {
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.1rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border);
}
.skill-tag {
  margin-inline-start: auto;
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--jade);
  border: 1px solid var(--jade-line);
  padding: 0.15rem 0.5rem;
  border-radius: 2px;
}

.skill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.skill-list li {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.32rem 0.7rem;
  border-radius: 2px;
  transition: color var(--speed), border-color var(--speed), background var(--speed);
}
.skill-list li:hover {
  color: var(--jade-bright);
  border-color: var(--jade-dim);
  background: var(--jade-deep);
}

/* ---------- projects (bento) ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
}

.project-card {
  grid-column: span 2;
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 1.5rem 1.5rem 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  position: relative;
  transition: border-color var(--speed), transform var(--speed) var(--ease), background-color 0.35s var(--ease);
}
.project-card:hover {
  border-color: var(--jade);
  transform: translateY(-4px);
  background: var(--surface-3);
}

.project-featured { grid-column: span 4; }
.project-featured .project-title { font-size: var(--fs-lg); }
.project-featured .project-desc { font-size: var(--fs-base); max-width: 36rem; }

.project-wip {
  border-style: dashed;
  background: transparent;
}
.project-wip:hover { border-color: var(--jade-dim); background: var(--surface-2); }

.project-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.project-index {
  font-size: var(--fs-xs);
  color: var(--jade);
  letter-spacing: 0.1em;
  border: 1px solid var(--jade-line);
  padding: 0.2rem 0.5rem;
  border-radius: 2px;
}
.project-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.project-title {
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-top: 0.4rem;
}

.project-stack {
  font-size: var(--fs-xs);
  color: var(--jade);
  letter-spacing: 0.04em;
}

.project-desc {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  flex-grow: 1;
}

.project-links {
  display: flex;
  gap: 1.1rem;
  margin-top: 0.4rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}
.project-links a {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  transition: color var(--speed);
}
.project-links a:hover { color: var(--jade-bright); }
.project-soon { font-size: var(--fs-xs); color: var(--text-faint); }

.project-card { cursor: pointer; }

/* ---------- project modal ---------- */
.project-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--ease), visibility 0.25s;
}
.project-modal.open { opacity: 1; visibility: visible; }

.project-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(7, 11, 9, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.project-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.6);
  transform: translateY(18px) scale(0.98);
  transition: transform 0.25s var(--ease);
}
.project-modal.open .project-modal-dialog { transform: none; }

.project-modal-close {
  position: absolute;
  top: 0.8rem;
  inset-inline-end: 0.8rem;
  z-index: 2;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: color var(--speed), border-color var(--speed);
}
.project-modal-close:hover { color: var(--jade-bright); border-color: var(--jade); }

.project-modal-media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface-3);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.project-modal-image { width: 100%; height: 100%; object-fit: cover; }

.project-modal-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-align: center;
  padding: 1rem;
}
.project-modal-ph-icon { color: var(--jade-dim); font-size: 2rem; }
.project-modal-ph-label {
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.project-modal-ph-hint { font-size: var(--fs-xs); color: var(--text-faint); }

.project-modal-body {
  padding: 1.5rem 1.6rem 1.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.project-modal-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.project-modal-title {
  font-size: var(--fs-lg);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.project-modal-stack {
  font-size: var(--fs-xs);
  color: var(--jade);
  letter-spacing: 0.04em;
}

.project-modal-desc {
  font-size: var(--fs-base);
  color: var(--text-muted);
}

.project-modal-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  align-self: flex-start;
  margin-top: 1.1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--jade);
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-color: var(--jade-line);
  text-decoration-thickness: 1px;
  transition: color var(--speed);
}
.project-modal-link:hover { color: var(--jade-bright); }
.project-modal-arrow { display: inline-block; transition: transform var(--speed) var(--ease); }
.project-modal-link:hover .project-modal-arrow { transform: translateX(3px); }
[dir="rtl"] .project-modal-link:hover .project-modal-arrow { transform: translateX(-3px) scaleX(-1); }

.project-modal-image[hidden],
.project-modal-placeholder[hidden],
.project-modal-link[hidden] { display: none; }

/* ---------- timeline ---------- */
.timeline {
  position: relative;
  max-width: 46rem;
  padding-inline-start: 2rem;
}
.timeline::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0.4rem;
  bottom: 0.4rem;
  width: 1px;
  background: var(--border-strong);
}

.timeline-item {
  position: relative;
  padding-bottom: 2.6rem;
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 1.5rem;
}
.timeline-item:last-child { padding-bottom: 0; }

.timeline-marker {
  position: absolute;
  inset-inline-start: -2rem;
  top: 0.55rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--jade-dim);
  transform: translateX(4px);
  transition: border-color var(--speed), background var(--speed);
}
.timeline-item:hover .timeline-marker {
  background: var(--jade);
  border-color: var(--jade);
}

.timeline-current .timeline-marker {
  border-color: var(--jade);
  animation: pulse 2.6s var(--ease) infinite;
}
.timeline-current .timeline-marker::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px solid var(--jade);
  animation: ripple 2.6s var(--ease) infinite;
}
@keyframes ripple {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(2.4); opacity: 0; }
}

.timeline-year {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  letter-spacing: 0.1em;
  padding-top: 0.3rem;
}
.timeline-year.accent { color: var(--jade-bright); font-weight: 700; }

.timeline-body h3 {
  font-size: var(--fs-md);
  font-weight: 700;
  margin-bottom: 0.35rem;
}
.timeline-body p { color: var(--text-muted); font-size: var(--fs-sm); max-width: 34rem; }

/* ---------- philosophy ---------- */
.philosophy {
  background: var(--surface);
  transition: background-color 0.35s var(--ease);
}

.philosophy-quote {
  max-width: 52rem;
  margin-inline: auto;
  text-align: center;
  position: relative;
}
.philosophy-glyph {
  font-size: 2.8rem;
  color: var(--jade);
  opacity: 0.35;
  line-height: 1;
  margin-bottom: 1.2rem;
}
.philosophy-text {
  font-size: clamp(1.5rem, 4vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: 1.6rem;
}
.philosophy-note {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  max-width: 40rem;
  margin-inline: auto;
}

/* ---------- contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr);
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: start;
}

.contact-terminal {
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  font-size: var(--fs-sm);
  transition: background-color 0.35s var(--ease), border-color 0.35s var(--ease);
}

.contact-links { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.3rem; }
.contact-links a {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid transparent;
  transition: background var(--speed), border-color var(--speed);
}
.contact-links a:hover {
  background: var(--surface-3);
  border-color: var(--jade-dim);
}
.contact-key {
  font-size: var(--fs-xs);
  color: var(--jade);
  min-width: 2.2rem;
}
.contact-val {
  margin-inline-start: auto;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  transition: color var(--speed);
}
.contact-links a:hover .contact-val { color: var(--jade-bright); }

.contact-heading {
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 1rem;
}
.contact-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-bottom: 1.8rem;
}
.contact-list li {
  color: var(--text-muted);
  padding-inline-start: 1.2rem;
  position: relative;
}
.contact-list li::before {
  content: "›";
  position: absolute;
  inset-inline-start: 0;
  color: var(--jade);
}
.contact-response {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  border-top: 1px solid var(--border);
  padding-top: 1.2rem;
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 2rem;
}
.footer-inner {
  display: flex;
  align-items: center;
  gap: 1rem 2rem;
  flex-wrap: wrap;
  font-size: var(--fs-xs);
  color: var(--text-faint);
}
.footer-note { margin-inline-end: auto; }
.footer-kanji { color: var(--jade); opacity: 0.5; }

/* ---------- scroll hint ---------- */
.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  color: var(--text-faint);
  font-size: 0.9rem;
  animation: float 2.4s var(--ease) infinite;
  z-index: 1;
}
.scroll-hint:hover { color: var(--jade); }
@keyframes float {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 6px); }
}

/* ---------- reveal animations ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s var(--ease), transform 0.55s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}
[data-reveal].revealed {
  opacity: 1;
  transform: none;
}

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-terminal { max-width: 34rem; }
  .about-grid, .contact-grid { grid-template-columns: 1fr; }
  .about-meta { grid-template-columns: 1fr 1fr; }
  .skill-card { grid-column: span 6; }
  .project-featured { grid-column: span 6; }
  .project-card { grid-column: span 3; }
}

@media (max-width: 720px) {
  .nav-links {
    position: fixed;
    inset: 64px 0 auto 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border-strong);
    padding: 0.8rem var(--gutter) 1.2rem;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--speed) var(--ease), transform var(--speed) var(--ease);
  }
  .nav-links.open {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
  .nav-links li { width: 100%; }
  .nav-link {
    display: block;
    padding: 0.8rem 0.2rem;
    border-bottom: 1px solid var(--border);
    font-size: var(--fs-base);
  }
  .nav-link::before { display: none; }
  .nav-link.active::before { display: inline-block; position: static; margin-inline-end: 0.6rem; transform: none; }
  .nav-status { display: none; }
  .nav-toggle { display: flex; }

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

  .skill-card, .skill-card:nth-child(4), .skill-card:nth-child(5) { grid-column: span 12; }
  .project-card, .project-featured { grid-column: span 6; }

  .about-meta { grid-template-columns: 1fr; }
  .meta-card { flex-direction: row; }
  .meta-val { text-align: end; }

  .timeline-item { grid-template-columns: 1fr; gap: 0.2rem; }
  .timeline-year { padding-top: 0; }
  .timeline { padding-inline-start: 1.6rem; }
  .timeline-marker { inset-inline-start: -1.6rem; }

  .hero { padding-top: 6.5rem; }
  .hero-actions .btn { flex: 1 1 auto; justify-content: center; }
  .term-line { white-space: normal; overflow-wrap: break-word; }

  .project-modal { padding: 0.75rem; }
  .project-modal-body { padding: 1.2rem 1.2rem 1.5rem; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
  .term-cursor, .nav-logo-cursor { animation: none; }
}
