/* ==========================================================================
   Shin — Portfolio
   コンセプト: 開発者の設計図（Blueprint × Terminal × Glass）
   ========================================================================== */

/* ----- Design Tokens ----- */
:root {
  /* 明るめダーク（青みグレー基調） */
  --bg:        #242c38;
  --bg-deep:   #1c232d;
  --surface:   rgba(148, 173, 203, 0.06);
  --glass:     rgba(38, 47, 60, 0.55);
  --glass-brd: rgba(148, 173, 203, 0.18);

  --ink:       #e9eef4;
  --muted:     #97a4b4;

  /* ウイスキーの琥珀（キャラのグラス由来） */
  --amber:        #d9a05b;
  --amber-bright: #ecbe82;
  --amber-dim:    rgba(217, 160, 91, 0.14);

  /* 図面の青 */
  --bp-blue:   #84a7cf;
  --line:      rgba(139, 164, 196, 0.18);
  --grid:      rgba(139, 164, 196, 0.055);

  --font-sans: "IBM Plex Sans JP", "Hiragino Kaku Gothic ProN", sans-serif;
  --font-mono: "IBM Plex Mono", "Menlo", monospace;

  --radius: 14px;
  --radius-sm: 8px;
  --header-h: 60px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }

body {
  background-color: var(--bg);
  /* 図面の方眼（大小2段のグリッド） */
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(rgba(139, 164, 196, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 164, 196, 0.09) 1px, transparent 1px);
  background-size: 24px 24px, 24px 24px, 120px 120px, 120px 120px;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.8;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--amber-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

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

::selection { background: var(--amber); color: var(--bg-deep); }

/* ----- 共通パーツ ----- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  color: var(--bp-blue);
  margin-bottom: 0.6rem;
}

.section {
  max-width: 1080px;
  margin: 0 auto;
  padding: 96px 24px 0;
}

.section-head { margin-bottom: 40px; }

.section-head h2 {
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
/* 見出し下線の琥珀アクセント */
.section-head h2::after {
  content: "";
  position: absolute;
  left: 0; bottom: -1px;
  width: 64px; height: 2px;
  background: var(--amber);
}

.section-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-brd);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 11px 26px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn:active { transform: translateY(1px) scale(0.97); }

.btn-primary {
  background: var(--amber);
  color: var(--bg-deep);
  font-weight: 600;
}
.btn-primary:hover { background: var(--amber-bright); box-shadow: 0 6px 20px rgba(217, 160, 91, 0.3); }

.btn-ghost {
  color: var(--ink);
  border-color: var(--glass-brd);
  background: var(--surface);
}
.btn-ghost:hover { border-color: var(--amber); color: var(--amber-bright); }

/* ----- Header ----- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(28, 35, 45, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}
.brand:hover { text-decoration: none; }

.brand-icon {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--glass-brd);
  background: var(--bg-deep) url("../assets/sd-chara.png") no-repeat;
  background-size: 190%;
  background-position: 50% 18%;
  transition: transform 0.3s ease;
}
.brand:hover .brand-icon { transform: rotate(-12deg) scale(1.08); }

.brand-name {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}
.brand-cursor { color: var(--amber); animation: blink 1.2s steps(1) infinite; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.site-nav a { color: var(--muted); transition: color 0.2s ease; }
.site-nav a:hover { color: var(--amber-bright); text-decoration: none; }

.nav-cta {
  color: var(--amber-bright) !important;
  border: 1px solid var(--amber);
  border-radius: 999px;
  padding: 5px 16px;
  transition: background 0.2s ease;
}
.nav-cta:hover { background: var(--amber-dim); }

/* ----- Hero ----- */
.hero {
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: calc(var(--header-h) + 40px) 24px 40px;
}

.hero-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 48px;
  align-items: center;
}

