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

:root {
  --bg: #08080e;
  --bg-card: rgba(255,255,255,0.03);
  --bg-card-hover: rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.08);
  --text: #c8c8d4;
  --text-dim: #6a6a7a;
  --accent: #00e5ff;
  --accent2: #ff4081;
  --accent3: #b388ff;
  --success: #69f0ae;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  --max-w: 960px;
  --gap: 2rem;
}

html {
  scroll-behavior: smooth;
  scroll-snap-type: y proximity;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  position: relative;
}

/* ── Canvas Background ── */
#wave-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.35;
  pointer-events: none;
}

/* ── GitHub Corner Link ── */
.github-link {
  position: fixed;
  top: 1.25rem;
  right: 1.5rem;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(8, 8, 14, 0.7);
  backdrop-filter: blur(8px);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.github-link:hover {
  color: #fff;
  border-color: var(--accent);
  background: rgba(0, 229, 255, 0.08);
}

.github-link .gh-icon {
  flex-shrink: 0;
}

/* ── Main Container ── */
#app {
  position: relative;
  z-index: 1;
}

/* ── Panels ── */
.panel {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: start;
  padding: 4rem 2rem;
  position: relative;
}

.panel-inner {
  width: 100%;
  max-width: var(--max-w);
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.panel.visible .panel-inner {
  opacity: 1;
  transform: translateY(0);
}

/* ── Section Tag ── */
.section-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.25em 1em;
  border-radius: 100px;
  margin-bottom: 1.5rem;
}

h2 {
  font-size: 2.5rem;
  font-weight: 300;
  letter-spacing: -0.02em;
  margin-bottom: 2rem;
  color: #fff;
  line-height: 1.2;
}

/* ── Site Logo (fixed top-left) ── */
.site-logo {
  position: fixed;
  top: 1.25rem;
  left: 1.5rem;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(8, 8, 14, 0.7);
  backdrop-filter: blur(8px);
  transition: border-color 0.2s, background 0.2s;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.site-logo svg {
  display: block;
  width: 24px;
  height: 24px;
}

.site-logo:hover {
  border-color: var(--accent);
  background: rgba(0, 229, 255, 0.08);
}
#hero {
  flex-direction: column;
  text-align: center;
  justify-content: space-between;
  background: url('../images/masked-bg.jpg') center/cover no-repeat;
  position: relative;
  padding-bottom: 5rem;
}

#hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(8,8,14,0.5) 0%, rgba(8,8,14,0.85) 100%);
  z-index: 0;
}

#hero > * {
  position: relative;
  z-index: 1;
}

.hero-content {
  opacity: 0;
  animation: heroFadeIn 1.5s ease forwards 0.3s;
}

@keyframes heroFadeIn {
  to { opacity: 1; }
}

.title {
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 200;
  color: #fff;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
  position: relative;
  display: inline-block;
}

.title.glitch::after {
  content: attr(data-text);
  position: absolute;
  left: 2px;
  top: 0;
  color: var(--accent2);
  opacity: 0.5;
  animation: glitchSkew 2s infinite;
  clip-path: inset(65% 0 25% 0);
}

.title.glitch::before {
  content: attr(data-text);
  position: absolute;
  left: -2px;
  top: 0;
  color: var(--accent);
  opacity: 0.5;
  animation: glitchSkew 2s infinite reverse;
  clip-path: inset(25% 0 65% 0);
}

@keyframes glitchSkew {
  0%, 100% { transform: none; }
  20% { transform: translate(2px, -1px); }
  40% { transform: translate(-2px, 1px); }
  60% { transform: translate(-1px, -1px); }
  80% { transform: translate(1px, 1px); }
}

.subtitle {
  font-size: 1.15rem;
  color: var(--text-dim);
  margin-bottom: 3rem;
  font-weight: 300;
  letter-spacing: 0.05em;
}

/* ── Buttons ── */
.btn {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  padding: 0.75rem 2rem;
  font-size: 0.9rem;
  font-family: var(--font);
  cursor: pointer;
  border-radius: 100px;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn:hover {
  border-color: var(--accent);
  background: rgba(0,229,255,0.08);
  color: #fff;
}

.btn-primary {
  border-color: var(--accent);
  color: var(--accent);
  font-size: 1rem;
  padding: 0.85rem 2.5rem;
}

.btn-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  justify-content: center;
  padding: 0;
  font-size: 1.2rem;
}

