/* ============================================================
   KUNII SHOTA — Portfolio LP
   深い藍黒の水面 × フォスファーグリーン
   ============================================================ */

:root {
  --bg:        oklch(0.16 0.022 235);
  --bg-deep:   oklch(0.125 0.02 235);
  --bg-raise:  oklch(0.20 0.024 235);
  --line:      oklch(0.32 0.03 220 / .55);
  --text:      oklch(0.93 0.012 200);
  --muted:     oklch(0.70 0.02 215);
  --faint:     oklch(0.52 0.02 220);
  --acc:       oklch(0.85 0.155 162);   /* フォスファーグリーン */
  --acc-deep:  oklch(0.62 0.12 165);
  --acc-soft:  oklch(0.85 0.155 162 / .14);
  --amber:     oklch(0.83 0.115 82);    /* 琥珀(控えめな第二色) */
  --font-en: "Martian Mono", monospace;
  --font-jp: "Zen Kaku Gothic New", sans-serif;
  --space-xs: 8px; --space-sm: 16px; --space-md: 32px; --space-lg: 64px; --space-xl: 112px;
  --ease-out: cubic-bezier(.16,1,.3,1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-jp);
  font-size: 16px;
  line-height: 1.9;
  overflow-x: hidden;
}
::selection { background: var(--acc); color: oklch(0.15 0.02 235); }

/* ---------- 背景レイヤー ---------- */
#water { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
#grain {
  position: fixed; inset: -50%; z-index: 1; pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
  animation: grain 6s steps(8) infinite;
}
@keyframes grain {
  0%,100% { transform: translate(0,0); } 25% { transform: translate(2%,-3%); }
  50% { transform: translate(-3%,2%); } 75% { transform: translate(1%,3%); }
}

main, header, footer { position: relative; z-index: 2; }

/* ---------- ブートローダー ---------- */
#boot {
  position: fixed; inset: 0; z-index: 100; background: var(--bg-deep);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .5s var(--ease-out), visibility .5s;
}
#boot.done { opacity: 0; visibility: hidden; }
.boot-inner { width: min(420px, 80vw); }
.boot-line { font-family: var(--font-en); font-size: 12px; color: var(--acc); margin-bottom: 14px; letter-spacing: .04em; }
.boot-bar { height: 2px; background: var(--line); overflow: hidden; }
.boot-bar span { display: block; height: 100%; width: 0; background: var(--acc); transition: width .25s linear; }

/* ---------- カーソル ---------- */
#cursor, #cursor-dot { position: fixed; top: 0; left: 0; pointer-events: none; z-index: 90; border-radius: 50%; }
#cursor {
  width: 36px; height: 36px; border: 1px solid var(--acc-deep);
  transform: translate(-50%,-50%);
  transition: width .3s var(--ease-out), height .3s var(--ease-out), opacity .3s, border-color .3s;
  opacity: .8;
}
#cursor.on { width: 64px; height: 64px; border-color: var(--acc); background: var(--acc-soft); }
#cursor-dot { width: 4px; height: 4px; background: var(--acc); transform: translate(-50%,-50%); }
@media (hover: none), (pointer: coarse) { #cursor, #cursor-dot { display: none; } }

/* ---------- スクロール進捗 ---------- */
#progress { position: fixed; top: 0; left: 0; height: 2px; width: 0; background: var(--acc); z-index: 80; }

/* ---------- ヘッダー ---------- */
#header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 70;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px clamp(20px, 4vw, 48px);
  transition: background .4s, backdrop-filter .4s, padding .4s;
}
#header.scrolled { background: oklch(0.14 0.02 235 / .75); backdrop-filter: blur(14px); padding-block: 12px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; }
.brand-mark { font-family: var(--font-en); font-weight: 700; font-size: 18px; color: var(--acc); }
.brand-name { font-family: var(--font-en); font-size: 11px; letter-spacing: .22em; color: var(--muted); }
#nav { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 30px); }
#nav a {
  font-family: var(--font-en); font-size: 11px; letter-spacing: .12em;
  color: var(--muted); text-decoration: none; position: relative; padding: 4px 0;
  transition: color .3s;
}
#nav a::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 1px; width: 100%;
  background: var(--acc); transform: scaleX(0); transform-origin: right;
  transition: transform .35s var(--ease-out);
}
#nav a:hover { color: var(--text); }
#nav a:hover::after { transform: scaleX(1); transform-origin: left; }
#nav .nav-cta { border: 1px solid var(--acc-deep); color: var(--acc); padding: 7px 16px; border-radius: 999px; transition: background .3s, color .3s; }
#nav .nav-cta::after { display: none; }
#nav .nav-cta:hover { background: var(--acc); color: oklch(0.15 0.02 235); }
#menuBtn { display: none; }

