/* ============ tokens ============ */
:root {
  --bg: #f6f8fb;
  --bg-alt: #eaf0f7;
  --surface: #ffffff;
  --ink: #0f1d33;
  --ink-2: #44536b;
  --ink-3: #6b7a92;
  --line: #d6dee9;
  --sky: #1d5fd1;
  --sky-soft: #e3ecfb;
  --amber: #f2a900;
  --blood: #c8102e;
  --blood-soft: #fbe6e9;
  --board-bg: #0b1b33;
  --board-ink: #ffd35a;
  --board-line: #1f3456;
  --shadow: 0 1px 2px rgb(15 29 51 / .06), 0 8px 24px rgb(15 29 51 / .08);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #081326;
    --bg-alt: #0c1a31;
    --surface: #11213c;
    --ink: #e8eef8;
    --ink-2: #b1bfd4;
    --ink-3: #8193ad;
    --line: #22365a;
    --sky: #6aa3ff;
    --sky-soft: #15294a;
    --amber: #ffc53d;
    --blood: #ff5a6e;
    --blood-soft: #3a1622;
    --board-bg: #040b18;
    --board-line: #16284a;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #081326;
  --bg-alt: #0c1a31;
  --surface: #11213c;
  --ink: #e8eef8;
  --ink-2: #b1bfd4;
  --ink-3: #8193ad;
  --line: #22365a;
  --sky: #6aa3ff;
  --sky-soft: #15294a;
  --amber: #ffc53d;
  --blood: #ff5a6e;
  --blood-soft: #3a1622;
  --board-bg: #040b18;
  --board-line: #16284a;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .35);
  color-scheme: dark;
}

/* ============ base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans JP", system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", sans-serif;
  font-size: 16px;
  line-height: 1.8;
  overflow-x: hidden;
}
h1, h2, h3 { line-height: 1.3; margin: 0; }
p { margin: 0 0 1em; }
a { color: var(--sky); text-underline-offset: 3px; }
ul { list-style: none; margin: 0; padding: 0; }
.mono { font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--sky); outline-offset: 3px; border-radius: 4px; }

/* ============ nav ============ */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; gap: 16px; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 900; font-size: 1.1rem; color: var(--ink); text-decoration: none; letter-spacing: .02em; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--sky); color: #fff; font-size: .95rem }
.nav nav { margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav nav::-webkit-scrollbar { display: none; }
.nav-links { display: flex; gap: 4px; }
.nav-links a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: .9rem; font-weight: 500; white-space: nowrap; }
.nav-links a:hover { background: var(--sky-soft); color: var(--ink); }
@media (max-width: 560px) {
  .brand { font-size: 0; gap: 0; }
  .nav-inner { gap: 10px; }
  .nav-links { gap: 0; }
  .nav-links a { padding: 6px 6px; font-size: .78rem; }
}
.theme-btn {
  flex: none; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer; display: grid; place-items: center;
}
.theme-icon { width: 16px; height: 16px; border-radius: 50%; background: currentColor; box-shadow: inset -5px -3px 0 0 var(--surface); }

/* ============ buttons ============ */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: 999px;
  font-weight: 700; font-size: .92rem; text-decoration: none; border: 1.5px solid transparent;
  transition: transform .15s ease, background-color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--sky); color: #fff; }
.btn-ghost { border-color: var(--line); color: var(--ink); background: var(--surface); }
.btn-ghost:hover { border-color: var(--sky); }