/* Fix icon baseline in buttons */
.btn .btn-icon {
  width: auto;
  height: auto;
  border-radius: 0;
  font-size: 0.9em;
  vertical-align: middle;
  line-height: 1;
}

/* Scroll hint */
.scroll-hint {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  animation: bounce 2s infinite;
  z-index: 1;
}

.scroll-hint span {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.4;
}

.scroll-hint span:nth-child(2) { opacity: 0.6; }
.scroll-hint span:nth-child(3) { opacity: 0.8; }

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}

/* ── Philosophy ── */
blockquote {
  border-left: 2px solid var(--accent);
  padding: 1rem 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  font-size: 1.1rem;
  color: var(--text-dim);
}

blockquote cite {
  font-style: normal;
  font-size: 0.85rem;
  color: var(--text-dim);
  opacity: 0.7;
}

.lead {
  font-size: 1.2rem;
  color: var(--accent);
  margin-bottom: 2.5rem;
}

.philosophy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.phil-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  transition: border-color 0.3s, background 0.3s;
}

.phil-card:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
}

.phil-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--accent);
}

.phil-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.75rem;
}

.phil-card p {
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.6;
}

.phil-card em {
  color: var(--accent);
  font-style: normal;
}

/* ── Flow Sections ── */
.flow-section {
  margin-bottom: 3rem;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.flow-section:last-child { margin-bottom: 0; }

.flow-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: #fff;
}

.flow-encode { color: var(--accent); }
.flow-mask { color: var(--accent3); }
.flow-decode { color: var(--accent2); }

