/*
 * PROCEBO 260410 — DESIGN IS SCIENCE
 * Palette: Black / White / Blood Orange — No Green
 * WCAG AA compliant contrast on #000 background
 * See: DESIGN.md
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Noto+Sans+JP:wght@300;400;500;600;700;800;900&display=swap');

/* ── Variables ── */
/* Contrast ratios on #000:
   --c-main    #FFFFFF = 21:1   ✓ AAA
   --c-sub     #999999 = 5.42:1 ✓ AA (all sizes)
   --c-mute    #666666 = 3.86:1 ✓ AA large text only (18px+ / 14px+ bold)
   --c-accent  #E84422 = 4.63:1 ✓ AA (all sizes)
   --c-danger  #FF5555 = 5.29:1 ✓ AA (all sizes)
*/
:root {
  --c-base:        #000000;
  --c-main:        #FFFFFF;
  --c-accent:      #E84422;
  --c-accent-soft: rgba(232,68,34,0.10);
  --c-accent-mid:  rgba(232,68,34,0.20);
  --c-sub:         #999999;
  --c-mute:        #666666;
  --c-border:      rgba(255,255,255,0.10);
  --c-surface:     #0C0C0C;
  --c-surface2:    #161616;
  --c-danger:      #FF5555;
  --c-code-bg:     #0A0A0A;
  --font-main:     'Inter', 'Noto Sans JP', sans-serif;
  --font-mono:     'JetBrains Mono', 'Fira Code', monospace;
  --card-radius:   0;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: var(--c-base);
  font-family: var(--font-main);
  color: var(--c-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Text Wrap ── */
:lang(ja) { line-break: strict; }
.slide-hero, .slide-h1, .slide-h2, .slide-h3 {
  word-break: normal; overflow-wrap: normal;
  text-wrap: balance; line-break: strict;
}
.slide-title, .slide-body, .slide-caption, li, blockquote {
  word-break: normal; overflow-wrap: normal;
  text-wrap: pretty; line-break: strict;
}
.nowrap-label { white-space: nowrap; }

/* ── Typography Scale ──
   Min readable: caption 1.3cqw (~21px on 1600w)
   --c-mute(#666) は slide-h3(2.4cqw=38px+) 以上にのみ使用可
   それ以下のサイズは --c-sub(#999) 以上を使う
*/
.slide-hero    { font-size: 8cqw;  font-weight: 900; line-height: 0.95; letter-spacing: -0.04em; }
.slide-h1      { font-size: 5cqw;  font-weight: 800; line-height: 1.0;  letter-spacing: -0.03em; }
.slide-h2      { font-size: 3.4cqw; font-weight: 700; line-height: 1.08; letter-spacing: -0.02em; }
.slide-h3      { font-size: 2.4cqw; font-weight: 600; line-height: 1.2;  letter-spacing: -0.01em; }
.slide-title   { font-size: 1.8cqw; font-weight: 500; line-height: 1.4;  letter-spacing: 0.01em;  }
.slide-body    { font-size: 1.6cqw; font-weight: 400; line-height: 1.65; letter-spacing: 0.01em;  }
.slide-caption { font-size: 1.3cqw; font-weight: 400; line-height: 1.5;  letter-spacing: 0.02em;  }

/* ── Color Utilities ── */
.c-accent  { color: var(--c-accent); }
.c-sub     { color: var(--c-sub);    }
.c-mute    { color: var(--c-mute);   }
.c-danger  { color: var(--c-danger); }
.c-main    { color: var(--c-main);   }

/* ── Stage ── */
.slide-stage {
  width: 100vw; height: 100vh;
  display: grid; place-items: center;
  background: var(--c-base);
  position: relative;
}

/* ── Slide ── */
.slide {
  container-type: size; container-name: slide;
  width: 100vw; height: 100vh;
  max-width: calc(100vh * 16 / 9);
  max-height: calc(100vw * 9 / 16);
  margin: auto;
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.985);
  overflow: hidden;
  background: var(--c-base);
  display: flex; flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.slide.active {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

/* Top accent line */
.slide::before {
  content: ''; display: block;
  height: 2px;
  background: linear-gradient(90deg, var(--c-accent) 0%, transparent 100%);
  flex-shrink: 0;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1) 0.2s;
}
.slide.active::before {
  transform: scaleX(1);
}
.slide.bridge::before,
.slide.slide-cover::before { display: none; }

/* ── Slide Content ──
   デフォルト: 上下左右センター + 全幅
*/
.slide-content {
  flex: 1; display: flex; flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 3.5cqw 6cqw;
  overflow: hidden;
  width: 100%;
}
/* 全幅を使うためグリッド・カラムも100% */
.slide-content > * { width: 100%; }
/* テキスト中央寄せのスライド用 */
.slide-content.tc { text-align: center; }
.slide-content.tc > * { display: flex; flex-direction: column; align-items: center; }

/* ── Card ── */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--card-radius);
  padding: 1.6cqw 2cqw;
}