/* ---------- HERO ---------- */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 120px clamp(20px, 6vw, 90px) 80px;
  position: relative;
}
.hero-eyebrow {
  font-family: var(--font-en); font-size: 12px; letter-spacing: .3em;
  color: var(--acc); margin-bottom: clamp(16px, 3vh, 28px);
}
.blink { animation: blink 1.6s steps(2) infinite; font-size: 9px; vertical-align: 2px; margin-right: 10px; }
@keyframes blink { 50% { opacity: 0; } }

.hero-name { display: flex; flex-direction: column; gap: 0; }
.hero-jp {
  font-size: clamp(56px, 11vw, 140px); font-weight: 900; line-height: 1.12;
  letter-spacing: .04em;
}
.hero-space { display: inline-block; width: .35em; }
.hero-en {
  font-family: var(--font-en); font-weight: 300;
  font-size: clamp(20px, 3.6vw, 44px); letter-spacing: .3em;
  color: transparent; -webkit-text-stroke: 1px var(--acc-deep);
  margin-top: 6px;
}
.hero-copy { margin-top: clamp(20px, 4vh, 36px); font-size: clamp(15px, 1.6vw, 19px); color: var(--muted); font-weight: 500; }

/* ターミナル */
.term {
  margin-top: clamp(28px, 5vh, 52px);
  width: min(640px, 100%);
  background: oklch(0.13 0.02 235 / .82);
  border: 1px solid var(--line); border-radius: 10px;
  backdrop-filter: blur(6px);
  box-shadow: 0 24px 60px oklch(0.05 0.02 240 / .5);
}
.term-bar { display: flex; align-items: center; gap: 7px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.term-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.term-dot:first-child { background: oklch(0.68 0.16 25); }
.term-dot:nth-child(2) { background: var(--amber); }
.term-dot:nth-child(3) { background: var(--acc-deep); }
.term-title { margin-left: 8px; font-family: var(--font-en); font-size: 10px; color: var(--faint); letter-spacing: .08em; }
.term-body {
  padding: 18px 20px 22px; min-height: 132px;
  font-family: var(--font-en); font-size: 12.5px; line-height: 2.1; letter-spacing: .02em;
  color: var(--muted); white-space: pre-wrap;
}
.term-body .t-prompt { color: var(--acc); }
.term-body .t-out { color: var(--text); }
.term-body .t-dim { color: var(--faint); }
.term-caret { display: inline-block; width: 8px; height: 15px; background: var(--acc); vertical-align: -2px; animation: blink 1s steps(2) infinite; }

.scroll-cue {
  position: absolute; bottom: 34px; right: clamp(24px, 5vw, 72px);
  font-family: var(--font-en); font-size: 10px; letter-spacing: .3em; color: var(--faint);
  text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 12px;
  transition: color .3s;
}
.scroll-cue:hover { color: var(--acc); }
.scroll-line { width: 1px; height: 56px; background: var(--faint); overflow: hidden; position: relative; }
.scroll-line::after {
  content: ""; position: absolute; top: -100%; left: 0; width: 100%; height: 100%;
  background: var(--acc); animation: scrollLine 2.2s var(--ease-out) infinite;
}
@keyframes scrollLine { 0% { top: -100%; } 55% { top: 0; } 100% { top: 100%; } }

/* ---------- STATS ---------- */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px; background: var(--line);
  border-block: 1px solid var(--line);
  margin: 0 clamp(20px, 6vw, 90px);
}
.stat { background: oklch(0.15 0.02 235 / .88); padding: clamp(28px, 4vw, 48px) 20px; text-align: center; }
.stat-num { font-family: var(--font-en); font-size: clamp(36px, 4.6vw, 58px); font-weight: 700; color: var(--acc); line-height: 1.1; }
.stat-unit { font-size: .38em; margin-left: 4px; color: var(--acc-deep); }
.stat-label { margin-top: 10px; font-size: 12.5px; color: var(--muted); letter-spacing: .1em; }