.hero-title {
  font-size: clamp(3.2rem, 9vw, 5.5rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.1;
  margin-bottom: 24px;
}

.hero-lead {
  margin-top: 24px;
  color: var(--muted);
  font-size: 0.98rem;
}

.hero-actions {
  margin-top: 32px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

/* ----- Terminal（共通） ----- */
.terminal {
  background: rgba(22, 28, 36, 0.85);
  border: 1px solid var(--glass-brd);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-family: var(--font-mono);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  background: rgba(148, 173, 203, 0.07);
  border-bottom: 1px solid var(--line);
}
.terminal-bar .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: rgba(151, 164, 180, 0.35);
}
.terminal-bar .dot:first-child { background: rgba(217, 160, 91, 0.7); }

.terminal-title {
  margin-left: 8px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.terminal-body {
  padding: 16px 18px;
  font-size: 0.9rem;
  line-height: 2;
}

.prompt { color: var(--bp-blue); margin-right: 8px; }

.terminal-out { color: var(--amber-bright); font-weight: 600; }

.caret {
  display: inline-block;
  width: 9px; height: 1.1em;
  margin-left: 3px;
  vertical-align: text-bottom;
  background: var(--amber);
  animation: blink 1s steps(1) infinite;
}

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

/* ----- Hero figure（図面シート上のキャラ） ----- */
.hero-figure {
  position: relative;
  padding: 36px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.hero-figure img {
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 18px 36px rgba(0, 0, 0, 0.35));
  transition: transform 0.25s ease;
}
.hero-figure:hover img { transform: translateY(-6px); }
.hero-figure.boing img { animation: boing 0.6s cubic-bezier(0.36, 1.6, 0.4, 1); }

@keyframes boing {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.06, 0.92) translateY(6px); }
  60%  { transform: scale(0.96, 1.05) translateY(-10px); }
  100% { transform: scale(1); }
}

/* シート四隅のトンボ */
.sheet-corner {
  position: absolute;
  width: 22px; height: 22px;
  border-color: var(--bp-blue);
  border-style: solid;
  border-width: 0;
  opacity: 0.7;
}
.sheet-corner.tl { top: 0; left: 0; border-top-width: 2px; border-left-width: 2px; }
.sheet-corner.tr { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; }
.sheet-corner.bl { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; }
.sheet-corner.br { bottom: 0; right: 0; border-bottom-width: 2px; border-right-width: 2px; }

/* 引出線つき注記 */
.annot {
  position: absolute;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--bp-blue);
  white-space: nowrap;
}
.annot-line {
  display: inline-block;
  width: 36px; height: 1px;
  margin-right: 8px;
  vertical-align: middle;
  background: var(--bp-blue);
  opacity: 0.7;
}
/* イラスト内の実物（Tシャツのハムスター・グラス・ノートPC）を指す位置 */
.annot-1 { top: 55%; right: -5%; }
.annot-2 { top: 40%; left: -3%; }
.annot-3 { bottom: 15%; left: -2%; }
.annot-2 .annot-line, .annot-3 .annot-line { display: none; }
.annot-2::after, .annot-3::after {
  content: "";
  display: inline-block;
  width: 36px; height: 1px;
  margin-left: 8px;
  vertical-align: middle;
  background: var(--bp-blue);
  opacity: 0.7;
}

.annot-fig {
  bottom: 4px; left: 36px;
  color: var(--muted);
}
.annot-hint { margin-left: 10px; color: var(--amber); opacity: 0.85; }

/* クリック時のきらめき */
.sparkle {
  position: fixed;
  z-index: 999;
  pointer-events: none;
  color: var(--amber-bright);
  font-size: 18px;
  animation: sparkle-fly 0.8s ease-out forwards;
}
@keyframes sparkle-fly {
  0%   { transform: translate(0, 0) scale(0.4) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1.2) rotate(180deg); opacity: 0; }
}

/* 画面クリックの十字マーク（図面カーソル） */
.click-mark {
  position: fixed;
  z-index: 998;
  width: 36px; height: 36px;
  margin: -18px 0 0 -18px;
  pointer-events: none;
  border: 1px solid var(--bp-blue);
  border-radius: 50%;
  animation: click-ring 0.5s ease-out forwards;
}
.click-mark::before, .click-mark::after {
  content: "";
  position: absolute;
  background: var(--bp-blue);
}
.click-mark::before { left: 50%; top: -6px; bottom: -6px; width: 1px; }
.click-mark::after { top: 50%; left: -6px; right: -6px; height: 1px; }