/* ── Grid Layouts (全幅) ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr;         gap: 1.2cqw; align-items: stretch; width: 100%; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr;     gap: 1.2cqw; align-items: stretch; width: 100%; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 1cqw;   align-items: stretch; width: 100%; }
.lr     { display: grid; grid-template-columns: 1fr 1fr;         gap: 3cqw;   align-items: center;  width: 100%; }
.lr-6-4 { display: grid; grid-template-columns: 6fr 4fr;         gap: 3cqw;   align-items: center;  width: 100%; }
.lr-4-6 { display: grid; grid-template-columns: 4fr 6fr;         gap: 3cqw;   align-items: center;  width: 100%; }

/* ── Code Block ── */
.code-block {
  background: var(--c-code-bg);
  border-left: 2px solid var(--c-accent);
  border-radius: 0;
  padding: 1.2cqw 1.6cqw;
  font-family: var(--font-mono);
  font-size: 1.2cqw;
  color: var(--c-sub);
  line-height: 1.8;
  white-space: pre;
  overflow: hidden;
}
.code-block .c-comment { color: var(--c-mute); }
.code-block .c-key     { color: var(--c-sub); }
.code-block .c-val     { color: var(--c-accent); }
.code-block .c-sec     { color: var(--c-main); font-weight: 700; }

