/* ============================================================
   Nakazawa Shun — Portfolio
   Theme: light / clean / professional (新卒就活向け)
   ============================================================ */
:root {
  --bg: #f6f8fb;
  --bg-2: #eef2f8;
  --surface: #ffffff;
  --border: #e4e9f1;
  --border-2: #d4dceb;
  --text: #1f2a3a;
  --heading: #111827;
  --text-dim: #56627a;
  --text-mute: #8893a7;
  --accent: #2f6bed;
  --accent-dark: #1f54c9;
  --accent-soft: #eaf0fe;
  --accent-2: #0ea5a4;
  --radius: 14px;
  --radius-sm: 10px;
  --maxw: 1100px;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: "Inter", "Noto Sans JP", system-ui, -apple-system, "Segoe UI", sans-serif;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow: 0 10px 30px -12px rgba(31, 42, 58, 0.18);
  --shadow-lg: 0 24px 48px -20px rgba(31, 42, 58, 0.25);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(246, 248, 251, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.site-header.scrolled { border-bottom-color: var(--border); box-shadow: var(--shadow-sm); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 66px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--heading); }
.brand-mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: var(--accent); color: #fff; font-weight: 800;
}
.brand-text { font-size: 0.95rem; letter-spacing: 0.01em; }

.nav-list { list-style: none; display: flex; align-items: center; gap: 4px; margin: 0; padding: 0; }
.nav-list a {
  display: block; padding: 8px 13px; border-radius: 9px;
  font-size: 0.88rem; font-weight: 500; color: var(--text-dim);
  transition: color 0.2s, background 0.2s;
}
.nav-list a:hover { color: var(--heading); background: var(--bg-2); }
.nav-list a.active { color: var(--accent); }
.nav-cta { color: #fff !important; background: var(--accent); font-weight: 700; }
.nav-cta:hover { background: var(--accent-dark) !important; }
.nav-toggle { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 24px; border-radius: 11px; font-weight: 700; font-size: 0.95rem;
  border: 1px solid transparent; cursor: pointer; transition: 0.2s;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 8px 20px -8px rgba(47, 107, 237, 0.6); }
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-2px); }
.btn-ghost { background: var(--surface); border-color: var(--border-2); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 96px 0 88px; overflow: hidden; }
.hero-bg {
  position: absolute; inset: 0; z-index: 0;
  background: radial-gradient(60% 55% at 92% -5%, rgba(47, 107, 237, 0.06), transparent 72%);
}
.hero-inner {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 52px; align-items: center;
}
.hero-kicker {
  display: flex; align-items: center; gap: 11px; font-family: var(--sans); font-weight: 700;
  color: var(--accent); letter-spacing: 0.16em; text-transform: uppercase; font-size: 0.74rem; margin: 0 0 20px;
}
.hero-kicker::before { content: ""; width: 26px; height: 2px; background: var(--accent); }
.hero-title { font-size: clamp(2rem, 5.2vw, 3.4rem); line-height: 1.28; font-weight: 800; letter-spacing: -0.01em; color: var(--heading); margin: 0 0 22px; }
.hero-title .accent { color: var(--accent); }
.hero-lead { color: var(--text-dim); font-size: 1.02rem; margin: 0 0 28px; }
.hero-lead strong { color: var(--heading); font-weight: 700; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

.hero-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px 28px; box-shadow: var(--shadow); text-align: center;
}
.hero-avatar {
  width: 84px; height: 84px; margin: 0 auto 16px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.6rem; font-weight: 800; color: #fff;
  background: var(--accent);
}
.hero-name { margin: 0 0 4px; font-size: 1.4rem; color: var(--heading); font-weight: 800; }
.hero-name span { display: block; font-size: 0.78rem; font-weight: 500; color: var(--text-mute); letter-spacing: 0.06em; margin-top: 2px; }
.hero-role { margin: 0 0 20px; font-size: 0.85rem; color: var(--accent); font-weight: 600; }
.hero-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; text-align: left; }
.hero-facts li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 0; border-top: 1px solid var(--border); font-size: 0.85rem;
}
.hero-facts li span { color: var(--text-mute); font-size: 0.78rem; white-space: nowrap; }
.hero-facts li b { color: var(--text); font-weight: 600; text-align: right; }