@keyframes click-ring {
  0%   { transform: scale(0.4); opacity: 0.9; }
  100% { transform: scale(1.4); opacity: 0; }
}

/* ----- About ----- */
.about-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
}

.about-text { padding: 32px; }
.about-text p + p { margin-top: 16px; }
.about-hobby { color: var(--muted); font-size: 0.92rem; }

.about-facts {
  padding: 32px;
  text-align: center;
}

.about-chara {
  width: 180px;
  margin: -70px auto 8px;
  cursor: pointer;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.3));
  transition: transform 0.25s ease;
}
.about-chara:hover { transform: rotate(-4deg); }
.about-chara.wiggle { animation: wiggle 0.5s ease; }

@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-8deg) scale(1.05); }
  75% { transform: rotate(8deg) scale(1.05); }
}

.facts { text-align: left; }
.facts > div {
  display: flex;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.92rem;
}
.facts > div:last-child { border-bottom: none; }
.facts dt {
  flex: 0 0 4.5em;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--bp-blue);
  padding-top: 3px;
}
.facts dd { color: var(--ink); }

/* ----- Skills ----- */
.ai-terminal {
  cursor: pointer;
  transition: border-color 0.2s ease;
}
.ai-terminal:hover { border-color: var(--amber); }

.ai-terminal .terminal-body {
  min-height: 216px;
  font-size: 0.85rem;
}
.ai-terminal .t-cmd { color: var(--ink); }
.ai-terminal .t-cmd .prompt { color: var(--bp-blue); }
.ai-terminal .t-comment { color: var(--muted); }
.ai-terminal .t-result { color: var(--amber-bright); }
.ai-terminal .t-result::before { content: "⏺ "; color: var(--amber); }

.terminal-replay {
  margin-left: auto;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--amber);
  opacity: 0.85;
}

.ai-caption {
  margin: 16px 4px 40px;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 720px;
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* フリップカード */
.skill-card {
  perspective: 900px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  min-height: 190px;
}

.skill-card-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 190px;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0.9, 0.4, 1);
}
.skill-card.flipped .skill-card-inner { transform: rotateY(180deg); }
.skill-card:hover .skill-card-inner { box-shadow: none; }

.skill-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 22px;
  border-radius: var(--radius);
  border: 1px solid var(--glass-brd);
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.skill-front { transition: border-color 0.2s ease, transform 0.2s ease; }
.skill-card:hover .skill-front { border-color: var(--amber); }

.skill-back {
  transform: rotateY(180deg);
  justify-content: center;
  font-size: 0.88rem;
  line-height: 1.9;
  color: var(--ink);
  border-color: var(--amber);
  background: linear-gradient(160deg, rgba(217, 160, 91, 0.10), var(--glass) 55%);
}

.skill-domain {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  color: var(--bp-blue);
}

.skill-name {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 8px 0 14px;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: auto;
}
.skill-tags i {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
}

/* ----- Development Style ----- */
.style-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.style-panel { padding: 32px; }

.panel-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 18px;
  padding-left: 14px;
  border-left: 3px solid var(--amber);
}

.spec-list { list-style: none; }
.spec-list li {
  position: relative;
  padding: 8px 0 8px 32px;
  border-bottom: 1px dashed var(--line);
  font-size: 0.94rem;
}
.spec-list li:last-child { border-bottom: none; }
/* 仕様書のチェックマーク */
.spec-list li::before {
  content: "[x]";
  position: absolute;
  left: 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--amber);
}