/* ── Badge ── */
.badge {
  display: inline-block;
  padding: 0.3cqw 0.8cqw;
  border-radius: 0;
  font-size: 1.1cqw; font-weight: 700;
  letter-spacing: 0.06em;
}
.badge-accent { background: var(--c-accent); color: #FFFFFF; }
.badge-orange { background: var(--c-accent); color: #FFFFFF; }
.badge-danger { background: var(--c-danger); color: #000000; }
.badge-sub    { background: var(--c-surface2); color: var(--c-sub); border: 1px solid var(--c-border); }
.badge-white  { background: #FFFFFF; color: #000000; }

/* ── Divider ── */
.divider {
  width: 4cqw; height: 2px;
  background: var(--c-accent);
  flex-shrink: 0;
}
.divider-wide { width: 100%; height: 1px; background: var(--c-border); }

/* ── Num Tag ── */
.num-tag {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.6cqw; height: 2.6cqw;
  border-radius: 50%;
  background: var(--c-accent); color: #FFFFFF;
  font-size: 1.2cqw; font-weight: 700; flex-shrink: 0;
}
.num-tag-outline {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.6cqw; height: 2.6cqw;
  border-radius: 50%;
  background: transparent; color: var(--c-main);
  border: 1px solid var(--c-border);
  font-size: 1.2cqw; font-weight: 700; flex-shrink: 0;
}

/* ── Highlight Box ── */
.hl-box {
  background: var(--c-accent-soft);
  border: 1px solid var(--c-accent-mid);
  border-radius: var(--card-radius);
  padding: 1.4cqw 1.8cqw;
}

/* ── Bridge Slide ── */
.slide.bridge {
  background:
    radial-gradient(circle at 75% 25%, rgba(255,255,255,0.08) 0%, transparent 50%),
    linear-gradient(135deg, #E84422 0%, #991100 100%);
}
.slide.bridge .slide-content { justify-content: center; align-items: center; text-align: center; }

/* ── Cover Slide ── */
.slide.slide-cover { background: var(--c-base); }

/* ── Flow Arrow ── */
.arrow-right {
  display: flex; align-items: center; justify-content: center;
  color: var(--c-sub); font-size: 2cqw; font-weight: 300;
  flex-shrink: 0;
}

/* ── Section Label ──
   大きいサイズ(1.1cqw=~18px)でbold → #666(3.86:1)はWCAG AA large text OK
*/
.s-label {
  font-size: 1.2cqw; font-weight: 700;
  letter-spacing: 0.2em; color: var(--c-sub);
  text-transform: uppercase;
  margin-bottom: 0.3cqw;
}

/* ── Underline Accent ── */
.u-accent {
  text-decoration: underline;
  text-decoration-color: var(--c-accent);
  text-underline-offset: 0.15em;
  text-decoration-thickness: 2px;
}

/* ── List ── */
.sl-list {
  list-style: none;
  display: flex; flex-direction: column; gap: 0.8cqw;
}
.sl-list li {
  display: flex; align-items: flex-start; gap: 0.8cqw;
  font-size: 1.6cqw;
}
.sl-list li::before {
  content: ''; width: 0.5cqw; height: 0.5cqw;
  background: var(--c-accent); border-radius: 50%;
  flex-shrink: 0; margin-top: 0.5em;
}

/* ── Quote ── */
.quote-block {
  border-left: 2px solid var(--c-accent);
  padding-left: 1.5cqw;
}

/* ── Big Number ── */
.big-num {
  font-size: 5cqw; font-weight: 900;
  color: var(--c-accent); letter-spacing: -0.03em;
  line-height: 0.9;
}
.big-num-white {
  font-size: 5cqw; font-weight: 900;
  color: var(--c-main); letter-spacing: -0.03em;
  line-height: 0.9;
}

/* ── Step row ── */
.step-row { display: flex; align-items: flex-start; gap: 1.2cqw; }

/* ── Stat Block ── */
.stat-block {
  display: flex; flex-direction: column; gap: 0.4cqw;
}
.stat-value {
  font-size: 5cqw; font-weight: 900;
  color: var(--c-accent); letter-spacing: -0.04em;
  line-height: 0.9;
}
.stat-label {
  font-size: 1.3cqw; font-weight: 500;
  color: var(--c-sub); letter-spacing: 0.03em;
}

/* ── NG/OK comparison ── */
.vs-ng { border-left: 2px solid var(--c-danger); padding-left: 1.2cqw; }
.vs-ok { border-left: 2px solid var(--c-main); padding-left: 1.2cqw; }

/* ── Q&A Card ── */
.qa-q { display: flex; align-items: flex-start; gap: 1cqw; }
.qa-a { padding-left: 2.6cqw; }

/* ── Gap Utilities ── */
.gap-xs { gap: 0.5cqw; }
.gap-sm { gap: 0.8cqw; }
.gap-md { gap: 1.2cqw; }
.gap-lg { gap: 2cqw; }
.gap-xl { gap: 3cqw; }
.mt-xs  { margin-top: 0.5cqw; }
.mt-sm  { margin-top: 0.8cqw; }
.mt-md  { margin-top: 1.2cqw; }
.mt-lg  { margin-top: 2cqw; }
.mt-xl  { margin-top: 3cqw; }
.mb-sm  { margin-bottom: 0.8cqw; }
.mb-md  { margin-bottom: 1.2cqw; }

/* ── Flex Utilities ── */
.col    { display: flex; flex-direction: column; }
.row    { display: flex; flex-direction: row; }
.center { align-items: center; justify-content: center; }
.ac     { align-items: center; }
.jc     { justify-content: center; }
.jb     { justify-content: space-between; }
.w-full { width: 100%; }

/* ── Nav Bar ── */
.nav-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 40px;
  background: rgba(0,0,0,0.96);
  border-top: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  z-index: 200;
  backdrop-filter: blur(12px);
}
.nav-btn {
  background: none;
  border: 1px solid var(--c-border);
  color: var(--c-sub);
  padding: 4px 14px; border-radius: 4px;
  cursor: pointer; font-family: var(--font-main); font-size: 13px;
  transition: color 0.15s, border-color 0.15s;
}
.nav-btn:hover  { color: var(--c-main); border-color: rgba(255,255,255,0.2); }
.nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.nav-center { display: flex; align-items: center; gap: 12px; }
.nav-counter { font-size: 13px; color: var(--c-sub); min-width: 60px; text-align: center; font-variant-numeric: tabular-nums; }
.nav-progress { width: 120px; height: 2px; background: var(--c-surface2); border-radius: 1px; overflow: hidden; }
.nav-progress-fill { height: 100%; background: var(--c-accent); transition: width 0.3s ease; }
.hamburger {
  background: none; border: none; color: var(--c-sub);
  cursor: pointer; font-size: 18px; padding: 4px 8px;
  display: flex; align-items: center;
  transition: color 0.15s;
}
.hamburger:hover { color: var(--c-main); }

/* ── Sidebar ── */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 40px;
  width: 260px;
  background: rgba(0,0,0,0.98);
  border-right: 1px solid var(--c-border);
  z-index: 300;
  transform: translateX(-260px);
  transition: transform 0.2s ease;
  overflow-y: auto;
  backdrop-filter: blur(16px);
}
.sidebar.open { transform: translateX(0); }
.sidebar-backdrop {
  position: fixed; inset: 0; bottom: 40px;
  background: rgba(0,0,0,0.6); z-index: 299; display: none;
}
.sidebar-backdrop.show { display: block; }
.sidebar-list { list-style: none; padding: 12px 0; }
.sidebar-item {
  display: block; padding: 9px 16px;
  font-size: 13px; color: var(--c-sub); cursor: pointer;
  transition: background 0.1s, color 0.1s;
  border: none; background: none; width: 100%;
  text-align: left; font-family: var(--font-main); line-height: 1.4;
}
.sidebar-item:hover  { background: var(--c-surface); color: var(--c-main); }
.sidebar-item.active { color: var(--c-accent); background: rgba(232,68,34,0.08); }
.sidebar-num { display: inline-block; width: 24px; font-size: 11px; color: var(--c-sub); margin-right: 4px; font-variant-numeric: tabular-nums; }
.sidebar-item.active .sidebar-num { color: var(--c-accent); }

/* ── Stage Vignette ── */
.slide-stage::after {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 100;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.3) 100%);
}

/* ── Entrance Animation ── */
@keyframes slideEnter {
  from { opacity: 0; transform: translateY(1cqw); }
  to   { opacity: 1; transform: translateY(0); }
}
.slide.active > .slide-content > * {
  animation: slideEnter 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}
.slide.active > .slide-content > *:nth-child(1) { animation-delay: 0.06s; }
.slide.active > .slide-content > *:nth-child(2) { animation-delay: 0.14s; }
.slide.active > .slide-content > *:nth-child(3) { animation-delay: 0.22s; }
.slide.active > .slide-content > *:nth-child(4) { animation-delay: 0.30s; }
.slide.active > .slide-content > *:nth-child(5) { animation-delay: 0.38s; }

/* ── Block Reveal ── */
@keyframes blockRevealClip {
  0%   { clip-path: inset(0 100% 0 0); }
  45%  { clip-path: inset(0 0 0 0); }
  100% { clip-path: inset(0 0 0 0); }
}
@keyframes blockRevealBar {
  0%   { left: 0; right: 100%; }
  45%  { left: 0; right: 0; }
  100% { left: 100%; right: 0; }
}

.slide.active > .slide-content > * > .slide-h1,
.slide.active > .slide-content > * > .slide-h2 {
  position: relative;
  width: fit-content;
  margin-inline: auto;
  clip-path: inset(0 100% 0 0);
  animation: blockRevealClip 0.9s cubic-bezier(0.77, 0, 0.175, 1) 0.15s forwards;
}
.slide.active > .slide-content > * > .slide-h1::after,
.slide.active > .slide-content > * > .slide-h2::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: 0; right: 100%;
  background: var(--c-accent);
  animation: blockRevealBar 0.9s cubic-bezier(0.77, 0, 0.175, 1) 0.15s forwards;
}