/* ---------- セクション共通 ---------- */
.section { padding: var(--space-xl) clamp(20px, 6vw, 90px); max-width: 1240px; margin: 0 auto; }
.sec-head { display: flex; align-items: baseline; gap: 22px; margin-bottom: clamp(40px, 7vh, 72px); }
.sec-index { font-family: var(--font-en); font-size: 13px; color: var(--acc); letter-spacing: .1em; }
.sec-index::after { content: " /"; color: var(--faint); }
.sec-title { font-size: clamp(34px, 5vw, 56px); font-weight: 900; letter-spacing: .02em; line-height: 1.2; font-family: var(--font-en); font-weight: 700; }
.sec-sub { display: inline-block; margin-left: 18px; font-family: var(--font-jp); font-size: 13px; font-weight: 500; color: var(--faint); letter-spacing: .35em; }
.sec-note { margin-left: auto; font-size: 11px; color: var(--faint); }

/* ---------- ABOUT ---------- */
.about-grid { display: grid; grid-template-columns: minmax(220px, 340px) 1fr; gap: clamp(32px, 6vw, 90px); align-items: start; }
.portrait {
  aspect-ratio: 1; position: relative; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, oklch(0.22 0.03 220), oklch(0.14 0.02 235) 70%);
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
}
.portrait-k {
  font-family: var(--font-en); font-weight: 700; font-size: clamp(90px, 10vw, 150px);
  color: var(--acc-soft); -webkit-text-stroke: 1.5px var(--acc-deep);
}
.portrait-ring {
  position: absolute; inset: 14%; border: 1px dashed oklch(0.45 0.06 180 / .5); border-radius: 50%;
  animation: spin 26s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.about-lead { font-size: clamp(21px, 2.6vw, 30px); font-weight: 900; margin-bottom: 22px; line-height: 1.5; }
.about-text p + p { margin-top: 1.1em; }
.about-text p:not(.about-lead) { color: var(--muted); font-size: 15px; max-width: 62ch; }
.about-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.about-tags li {
  font-family: var(--font-en); font-size: 10.5px; letter-spacing: .06em;
  padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted);
}

/* ---------- SERVICES ---------- */
.svc-list { display: flex; flex-direction: column; }
.svc {
  display: flex; align-items: center; gap: clamp(20px, 4vw, 56px);
  padding: clamp(28px, 4.5vh, 44px) 10px;
  border-top: 1px solid var(--line);
  position: relative; overflow: hidden;
  transition: padding-left .45s var(--ease-out);
}
.svc:last-child { border-bottom: 1px solid var(--line); }
.svc::before {
  content: ""; position: absolute; inset: 0; background: var(--acc-soft);
  transform: translateY(101%); transition: transform .5s var(--ease-out); z-index: -1;
}
.svc:hover { padding-left: 26px; }
.svc:hover::before { transform: translateY(0); }
.svc-no { font-family: var(--font-en); font-size: clamp(30px, 4vw, 48px); font-weight: 300; color: var(--faint); transition: color .4s; }
.svc:hover .svc-no { color: var(--acc); }
.svc-main h3 { font-size: clamp(20px, 2.4vw, 28px); font-weight: 700; margin-bottom: 8px; }
.svc-main p { color: var(--muted); font-size: 14.5px; max-width: 58ch; }
.svc-arrow { margin-left: auto; font-family: var(--font-en); font-size: 26px; color: var(--faint); transition: transform .4s var(--ease-out), color .4s; }
.svc:hover .svc-arrow { transform: translateX(10px); color: var(--acc); }