/* ============ hero ============ */
.hero {
  padding: 28px 0 64px;
  background:
    radial-gradient(900px 400px at 85% -10%, var(--sky-soft), transparent 70%),
    linear-gradient(var(--bg), var(--bg));
  position: relative;
}
.hero-grid { display: grid; gap: 40px; align-items: center; }
@media (min-width: 900px) { .hero { padding: 48px 0 88px; } .hero-grid { grid-template-columns: 1.1fr 1fr; gap: 56px; } }
.eyebrow { color: var(--sky); font-size: .78rem; font-weight: 700; letter-spacing: .18em; margin-bottom: 14px; }
.hero-id { display: flex; align-items: center; gap: clamp(14px, 3vw, 24px); margin-bottom: 22px; }
.hero-title { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.avatar {
  flex: none; width: clamp(84px, 22vw, 128px); height: auto; aspect-ratio: 1; border-radius: 50%;
  background: var(--sky-soft); border: 3px solid var(--surface); box-shadow: 0 0 0 2px var(--sky), var(--shadow);
  object-fit: cover;
}
.flap {
  font-family: "JetBrains Mono", ui-monospace, monospace; font-weight: 700;
  font-size: clamp(1.9rem, 8vw, 4.2rem); letter-spacing: .06em; line-height: 1;
  display: inline-flex; gap: .08em;
}
.flap .cell {
  display: inline-grid; place-items: center; width: .82em; height: 1.12em; border-radius: .09em;
  background: var(--board-bg); color: var(--board-ink); position: relative; font-size: .86em;
}
.flap .cell { box-shadow: inset 0 0 0 1px var(--board-line); }
.flap .cell::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgb(0 0 0 / .55); }
.hero-ja { font-size: clamp(1.1rem, 3.6vw, 1.4rem); font-weight: 700; color: var(--ink-2); letter-spacing: .2em; }
.lead { font-size: 1.05rem; color: var(--ink-2); max-width: 36em; }
.lead strong { color: var(--ink); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }

/* boarding pass */
.pass {
  display: grid; grid-template-columns: 1fr auto; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--line); overflow: hidden; max-width: 520px; width: 100%;
  justify-self: center; transform: rotate(-1.2deg);
}
.pass-main { padding: 20px 20px 18px; min-width: 0; }
.pass-head { display: flex; justify-content: space-between; font-size: .72rem; font-weight: 700; letter-spacing: .14em; color: var(--ink-3); padding-bottom: 12px; border-bottom: 1px dashed var(--line); }
.pass-airline { color: var(--sky); }
.pass-route { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 16px 0; }
.pass-route .to { text-align: right; }
.pass-plane { color: var(--sky); }
.label { font-size: .64rem; font-weight: 700; letter-spacing: .16em; color: var(--ink-3); margin: 0; font-family: "JetBrains Mono", monospace; }
.iata { font-size: clamp(1.9rem, 8vw, 2.5rem); font-weight: 700; margin: 0; line-height: 1.1; }
.city { font-size: .8rem; color: var(--ink-2); margin: 0; }
.pass-fields { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 16px; margin: 0; padding-top: 14px; border-top: 1px dashed var(--line); }
@media (min-width: 480px) { .pass-fields { grid-template-columns: repeat(4, auto); } }
.pass-fields dd { margin: 0; font-weight: 700; font-size: .92rem; }
.pass-stub {
  width: 92px; padding: 20px 12px; border-left: 2px dashed var(--line); background: var(--sky-soft);
  display: flex; flex-direction: column; align-items: center; text-align: center; position: relative;
}
.pass-stub::before, .pass-stub::after {
  content: ""; position: absolute; left: -11px; width: 20px; height: 20px; border-radius: 50%; background: var(--bg);
}
.pass-stub::before { top: -10px; } .pass-stub::after { bottom: -10px; }
.stub-big { font-size: 1.3rem; font-weight: 700; margin: 2px 0 14px; color: var(--sky); }
.barcode {
  flex: 1; width: 44px; min-height: 90px;
  background: repeating-linear-gradient(0deg, var(--ink) 0 2px, transparent 2px 4px, var(--ink) 4px 5px, transparent 5px 8px, var(--ink) 8px 11px, transparent 11px 13px);
  opacity: .85;
}
@media (max-width: 420px) { .pass-stub { width: 64px; } .barcode { width: 30px; } }