/* ---------- Sections ---------- */
.section { padding: 96px 0; }
.section-alt { background: var(--bg-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-kicker {
  display: flex; align-items: center; gap: 10px; font-family: var(--sans); font-weight: 700;
  color: var(--accent); letter-spacing: 0.15em; text-transform: uppercase; font-size: 0.72rem; margin: 0 0 12px;
}
.section-kicker::before { content: ""; width: 24px; height: 2px; background: var(--accent); border-radius: 2px; }
.section-title { font-size: clamp(1.65rem, 3.4vw, 2.3rem); font-weight: 800; letter-spacing: -0.01em; color: var(--heading); margin: 0 0 14px; position: relative; }
.section-desc { color: var(--text-dim); max-width: 720px; margin: 0 0 34px; }

/* reveal */
.section-title, .skill-card, .tl-item, .cert-item, .about-main, .about-side, .proj-card {
  opacity: 0; transform: translateY(16px); transition: opacity 0.55s ease, transform 0.55s ease;
}
.section-title.in, .skill-card.in, .tl-item.in, .cert-item.in, .about-main.in, .about-side.in, .proj-card.in {
  opacity: 1; transform: none;
}
.proj-card.in { transition-delay: calc(var(--i, 0) * 55ms); }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 36px; align-items: start; }
.about-main p { margin: 0 0 18px; color: var(--text-dim); }
.about-main strong { color: var(--heading); font-weight: 700; }
.about-side { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow-sm); }
.about-facts { margin: 0; display: grid; gap: 16px; }
.about-facts div { display: grid; gap: 3px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.about-facts div:last-child { border-bottom: none; padding-bottom: 0; }
.about-facts dt { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; color: var(--accent); text-transform: uppercase; }
.about-facts dd { margin: 0; font-weight: 600; color: var(--text); }
.about-facts small { color: var(--text-mute); font-weight: 400; }

/* ---------- Skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.skill-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm); transition: 0.2s; }
.skill-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.skill-group { margin: 0 0 14px; font-size: 0.98rem; color: var(--heading); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.skill-group::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--accent); }
.skill-tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.skill-tags li {
  font-size: 0.82rem; font-weight: 500; padding: 6px 13px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--border); color: var(--text-dim); transition: 0.2s;
}
.skill-tags li:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ---------- Projects ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 30px; }
.filter-btn {
  font-size: 0.85rem; font-weight: 600; padding: 9px 18px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border-2); color: var(--text-dim); cursor: pointer; transition: 0.2s;
}
.filter-btn:hover { color: var(--accent); border-color: var(--accent); }
.filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.projects-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.proj-card {
  position: relative; display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); transition: 0.25s;
}
.proj-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform 0.28s ease; z-index: 2;
}
.proj-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); border-color: var(--border-2); }
.proj-card:hover::before { transform: scaleX(1); }
.proj-cover { aspect-ratio: 16 / 9; position: relative; overflow: hidden; border-bottom: 1px solid var(--border); }
.proj-cover img { width: 100%; height: 100%; object-fit: cover; }

.proj-body { padding: 24px 24px 24px; display: flex; flex-direction: column; gap: 12px; }
.proj-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.proj-tag { font-family: var(--mono); font-size: 0.7rem; color: var(--accent); letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; }
.proj-status {
  margin-left: auto; font-size: 0.7rem; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.proj-title { margin: 0; font-size: 1.16rem; font-weight: 800; color: var(--heading); }
.proj-summary { margin: 0; color: var(--text-dim); font-size: 0.92rem; }
.proj-stack { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.proj-stack li { font-size: 0.72rem; font-weight: 500; padding: 4px 10px; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); color: var(--text-dim); }
.proj-highlights { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.proj-highlights li { position: relative; padding-left: 20px; font-size: 0.86rem; color: var(--text-dim); }
.proj-highlights li::before { content: ""; position: absolute; left: 4px; top: 11px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.proj-links { margin-top: 6px; display: flex; gap: 14px; flex-wrap: wrap; }
.proj-link { font-size: 0.82rem; font-weight: 600; color: var(--accent); }
.proj-link:hover { color: var(--accent-dark); text-decoration: underline; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; max-width: 760px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--border-2); }
.tl-item { position: relative; padding: 0 0 26px 38px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { position: absolute; left: 0; top: 6px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-2); }
.tl-now .tl-dot { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.tl-date { font-family: var(--mono); font-size: 0.78rem; color: var(--accent); font-weight: 500; }
.tl-title { margin: 2px 0 4px; font-size: 1.02rem; font-weight: 700; color: var(--heading); }
.tl-desc { margin: 0; color: var(--text-dim); font-size: 0.9rem; }

/* ---------- Certs ---------- */
.certs-wrap { display: grid; grid-template-columns: 1.4fr 1fr; gap: 36px; }
.certs-head { font-size: 1rem; color: var(--heading); margin: 0 0 16px; font-weight: 700; }
.certs-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cert-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
}
.cert-item:hover { border-color: var(--border-2); }
.cert-name { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.cert-date { font-family: var(--mono); font-size: 0.76rem; color: var(--text-mute); white-space: nowrap; }

/* ---------- Contact ---------- */
.contact-card { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; max-width: 760px; }
.contact-item {
  display: flex; align-items: center; gap: 16px; padding: 22px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); transition: 0.2s;
}
.contact-item:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow); }
.contact-ico {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent); font-size: 1.3rem; flex: none;
}
.contact-meta { display: grid; gap: 2px; min-width: 0; }
.contact-label { font-family: var(--mono); font-size: 0.72rem; color: var(--text-mute); letter-spacing: 0.08em; text-transform: uppercase; }
.contact-value { font-weight: 600; color: var(--text); word-break: break-all; }