.panel-note {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

/* ----- Portfolio ----- */
.works-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.work-card {
  display: flex;
  flex-direction: column;
  padding: 26px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.work-card:hover { transform: translateY(-5px); border-color: var(--amber); }
.work-card:active { transform: translateY(-2px) scale(0.98); }

.work-title {
  font-size: 1.12rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.work-desc {
  color: var(--muted);
  font-size: 0.9rem;
  flex-grow: 1;
}

.work-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 18px;
}
.work-tags span {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--bp-blue);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
}

/* ----- Portfolio Apps ----- */
.apps-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.app-card { color: var(--ink); min-width: 0; }
.app-card:hover { text-decoration: none; }
.app-card:focus-visible { border-color: var(--amber); }
.app-card-head {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}
.app-card-head > div { min-width: 0; }
.app-card-head .eyebrow { overflow-wrap: anywhere; }
.app-card-head .work-title { margin-bottom: 0; }
.app-icon {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: var(--radius);
  overflow: hidden;
  clip-path: inset(0 round var(--radius));
}
.app-store-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--amber-bright);
  font-size: 0.9rem;
  font-weight: 500;
}

/* ----- Contact ----- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  max-width: 720px;
}

.contact-card {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 24px 28px;
  color: var(--ink);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.contact-card:hover {
  text-decoration: none;
  transform: translateY(-4px);
  border-color: var(--amber);
}

.contact-service {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--bp-blue);
}

.contact-handle { font-weight: 600; }

.contact-arrow {
  margin-left: auto;
  color: var(--amber);
  transition: transform 0.2s ease;
}
.contact-card:hover .contact-arrow { transform: translateX(5px); }

/* ----- Footer（図面タイトルブロック） ----- */
.site-footer {
  max-width: 1080px;
  margin: 96px auto 0;
  padding: 0 24px 40px;
}

.title-block {
  display: grid;
  grid-template-columns: 2fr 1.4fr 1fr 1.2fr;
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--bg-deep);
}
.tb-cell {
  padding: 12px 16px;
  border-right: 1px solid var(--line);
}
.tb-cell:last-child { border-right: none; }
.tb-label {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  color: var(--bp-blue);
  margin-bottom: 3px;
}

.footer-note {
  margin-top: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  font-family: var(--font-mono);
}

.footer-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

/* ----- Privacy page ----- */
.privacy-main {
  width: min(720px, 100%);
  min-height: calc(100vh - var(--header-h));
  margin: 0 auto;
  padding: 120px 24px 0;
}
.privacy-main .section-head h1 {
  position: relative;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  letter-spacing: 0.02em;
}
.privacy-main .section-head h1::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 64px;
  height: 2px;
  background: var(--amber);
}
.privacy-card { padding: 32px; }
.privacy-card section + section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.privacy-card h2 {
  margin-bottom: 8px;
  font-size: 1.1rem;
}
.privacy-card p,
.privacy-card li { color: var(--muted); }
.privacy-card p + p { margin-top: 16px; }
.privacy-card ul { padding-left: 24px; }
.privacy-card li + li { margin-top: 8px; }
.privacy-footer { margin-top: 72px; }

/* ----- スクロールリビール ----- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ----- Responsive ----- */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; gap: 24px; }
  .hero { min-height: auto; }
  .hero-figure { max-width: 440px; margin: 0 auto; }
  .about-grid { grid-template-columns: 1fr; }
  .about-chara { margin-top: -80px; }
  .skill-grid { grid-template-columns: repeat(2, 1fr); }
  .works-grid { grid-template-columns: repeat(2, 1fr); }
  .style-grid { grid-template-columns: 1fr; }
  .annot-1 { right: 0; }
  .annot-3 { left: 0; }
}

@media (max-width: 600px) {
  .section { padding-top: 72px; }
  .site-nav { gap: 16px; }
  .site-nav a:not(.nav-cta) { display: none; }
  .skill-grid { grid-template-columns: 1fr; }
  .works-grid { grid-template-columns: 1fr; }
  .annot { font-size: 0.64rem; }
  .annot-line, .annot-2::after, .annot-3::after { width: 20px; }
  .annot-hint { display: block; margin: 2px 0 0; }
  .title-block { grid-template-columns: 1fr 1fr; }
  .tb-cell { border-bottom: 1px solid var(--line); }
  .tb-cell:nth-child(2n) { border-right: none; }
  .tb-cell:nth-child(n+3) { border-bottom: none; }
  .privacy-main { padding: 96px 16px 0; }
  .privacy-card { padding: 24px 16px; }
}