/* ============ sections ============ */
.section { padding: 72px 0; }
.section.alt { background: var(--bg-alt); }
@media (min-width: 900px) { .section { padding: 96px 0; } }
.section-title { display: flex; align-items: baseline; gap: 14px; font-size: clamp(1.7rem, 5vw, 2.3rem); font-weight: 900; margin-bottom: 28px; letter-spacing: .01em; }
.section-title .num { font-size: .9rem; color: var(--sky); font-weight: 700; padding: 2px 8px; border: 1.5px solid var(--sky); border-radius: 6px; }
.section-lead { color: var(--ink-2); margin-top: -12px; margin-bottom: 28px; }
.sub-title { font-size: 1.2rem; font-weight: 900; margin: 56px 0 18px; }

/* profile（hero 内） */
.profile { margin-top: 48px; display: grid; gap: 22px; }
@media (min-width: 900px) { .profile { grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; } }
.profile-note { color: var(--ink-2); margin: 0; font-size: .95rem; }
.facts { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 20px; box-shadow: var(--shadow); }
.facts li { display: grid; gap: 2px 14px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.facts li:last-child { border-bottom: 0; }
@media (min-width: 560px) { .facts li { grid-template-columns: 118px 1fr; } }
.fact-k { font-size: .68rem; font-weight: 700; letter-spacing: .1em; color: var(--ink-3); padding-top: 5px; line-height: 1.5; }
.facts .muted { display: block; }
.muted { color: var(--ink-3); font-size: .85em; }

/* skills */
.skill-rows {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 4px 20px; box-shadow: var(--shadow);
}
.skill-row { display: grid; gap: 6px 20px; padding: 16px 0; border-bottom: 1px dashed var(--line); }
.skill-row:last-child { border-bottom: 0; }
.skill-row dt {
  font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3); padding-top: 5px;
}
.skill-row dd { margin: 0; min-width: 0; }
@media (min-width: 640px) { .skill-row { grid-template-columns: 150px 1fr; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 4px 12px; border-radius: 999px; background: var(--bg-alt); border: 1px solid var(--line); font-size: .86rem; font-weight: 500; line-height: 1.6; }
.section.alt .chip { background: var(--bg); }
.chips.small { margin-top: 18px; }
.chips.small .chip { font-size: .78rem; padding: 2px 10px; }

/* hobbies */
.hobby-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.hobby { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.hobby h3 { font-size: 1.05rem; margin: 8px 0 6px; }
.hobby p { font-size: .9rem; color: var(--ink-2); margin: 0; }
.hobby-emoji { font-size: 1.8rem; line-height: 1; }
.hobby-key { border: 2px solid var(--sky); background: linear-gradient(160deg, var(--sky-soft), var(--surface) 60%); }
.hobby-key.blood { border-color: var(--blood); background: linear-gradient(160deg, var(--blood-soft), var(--surface) 60%); }
.hobby-key.blood a { color: var(--blood); }
@media (min-width: 720px) { .hobby-key { grid-column: span 2; } }

/* departure board */
.board { background: var(--board-bg); border-radius: var(--radius); padding: 8px; margin-bottom: 40px; box-shadow: var(--shadow); overflow: hidden; }
.board-row {
  display: grid; grid-template-columns: 76px 1fr 96px; gap: 12px; align-items: center;
  padding: 12px; color: var(--board-ink); text-decoration: none; font-weight: 700; font-size: .9rem; letter-spacing: .06em;
  border-bottom: 1px solid var(--board-line);
}
.board-row:last-child { border-bottom: 0; }
.board-row > :nth-child(3) { display: none; }
@media (min-width: 720px) {
  .board-row { grid-template-columns: 90px 1.2fr 1.5fr 110px; font-size: 1rem; }
  .board-row > :nth-child(3) { display: block; }
}
.board-head { color: #8aa0c4; font-size: .7rem !important; letter-spacing: .18em; }
a.board-row:hover { background: rgb(255 255 255 / .05); }
.st-on { color: #5ee08a; }
.st-off { color: #ff6b6b; }
.st-on::before { content: "● "; animation: blink 1.6s steps(2) infinite; }
@keyframes blink { 50% { opacity: .2; } }
@media (prefers-reduced-motion: reduce) { .st-on::before { animation: none; } }

/* works */
.work {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px 20px; margin-bottom: 24px; box-shadow: var(--shadow); border-top: 5px solid var(--sky);
}
@media (min-width: 720px) { .work { padding: 36px 40px; } }
.work.blood { border-top-color: var(--blood); }
.work.blood .btn-primary { background: var(--blood); }
.work.blood .work-tag { color: var(--blood); }
.work.blood .stat-v { color: var(--blood); }
.work-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 24px; align-items: flex-start; margin-bottom: 18px; }
.work-tag { font-size: .74rem; font-weight: 700; letter-spacing: .12em; color: var(--sky); margin-bottom: 6px; }
.work-title { font-size: clamp(1.6rem, 5vw, 2.1rem); font-weight: 900; }
.work-sub { color: var(--ink-3); font-weight: 500; margin: 2px 0 0; }
.work-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.work-desc { color: var(--ink-2); max-width: 52em; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 20px 0; }
.stat { background: var(--bg-alt); border-radius: 10px; padding: 12px 8px; text-align: center; display: flex; flex-direction: column; }
.stat-v { font-size: clamp(1.3rem, 5vw, 1.8rem); font-weight: 700; color: var(--sky); line-height: 1.3; }
.stat-k { font-size: .76rem; color: var(--ink-3); font-weight: 500; }
.feature-list li { position: relative; padding-left: 22px; margin-bottom: 6px; color: var(--ink-2); font-size: .95rem; }
.feature-list li::before { content: "›"; position: absolute; left: 4px; top: -1px; color: var(--sky); font-weight: 900; }
.work.blood .feature-list li::before { color: var(--blood); }

/* oss */
.oss-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.oss { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); transition: border-color .15s, transform .15s; }
.oss:hover { border-color: var(--sky); transform: translateY(-2px); }
.oss-name { font-weight: 700; color: var(--sky); }
.oss-desc { font-size: .86rem; color: var(--ink-2); line-height: 1.7; }

/* links */
.link-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.link-card {
  display: flex; align-items: center; gap: 14px; padding: 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none;
  transition: border-color .15s, transform .15s; box-shadow: var(--shadow);
}
.link-card:hover { border-color: var(--sky); transform: translateY(-2px); }
.link-icon { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--ink); color: var(--bg); font-weight: 900; font-size: 1.05rem; }
.link-icon.qiita { background: #55c500; color: #fff; }
.link-icon.hatena { background: #00a4de; color: #fff; font-size: .95rem; }
.link-body { display: flex; flex-direction: column; min-width: 0; line-height: 1.4; }
.link-name { font-weight: 700; }
.link-id { font-size: .82rem; color: var(--ink-3); }
.arrow { margin-left: auto; color: var(--ink-3); }

/* footer */
.footer { border-top: 1px solid var(--line); padding: 28px 0 40px; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: .8rem; color: var(--ink-3); }

/* reveal */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }
@media (max-width: 400px) { .nav-links li:first-child { display: none; } }

/* service logo（ロゴがグレー文字なのでダークでも白プレートに載せる） */
.work-logo { margin-top: 4px; }
.work.blood .work-logo img { width: 290px; padding: 6px 10px; }
.work-logo img {
  display: block; width: 324px; max-width: 100%; height: auto;
  background: #fff; border-radius: 10px; padding: 8px 12px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .work-logo img { box-shadow: 0 0 0 1px var(--line); } }

/* likes（その他の趣味） */
.like-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
@media (min-width: 560px) { .like-grid { grid-template-columns: repeat(4, 1fr); } }
.like {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 8px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0;
}
.like-icon {
  --tint: var(--sky-soft);
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  background: var(--tint); font-size: 1.6rem; line-height: 1; flex: none;
}
.like h3 { font-size: .9rem; line-height: 1.35; overflow-wrap: anywhere; }
.like-body { min-width: 0; }
.like p { margin: 2px 0 0; font-size: .74rem; color: var(--ink-3); line-height: 1.5; overflow-wrap: anywhere; }
.like p strong { color: var(--ink); }
.c-sky    .like-icon { --tint: color-mix(in srgb, #1d5fd1 16%, var(--surface)); }
.c-green  .like-icon { --tint: color-mix(in srgb, #2e9e5b 18%, var(--surface)); }
.c-amber  .like-icon { --tint: color-mix(in srgb, #f2a900 22%, var(--surface)); }
.c-purple .like-icon { --tint: color-mix(in srgb, #7b4bd6 16%, var(--surface)); }
.c-pink   .like-icon { --tint: color-mix(in srgb, #e0479e 16%, var(--surface)); }
.c-red    .like-icon { --tint: color-mix(in srgb, #c8102e 16%, var(--surface)); }
@media (min-width: 900px) {
  .like-grid { gap: 14px; }
  .like { flex-direction: row; text-align: left; padding: 16px; gap: 14px; }
  .like h3 { font-size: 1rem; }
  .like p { font-size: .8rem; }
}

/* challenge（登山） */
.challenge {
  margin-top: 14px; display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center;
  padding: 12px 14px; border-radius: var(--radius); border: 2px dashed color-mix(in srgb, #2e9e5b 60%, var(--line));
  background: linear-gradient(160deg, color-mix(in srgb, #2e9e5b 10%, var(--surface)), var(--surface) 70%);
}
.challenge-icon { font-size: 1.6rem; line-height: 1; }
.challenge .work-tag { color: #2e9e5b; margin-bottom: 0; font-size: .64rem; }
.challenge h3 { font-size: .95rem; display: inline; margin-right: 8px; }
.challenge .work-tag { display: inline; }
.challenge-body > p.work-tag { margin-right: 8px; }
.challenge-body p:last-child { margin: 2px 0 0; color: var(--ink-2); font-size: .8rem; line-height: 1.6; }
.route { grid-column: 1 / -1; list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 0; }
.route li { display: flex; flex-direction: column; font-size: .72rem; line-height: 1.5; flex: none; }
.route li + li::before { content: none; }
.route li:first-child { flex: 1; position: relative; padding-right: 12px; }
.route li:first-child::after {
  content: ""; position: absolute; left: 70px; right: 12px; top: .7em; height: 0;
  border-top: 2px dashed color-mix(in srgb, #2e9e5b 60%, var(--line));
}
.route-date { font-weight: 700; color: var(--ink); }
.route-label { color: var(--ink-3); font-family: "Noto Sans JP", sans-serif; }
.route .goal { text-align: right; }
.route .goal .route-date { color: #2e9e5b; }
@media (min-width: 720px) {
  .challenge { grid-template-columns: auto 1fr minmax(240px, 320px); padding: 12px 20px; gap: 8px 16px; }
  .route { grid-column: auto; }
}
@media (max-width: 899px) {
  .like { padding: 12px 5px; }
  .like h3 { font-size: .8rem; letter-spacing: -.02em; }
  .like p .mono { font-size: .92em; letter-spacing: -.03em; }
}

.link-icon.logo { background: transparent; object-fit: contain; padding: 2px; }

/* contact */
.contact {
  margin-top: 20px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 14px 24px; padding: 20px 24px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.contact h3 { font-size: 1.05rem; margin-bottom: 4px; }
.contact p { margin: 0; font-size: .88rem; color: var(--ink-2); max-width: 46em; }