/* ---------- マーキー ---------- */
.marquee { overflow: hidden; border-block: 1px solid var(--line); padding: 20px 0; margin: var(--space-lg) 0; }
.marquee-track { display: flex; gap: 56px; width: max-content; animation: marquee 30s linear infinite; }
.marquee-track span {
  font-family: var(--font-en); font-size: 15px; letter-spacing: .18em; color: var(--faint);
  white-space: nowrap;
}
.marquee-track span::after { content: "◇"; margin-left: 56px; color: var(--acc-deep); font-size: 10px; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- SKILLS ---------- */
.skill-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: clamp(28px, 4vw, 56px); }
.skill-cat {
  font-family: var(--font-en); font-size: 13px; letter-spacing: .24em; color: var(--acc);
  padding-bottom: 14px; margin-bottom: 6px; border-bottom: 1px solid var(--line);
}
.skill-col ul { list-style: none; }
.skill-col li {
  padding: 15px 2px 18px; font-size: 14.5px; font-weight: 500; position: relative;
}
.skill-col li i {
  position: absolute; left: 0; bottom: 8px; height: 2px; width: 100%;
  background: var(--line); border-radius: 2px;
}
.skill-col li i::after {
  content: ""; position: absolute; inset: 0; width: 0; border-radius: 2px;
  background: linear-gradient(90deg, var(--acc-deep), var(--acc));
}
.skill-col.lit li i::after { width: calc(var(--lv) * 100%); transition: width 1.2s var(--ease-out); }