/* ==========================================================================
   演出レイヤー（js/fx.js が生成する要素のスタイル）
   fx.js の読み込みを外せば、ここから下は何も表示されない
   ========================================================================== */

/* ----- アンビエント背景 ----- */
.fx-glow, .fx-canvas, .fx-vignette {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.fx-canvas { opacity: 0; transition: opacity 1.4s ease; }
html.fx-on .fx-canvas { opacity: 1; }

/* 奥でゆっくり漂う光（青 = 図面 / 琥珀 = ウイスキー） */
.fx-glow { overflow: hidden; }
.fx-glow::before, .fx-glow::after {
  content: "";
  position: absolute;
  width: 60vmax; height: 60vmax;
  border-radius: 50%;
  will-change: transform;
}
.fx-glow::before {
  top: -22vmax; left: -16vmax;
  background: radial-gradient(circle, rgba(83, 118, 165, 0.55), transparent 62%);
  opacity: 0.16;
  animation: fx-drift-a 30s ease-in-out infinite alternate;
}
.fx-glow::after {
  bottom: -26vmax; right: -18vmax;
  background: radial-gradient(circle, rgba(217, 160, 91, 0.5), transparent 62%);
  opacity: 0.1;
  animation: fx-drift-b 38s ease-in-out infinite alternate;
}
@keyframes fx-drift-a { to { transform: translate(14vmax, 10vmax) scale(1.15); } }
@keyframes fx-drift-b { to { transform: translate(-12vmax, -14vmax) scale(1.1); } }

/* 中心に視線を集めるビネット */
.fx-vignette {
  background: radial-gradient(ellipse at 50% 40%, transparent 52%, rgba(16, 21, 28, 0.5) 100%);
}

/* ----- カスタムカーソル（図面クロスヘア） ----- */
html.fx-cursor, html.fx-cursor * { cursor: none !important; }

.fx-cursor-layer {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}
html.fx-seen .fx-cursor-layer { opacity: 1; }

.fx-guide {
  position: fixed;
  background: rgba(132, 167, 207, 0.13);
  transition: opacity 0.22s ease;
}
/* ホバー中は十字ガイドを消してブラケットに視線を集める */
html.fx-hover .fx-guide { opacity: 0; }
.fx-guide-x { left: 0; right: 0; top: 0; height: 1px; }
.fx-guide-y { top: 0; bottom: 0; left: 0; width: 1px; }

.fx-dot {
  position: fixed;
  left: 0; top: 0;
  width: 5px; height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: var(--amber-bright);
}

.fx-ring {
  position: fixed;
  left: 0; top: 0;
  width: 32px; height: 32px;
  margin: -16px 0 0 -16px;
  border: 1px solid rgba(132, 167, 207, 0.6);
  border-radius: 50%;
  transition: width 0.22s ease, height 0.22s ease, margin 0.22s ease,
              border-color 0.22s ease, border-radius 0.22s ease;
}
/* ホバー時に現れるターゲットブラケットの四隅 */
.fx-ring i {
  position: absolute;
  width: 9px; height: 9px;
  border: 0 solid var(--amber);
  opacity: 0;
  transition: opacity 0.22s ease;
}
.fx-ring i:nth-child(1) { top: -1px; left: -1px; border-top-width: 1.5px; border-left-width: 1.5px; }
.fx-ring i:nth-child(2) { top: -1px; right: -1px; border-top-width: 1.5px; border-right-width: 1.5px; }
.fx-ring i:nth-child(3) { bottom: -1px; left: -1px; border-bottom-width: 1.5px; border-left-width: 1.5px; }
.fx-ring i:nth-child(4) { bottom: -1px; right: -1px; border-bottom-width: 1.5px; border-right-width: 1.5px; }

html.fx-hover .fx-ring {
  width: 44px; height: 44px;
  margin: -22px 0 0 -22px;
  border-color: transparent;
  border-radius: 10px;
}
html.fx-hover .fx-ring i { opacity: 1; }
html.fx-down .fx-ring { width: 24px; height: 24px; margin: -12px 0 0 -12px; }
html.fx-hover.fx-down .fx-ring { width: 36px; height: 36px; margin: -18px 0 0 -18px; }

.fx-coords {
  position: fixed;
  left: 0; top: 0;
  padding: 16px 0 0 18px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: rgba(151, 164, 180, 0.75);
  white-space: nowrap;
  transition: color 0.22s ease;
}
html.fx-hover .fx-coords { color: var(--amber); }

/* ----- スクロールルーラー（右端の現在地インジケータ） ----- */
.fx-ruler {
  position: fixed;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  height: min(320px, 48vh);
  width: 26px;
  z-index: 90;
  font-family: var(--font-mono);
}
.fx-ruler-line {
  position: absolute;
  right: 4px; top: 0; bottom: 0;
  width: 1px;
  background: var(--line);
}
.fx-ruler-mark {
  position: absolute;
  right: 1px;
  width: 7px; height: 1px;
  background: rgba(139, 164, 196, 0.55);
  transition: background 0.3s ease, width 0.3s ease;
}
.fx-ruler-mark.active { background: var(--amber); width: 10px; }
.fx-ruler-thumb {
  position: absolute;
  right: 1px;
  width: 7px; height: 7px;
  margin-top: -4px;
  border: 1px solid var(--amber);
  transform: rotate(45deg);
  background: var(--bg);
}
.fx-ruler-pct {
  position: absolute;
  right: 13px; top: -3px;
  transform: rotate(-45deg);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  color: var(--amber);
}

/* ----- ナビの現在地ハイライト ----- */
.site-nav a.active { color: var(--amber-bright); }

/* ----- スクロール連動の追い演出 ----- */
/* 見出し下線が視界に入ってから引かれる */
.section-head h2::after { width: 0; transition: width 0.9s cubic-bezier(0.6, 0, 0.2, 1) 0.25s; }
.section-head.visible h2::after { width: 64px; }

/* ----- オープニング（回路トンネルへのワープダイブ） ----- */
.fx-intro {
  position: fixed;
  inset: 0;
  z-index: 500; /* ルーラー(90)より上・カーソル(9999)より下 */
  background: #0e131a; /* fx.js の BG と同じ値にする */
  overflow: hidden;
  transition: opacity 3s ease;
}
html.fx-intro-leave .fx-intro { opacity: 0; pointer-events: none; }
.fx-intro canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* 走査線・粒子ノイズ・ビネット（ブラウン管越しに見ている質感） */
.fx-intro-scan {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(178, 208, 242, 0.05) 0 1px,
    transparent 1px 3px
  );
  mix-blend-mode: screen;
}
.fx-intro-scan::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 26%;
  background: linear-gradient(to bottom, transparent, rgba(140, 180, 230, 0.07), transparent);
  animation: fxScanSweep 3.6s linear infinite;
}
@keyframes fxScanSweep {
  from { transform: translateY(-40%); }
  to   { transform: translateY(380%); }
}
.fx-intro-noise {
  position: absolute;
  inset: -60px;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: fxNoiseShift 0.5s steps(3) infinite;
}
@keyframes fxNoiseShift {
  0%   { transform: translate(0, 0); }
  33%  { transform: translate(-18px, 12px); }
  66%  { transform: translate(14px, -16px); }
  100% { transform: translate(0, 0); }
}
.fx-intro-vig {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 50% 44%,
    transparent 32%,
    rgba(6, 9, 14, 0.5) 74%,
    rgba(4, 6, 10, 0.92) 100%
  );
}