.flow-section p {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.flow-viz {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.flow-node {
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  min-width: 70px;
}

.flow-arrow {
  font-size: 1.3rem;
  color: var(--accent);
  font-weight: 300;
}

/* ── Sample Player ── */
.sample-note {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 2rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-style: italic;
}

.sample-note strong {
  font-style: normal;
  color: #fff;
}

.sample-player {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2.5rem;
}

.player-visual {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  height: 100px;
  margin-bottom: 1rem;
}

.viz-bar {
  width: 6px;
  background: var(--accent);
  border-radius: 3px;
  transition: height 0.05s linear;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.player-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.track-name {
  font-size: 0.85rem;
  color: #fff;
}

.track-time {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* ── Player Switch ── */
.player-switch {
  margin-left: auto;
}

.btn-switch {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  font-family: var(--font);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-switch:hover:not(:disabled) {
  border-color: var(--accent);
  color: #fff;
  background: rgba(0,229,255,0.08);
}

.btn-switch.active {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-switch:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-switch .switch-arrow {
  font-size: 0.9rem;
  color: var(--accent3);
}

.switch-label {
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

/* ── Loading Progress ── */
.loading-progress {
  margin-top: 1rem;
  text-align: center;
}

.load-bar-track {
  height: 3px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.load-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent3));
  border-radius: 3px;
  transition: width 0.3s ease;
}

.load-text {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.loading-progress.done .load-bar-fill {
  background: var(--success);
}

.loading-progress.done .load-text {
  color: var(--success);
}

/* ── Sample Files ── */
.sample-files {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

.sample-files h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 1rem;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.file-link {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.file-link:hover {
  background: rgba(0,229,255,0.06);
  border-color: var(--accent);
  color: #fff;
}

.file-desc {
  font-family: var(--font);
  color: var(--text-dim);
  font-size: 0.75rem;
}

/* ── Disabled button ── */
.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn:disabled:hover {
  border-color: var(--border);
  background: var(--bg-card);
  color: var(--text);
}

/* ── Hash Grid ── */
.hash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.hash-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

.hash-card h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 1rem;
}

.hash-pair {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.hash-item {
  flex: 1;
}

.hash-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.25rem;
}

.hash-value {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  display: block;
}

.hash-match {
  font-size: 1.5rem;
  color: var(--success);
}

.hash-verdict {
  font-size: 0.8rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
}

.hash-verdict.success {
  color: var(--success);
  background: rgba(105,240,174,0.05);
  border: 1px solid rgba(105,240,174,0.2);
}

.verify-cmd {
  text-align: center;
  margin-top: 1rem;
}

.verify-cmd p {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.verify-cmd code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: rgba(0,229,255,0.05);
  border: 1px solid var(--border);
  padding: 0.6em 1.2em;
  border-radius: 6px;
  color: var(--accent);
  display: inline-block;
}

/* ── Command Grid ── */
.cmd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.cmd-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  transition: border-color 0.3s;
}

.cmd-card:hover {
  border-color: var(--accent);
}

.cmd-card h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.cmd-card code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text);
  display: block;
  margin-bottom: 0.5rem;
  word-break: break-all;
}

.cmd-card p {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.cmd-card p code {
  display: inline;
  font-size: 0.75rem;
  color: var(--accent);
}

.formats {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.formats strong {
  color: var(--accent);
}

/* ── Footer ── */
#footer {
  min-height: 40vh;
}

.footer-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  margin-top: 0.5rem;
}

.footer-logo {
  width: 20px;
  height: 20px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  flex-shrink: 0;
  align-self: center;
  margin-top: 0.5rem;
}

.footer-title {
  font-size: 2rem;
  font-weight: 200;
  color: #fff;
  margin-bottom: 0;
}

.footer-by {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.footer-by a {
  color: var(--accent);
  text-decoration: none;
}

.footer-by a:hover {
  text-decoration: underline;
}

.footer-credit {
  font-size: 0.75rem;
  color: var(--text-dim);
  opacity: 0.5;
  margin-bottom: 0.5rem;
}

.footer-credit a {
  color: var(--accent3);
  text-decoration: none;
}

.footer-credit a:hover {
  text-decoration: underline;
  color: var(--accent);
}

.footer-license {
  font-size: 0.75rem;
  color: var(--text-dim);
  opacity: 0.6;
}

/* ── Responsive: Tablet ── */
@media (max-width: 768px) {
  html { scroll-snap-type: none; }

  .panel {
    min-height: auto;
    padding: 3.5rem 1.25rem;
  }

  h2 { font-size: 1.7rem; margin-bottom: 1.5rem; }

  /* Hero */
  .title { font-size: clamp(2.2rem, 10vw, 4rem); }
  .subtitle { font-size: 0.95rem; margin-bottom: 2rem; }

  /* Philosophy */
  blockquote { font-size: 0.95rem; padding: 0.75rem 1rem; margin: 1.5rem 0; }
  .lead { font-size: 1rem; margin-bottom: 1.5rem; }
  .philosophy-grid { grid-template-columns: 1fr; gap: 1rem; }
  .phil-card { padding: 1.5rem; }
  .phil-icon { font-size: 1.6rem; }

  /* Flow sections */
  .flow-section { padding: 1.5rem; margin-bottom: 2rem; }
  .flow-viz { gap: 0.4rem; }
  .flow-node { font-size: 0.7rem; padding: 0.4rem 0.6rem; min-width: 55px; }

  /* Flow showcase */
  .flow-showcase { gap: 1.5rem; }
  .flow-img-sm { max-width: 220px; }
  .flow-desc { max-width: 320px; font-size: 0.75rem; line-height: 1.6; }

  /* Sample player */
  .player-controls { flex-wrap: wrap; gap: 0.75rem; }
  .player-switch { margin-left: 0; }
  .sample-note { font-size: 0.78rem; padding: 0.75rem 1rem; }

  /* Hash grid */
  .hash-grid { grid-template-columns: 1fr; gap: 1rem; }
  .hash-card { padding: 1.25rem; }
  .hash-pair { flex-wrap: wrap; gap: 0.5rem; }
  .hash-match { font-size: 1.2rem; }

  /* Verify cmd */
  .verify-cmd code { font-size: 0.7rem; padding: 0.5rem 0.75rem; word-break: break-all; }

  /* Command grid */
  .cmd-grid { grid-template-columns: 1fr; gap: 0.75rem; }
  .cmd-card code { font-size: 0.7rem; }

  /* Footer */
  #footer { min-height: 30vh; }
  .footer-logo { width: 16px; height: 16px; }
  .footer-title { font-size: 1.6rem; }
}

/* ── Responsive: Phone ── */
@media (max-width: 480px) {
  .github-link span { display: none; }
  .github-link { padding: 0.5rem; font-size: 0; top: 0.75rem; right: 0.75rem; }
  .site-logo { padding: 0.3rem; top: 0.75rem; left: 0.75rem; }
  .site-logo svg { width: 20px; height: 20px; }

  .panel { padding: 2.5rem 1rem; }

  h2 { font-size: 1.4rem; }
  .section-tag { font-size: 0.65rem; padding: 0.2em 0.8em; margin-bottom: 1rem; }

  /* Hero */
  .title { font-size: clamp(1.8rem, 12vw, 3rem); }
  .subtitle { font-size: 0.8rem; margin-bottom: 1.5rem; }
  .btn-primary { font-size: 0.9rem; padding: 0.7rem 1.8rem; }

  /* Philosophy */
  blockquote { font-size: 0.85rem; }
  blockquote cite { font-size: 0.75rem; }
  .lead { font-size: 0.9rem; }

  /* Flow sections */
  .flow-section { padding: 1.25rem; margin-bottom: 1.5rem; }
  .flow-section p { font-size: 0.8rem; }
  .flow-viz { gap: 0.3rem; }
  .flow-node { font-size: 0.65rem; padding: 0.3rem 0.5rem; min-width: 45px; border-radius: 6px; }
  .flow-arrow { font-size: 1rem; }

  /* Flow showcase — stack vertically */
  .flow-showcase {
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
  }
  .flow-img-sm { max-width: 100%; }
  .flow-desc { max-width: 100%; font-size: 0.75rem; }
  .flow-desc ul { margin-left: 1rem; }

  /* Sample player */
  .sample-player { padding: 1rem; }
  .player-visual { height: 70px; gap: 2px; }
  .viz-bar { width: 4px; }
  .player-controls { justify-content: center; }
  .player-switch { width: 100%; text-align: center; }
  .btn-switch { width: 100%; justify-content: center; font-size: 0.75rem; }
  .track-name { font-size: 0.75rem; }
  .sample-note { font-size: 0.72rem; line-height: 1.6; }

  /* Sample files */
  .sample-files { padding: 1rem; }
  .file-link { font-size: 0.7rem; padding: 0.4rem 0.5rem; }
  .file-desc { font-size: 0.68rem; display: block; }

  /* Hash cards */
  .hash-card { padding: 1rem; }
  .hash-card h3 { font-size: 0.8rem; }
  .hash-value { font-size: 0.7rem; }
  .hash-verdict { font-size: 0.7rem; padding: 0.4rem 0.6rem; }

  /* Verify */
  .verify-cmd code { font-size: 0.65rem; padding: 0.4rem 0.6rem; display: block; }

  /* Command cards */
  .cmd-card { padding: 1rem; }
  .cmd-card h3 { font-size: 0.8rem; }
  .cmd-card code { font-size: 0.68rem; }
  .cmd-card p { font-size: 0.72rem; }
  .formats { font-size: 0.78rem; }

  /* Footer */
  #footer { min-height: 25vh; }
  .footer-logo { width: 14px; height: 14px; }
  .footer-title { font-size: 1.3rem; }
  .footer-by { font-size: 0.75rem; }
  .footer-credit { font-size: 0.68rem; }
  .footer-license { font-size: 0.7rem; }

  /* Buttons */
  .btn { font-size: 0.8rem; padding: 0.6rem 1.4rem; }
  .btn-icon { width: 40px; height: 40px; font-size: 1rem; }
}

/* ── Flow Images ── */
.flow-img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}

.flow-img-sm {
  max-width: 300px;
  flex-shrink: 0;
}

.flow-showcase {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.flow-desc {
  max-width: 420px;
  color: var(--text-dim);
  font-size: 0.8rem;
  line-height: 1.7;
}

.flow-desc p {
  margin-bottom: 0.75rem;
}

.flow-desc ul {
  margin: 0.5rem 0 0.75rem 1.2rem;
  padding: 0;
}

.flow-desc li {
  margin-bottom: 0.35rem;
}

.flow-desc strong {
  color: #fff;
}

.flow-desc li strong {
  color: var(--accent);
}

/* ── Selection ── */
::selection {
  background: rgba(0,229,255,0.3);
  color: #fff;
}