/* ---------- WORKS ---------- */
.works { display: flex; flex-direction: column; gap: clamp(48px, 8vh, 88px); }
.work { display: grid; grid-template-columns: 1.15fr 1fr; gap: clamp(24px, 4vw, 64px); align-items: center; }
.work:nth-child(even) .work-visual { order: 2; }
.work-visual {
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  background: radial-gradient(circle at 30% 20%, oklch(0.20 0.028 230), oklch(0.135 0.02 235) 75%);
  transition: transform .5s var(--ease-out), box-shadow .5s;
  transform-style: preserve-3d; will-change: transform;
}
.work:hover .work-visual { box-shadow: 0 30px 70px oklch(0.05 0.02 240 / .55), 0 0 0 1px var(--acc-deep); }
.work-visual svg { display: block; width: 100%; height: auto; }
.wv-panel { fill: oklch(0.22 0.026 230); stroke: var(--line); }
.wv-phone { fill: oklch(0.18 0.024 232); stroke: oklch(0.4 0.04 210 / .6); }
.wv-bar.b1 { fill: oklch(0.85 0.155 162 / .8); }
.wv-bar.b2 { fill: oklch(0.85 0.155 162 / .5); }
.wv-bar.b3 { fill: oklch(0.5 0.03 220); }
.wv-line { fill: none; stroke: var(--acc); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.wv-donut { fill: none; stroke: var(--amber); stroke-width: 7; stroke-dasharray: 110 44; opacity: .85; }
.wv-cta { fill: oklch(0.85 0.155 162 / .85); }
.work-tag {
  display: inline-block; font-family: var(--font-en); font-size: 10px; letter-spacing: .2em;
  color: var(--amber); border: 1px solid oklch(0.83 0.115 82 / .4); border-radius: 999px;
  padding: 5px 13px; margin-bottom: 16px;
}
.work-info h3 { font-size: clamp(20px, 2.4vw, 27px); font-weight: 700; margin-bottom: 12px; line-height: 1.5; }
.work-info > p { color: var(--muted); font-size: 14.5px; max-width: 52ch; }
.work-meta { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.work-meta li { font-family: var(--font-en); font-size: 10.5px; color: var(--acc-deep); letter-spacing: .06em; }
.work-meta li::before { content: "#"; opacity: .7; }

/* ---------- CAREER ---------- */
.timeline { list-style: none; position: relative; max-width: 720px; }
.timeline::before {
  content: ""; position: absolute; left: 86px; top: 8px; bottom: 8px; width: 1px;
  background: var(--line);
}
.tl { display: flex; gap: 40px; padding: 26px 0; position: relative; }
.tl::before {
  content: ""; position: absolute; left: 82px; top: 40px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--bg-deep); border: 2px solid var(--acc-deep);
  transition: background .4s, box-shadow .4s;
}
.tl:hover::before { background: var(--acc); box-shadow: 0 0 14px var(--acc-deep); }
.tl-year { font-family: var(--font-en); font-size: 14px; color: var(--acc); width: 62px; flex-shrink: 0; padding-top: 8px; text-align: right; }
.tl-body { padding-left: 26px; }
.tl-body h3 { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.tl-body p { color: var(--muted); font-size: 14px; max-width: 54ch; }

/* ---------- CONTACT ---------- */
.contact { text-align: center; padding-block: calc(var(--space-xl) * 1.2); }
.contact-eyebrow { font-family: var(--font-en); font-size: 12px; letter-spacing: .34em; color: var(--acc); margin-bottom: 20px; }
.contact-title { font-size: clamp(34px, 6vw, 64px); font-weight: 900; margin-bottom: 22px; }
.contact-copy { color: var(--muted); font-size: 15px; margin-bottom: 44px; }
.contact-btn {
  display: inline-flex; align-items: center; gap: 16px;
  font-size: 17px; font-weight: 700; color: oklch(0.15 0.02 235);
  background: var(--acc); text-decoration: none;
  padding: 20px 46px; border-radius: 999px;
  transition: box-shadow .4s, background .4s;
  will-change: transform;
}
.contact-btn:hover { box-shadow: 0 0 44px oklch(0.85 0.155 162 / .45); }
.contact-btn-arrow { font-family: var(--font-en); transition: transform .3s var(--ease-out); }
.contact-btn:hover .contact-btn-arrow { transform: translateX(6px); }
.contact-note { margin-top: 20px; font-family: var(--font-en); font-size: 11px; color: var(--faint); letter-spacing: .08em; }

/* ---------- FOOTER ---------- */
footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 26px clamp(20px, 6vw, 90px);
  border-top: 1px solid var(--line);
  background: oklch(0.13 0.02 235 / .85);
}
.footer-brand { font-family: var(--font-en); font-size: 11px; letter-spacing: .28em; color: var(--muted); }
.footer-copy { font-size: 11px; color: var(--faint); }

/* ---------- リビール ---------- */
.reveal { opacity: 0; transform: translateY(34px); transition: opacity .9s var(--ease-out), transform .9s var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- モバイル ---------- */
@media (max-width: 860px) {
  #nav {
    position: fixed; inset: 0; z-index: -1;
    flex-direction: column; justify-content: center; gap: 30px;
    background: oklch(0.13 0.02 235 / .96); backdrop-filter: blur(18px);
    opacity: 0; pointer-events: none; transition: opacity .4s;
  }
  #nav a { font-size: 16px; }
  body.menu-open #nav { opacity: 1; pointer-events: auto; z-index: 69; }
  #menuBtn {
    display: flex; flex-direction: column; gap: 6px; z-index: 71;
    background: none; border: none; padding: 8px; cursor: pointer;
  }
  #menuBtn span { width: 26px; height: 1.5px; background: var(--text); transition: transform .35s var(--ease-out); }
  body.menu-open #menuBtn span:first-child { transform: translateY(4px) rotate(45deg); }
  body.menu-open #menuBtn span:last-child { transform: translateY(-3.5px) rotate(-45deg); }

  .about-grid { grid-template-columns: 1fr; }
  .about-visual { max-width: 260px; }
  .work { grid-template-columns: 1fr; }
  .work:nth-child(even) .work-visual { order: 0; }
  .sec-head { flex-wrap: wrap; gap: 12px; }
  .sec-note { margin-left: 0; width: 100%; }
  .timeline::before { left: 58px; }
  .tl { gap: 24px; }
  .tl::before { left: 54px; }
  .tl-year { width: 42px; font-size: 12px; }
  .svc { flex-wrap: wrap; }
  .svc-arrow { display: none; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
  #water, #grain, #cursor, #cursor-dot, #boot { display: none; }
  .marquee-track { animation: none; flex-wrap: wrap; width: auto; }
}