/* 図面の外枠と対角のターゲットブラケット */
.fx-intro-frame {
  position: absolute;
  inset: 20px;
  pointer-events: none;
  border: 1px solid rgba(139, 164, 196, 0.14);
}
.fx-intro-frame::before,
.fx-intro-frame::after {
  content: "";
  position: absolute;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(217, 160, 91, 0.55);
}
.fx-intro-frame::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.fx-intro-frame::after  { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

/* 左右端の目盛り */
.fx-intro-ticks {
  position: absolute;
  left: 22px;
  top: 28%;
  bottom: 28%;
  width: 9px;
  pointer-events: none;
  opacity: 0.45;
  background: repeating-linear-gradient(
    to bottom,
    rgba(139, 164, 196, 0.7) 0 1px,
    transparent 1px 14px
  );
}
.fx-intro-ticks.is-right { left: auto; right: 22px; }

.fx-intro-tag {
  position: absolute;
  top: 34px;
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.28em;
  color: rgba(151, 164, 180, 0.75);
}
.fx-intro-tag.is-left  { left: 42px; }
.fx-intro-tag.is-right { right: 42px; color: rgba(217, 160, 91, 0.8); }

/* 起動ログ（最新行だけ琥珀で光る） */
.fx-intro-log {
  position: absolute;
  left: 42px;
  bottom: 40px;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  line-height: 2;
  letter-spacing: 0.06em;
  color: rgba(132, 167, 207, 0.65);
}
.fx-intro-log p { animation: fxLogIn 0.45s ease both; }
.fx-intro-log p:last-child { color: var(--amber-bright); }
@keyframes fxLogIn {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: none; }
}