/* ---------- Home Lab / Infra ---------- */
.homelab-diagram {
  margin: 0 0 30px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 30px 32px 20px; box-shadow: var(--shadow-sm);
}
.homelab-diagram img { width: 100%; height: auto; display: block; }
.homelab-diagram figcaption { margin-top: 18px; text-align: center; font-size: 0.84rem; color: var(--text-mute); }
.homelab-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.homelab-head {
  margin: 0 0 12px; font-size: 0.95rem; font-weight: 700; color: var(--heading);
  display: flex; align-items: center; gap: 8px;
}
.homelab-head::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--accent); }
.homelab-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.homelab-list li { position: relative; padding-left: 20px; font-size: 0.9rem; color: var(--text-dim); }
.homelab-list li::before { content: ""; position: absolute; left: 4px; top: 12px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.homelab-list strong { color: var(--heading); font-weight: 700; }
.homelab-list code { font-family: var(--mono); font-size: 0.82em; background: var(--accent-soft); color: var(--accent-dark); padding: 1px 6px; border-radius: 5px; }
.homelab-stack { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 7px; }
.homelab-stack li {
  font-family: var(--mono); font-size: 0.74rem; padding: 5px 11px; border-radius: 7px;
  background: var(--surface); border: 1px solid var(--border-2); color: var(--text-dim);
}
.homelab-note { margin: 4px 0 0; font-size: 0.8rem; color: var(--text-mute); }
.homelab-realphoto { margin: 30px 0 0; }
.homelab-realphoto img { width: 100%; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.homelab-realphoto figcaption { margin-top: 12px; text-align: center; font-size: 0.8rem; color: var(--text-mute); }

/* ---------- Beyond Code (cycling) ---------- */
.beyond-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; max-width: 760px; }
.beyond-fig { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); transition: 0.2s; }
.beyond-fig:hover { box-shadow: var(--shadow); transform: translateY(-3px); }
.beyond-fig img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; }
.beyond-fig figcaption { padding: 12px 14px; font-size: 0.82rem; font-weight: 600; color: var(--text-dim); text-align: center; }
.beyond-stats { list-style: none; margin: 24px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; max-width: 760px; }
.beyond-stats li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 20px 16px; text-align: center; box-shadow: var(--shadow-sm); }
.beyond-stats b { display: block; font-size: 1.5rem; font-weight: 800; color: var(--accent); line-height: 1.3; }
.beyond-stats span { font-size: 0.78rem; color: var(--text-mute); }
.beyond-note { margin: 22px 0 0; max-width: 760px; color: var(--text-dim); font-size: 0.92rem; }
@media (max-width: 560px) { .beyond-stats { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .homelab-cols { grid-template-columns: 1fr; gap: 22px; } }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; padding: 24px 0; color: var(--text-mute); font-size: 0.85rem; }
.footer-inner .to-top { font-weight: 500; color: var(--text-dim); }
.footer-inner .to-top:hover { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; gap: 36px; }
  .hero-card { max-width: 420px; }
}
@media (max-width: 860px) {
  .about-grid, .certs-wrap { grid-template-columns: 1fr; }
  .skills-grid, .projects-grid, .contact-card { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 8px; }
  .nav-toggle span { width: 24px; height: 2px; background: var(--heading); transition: 0.25s; }
  .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-list {
    position: absolute; top: 66px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); padding: 8px 16px 16px;
    transform: translateY(-12px); opacity: 0; pointer-events: none; transition: 0.22s;
  }
  .nav-list.open { transform: none; opacity: 1; pointer-events: auto; }
  .nav-list a { padding: 12px 8px; }
  .nav-list a.nav-cta { margin-top: 6px; text-align: center; }
  .section { padding: 62px 0; }
  .hero { padding: 56px 0 56px; }
}