/* ── Cover / Closing Background ── */
.cover-bg {
  position: absolute; inset: 0; z-index: 0; overflow: hidden;
}
.cover-grid {
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(90deg,  rgba(255,255,255,0.02) 0px, rgba(255,255,255,0.02) 1px, transparent 1px, transparent 100px),
    repeating-linear-gradient(0deg,   rgba(255,255,255,0.02) 0px, rgba(255,255,255,0.02) 1px, transparent 1px, transparent 100px);
}
.cover-glow {
  position: absolute; border-radius: 50%; filter: blur(80px);
}
.cover-glow--accent {
  bottom: -20%; right: -10%; width: 60%; height: 60%;
  background: radial-gradient(circle, rgba(232,68,34,0.15) 0%, transparent 70%);
  animation: coverPulse 8s ease-in-out infinite;
}
.cover-glow--white {
  top: -15%; left: -5%; width: 40%; height: 40%;
  background: radial-gradient(circle, rgba(255,255,255,0.04) 0%, transparent 70%);
}
@keyframes coverPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.7; transform: scale(1.1); }
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  .slide { transition-duration: 0.01ms !important; }
  .slide::before { transition-duration: 0.01ms !important; }
  .slide.active > .slide-content > * {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
  }
  .cover-glow--accent { animation: none; }
  .slide.active > .slide-content > * > .slide-h1,
  .slide.active > .slide-content > * > .slide-h2 {
    clip-path: none;
    animation: none;
  }
  .slide.active > .slide-content > * > .slide-h1::after,
  .slide.active > .slide-content > * > .slide-h2::after {
    animation: none;
    display: none;
  }
}

/* ── Selection ── */
::selection {
  background: rgba(232,68,34,0.35);
  color: #FFFFFF;
}