.fx-intro-label {
  position: absolute;
  left: 50%;
  bottom: 15%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: clamp(0.88rem, 2.4vw, 1.3rem);
  letter-spacing: 0.42em;
  text-indent: 0.42em; /* 字間の分だけ右に寄るのを戻す */
  color: var(--amber-bright);
  white-space: nowrap;
  text-shadow: 0 0 18px rgba(217, 160, 91, 0.55), 0 0 46px rgba(217, 160, 91, 0.22);
}
.fx-intro-bar {
  position: absolute;
  left: 50%;
  bottom: calc(15% - 20px);
  transform: translateX(-50%);
  width: min(300px, 48vw);
  height: 2px;
  overflow: hidden;
  background: rgba(139, 164, 196, 0.18);
}
.fx-intro-bar i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, rgba(132, 167, 207, 0.55), var(--amber-bright));
  box-shadow: 0 0 12px rgba(217, 160, 91, 0.7);
}
.fx-intro-hint {
  position: absolute;
  right: 22px;
  bottom: 18px;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  color: rgba(151, 164, 180, 0.6);
  animation: fxHintPulse 2.6s ease-in-out infinite;
}
@keyframes fxHintPulse {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 0.95; }
}

@media (max-width: 620px) {
  .fx-intro-ticks, .fx-intro-tag { display: none; }
  .fx-intro-frame { inset: 12px; }
  .fx-intro-log { left: 22px; bottom: 30px; font-size: 0.5rem; }
  /* 縦が狭いのでログはカウンターに掛からない最新3行だけにする */
  .fx-intro-log p:nth-last-child(n + 4) { display: none; }
}

/* 突入中はスクロールを止める。fx-intro-hold が外れると着地が始まる */
html.fx-intro-hold { overflow: hidden; }
html.fx-intro-hold .site-header { opacity: 0; transform: translateY(-14px); }
html.fx-intro-hold .hero { opacity: 0; transform: scale(1.07); filter: blur(12px); }
html.fx-intro-land .site-header {
  transition: opacity 0.7s ease 0.35s, transform 0.7s ease 0.35s;
}
html.fx-intro-land .hero {
  filter: blur(0px); /* blur を明示しないと補間されない */
  transition: opacity 0.7s ease, transform 1.2s cubic-bezier(0.2, 0.7, 0.2, 1), filter 0.95s ease;
}

@media (max-width: 900px) {
  .fx-ruler { display: none; }
}

/* ----- 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;
  }
  .reveal { opacity: 1; transform: none; }
  .caret, .brand-cursor { animation: none; }
}
