/* Storjeno public site — plain self-hosted stylesheet, dark & light, mobile-first */

:root {
  color-scheme: dark light;
  --bg: #06090e;
  --bg-elev: #0e141d;
  --bg-card: #111827;
  --bg-subtle: #182231;
  --border: #1f2b3d;
  --border-strong: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #facc15;
  --accent-hover: #fde047;
  --accent-ink: #06090e;
  --accent-soft: rgba(250, 204, 21, 0.14);
  --cable-red: #fb4d3d;
  --cable-blue: #2d6cdf;
  --cable-yg: #a3e635;
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.14);
  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, 0.14);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  --radius: 12px;
  --radius-sm: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --container: 1120px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f8fafc;
    --bg-elev: #ffffff;
    --bg-card: #ffffff;
    --bg-subtle: #f1f5f9;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text: #0f172a;
    --text-muted: #475569;
    --accent: #eab308;
    --accent-hover: #ca8a04;
    --accent-ink: #06090e;
    --accent-soft: rgba(234, 179, 8, 0.16);
    --danger: #b91c1c;
    --danger-soft: rgba(220, 38, 38, 0.1);
    --ok: #15803d;
    --ok-soft: rgba(22, 163, 74, 0.12);
    --shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
}

/* Braided 3-wire cable motif at top edge */
.cable-bar {
  height: 4px;
  width: 100%;
  background: repeating-linear-gradient(
    -55deg,
    var(--cable-red) 0 12px,
    #06090e 12px 14px,
    var(--cable-blue) 14px 26px,
    #06090e 26px 28px,
    var(--cable-yg) 28px 34px,
    var(--accent) 34px 40px,
    #06090e 40px 42px
  );
}

img,
video {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  padding: 0.75rem 1rem;
  z-index: 200;
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
  border-radius: var(--radius-sm);
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header */
.site-header {
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.625rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.125rem;
  letter-spacing: -0.015em;
  min-height: 44px;
  padding: 0.25rem 0;
}

.brand-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 7px;
}

.header-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.75rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-muted);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

.nav-link[aria-current="page"] {
  color: var(--text);
  background: var(--accent-soft);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.lang-wrap {
  display: inline-flex;
  align-items: center;
}

.lang-select {
  min-height: 44px;
  padding: 0 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

/* Main */
.site-main {
  flex: 1 0 auto;
  padding: 1.5rem 0 2.5rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  min-width: 44px;
  padding: 0.625rem 1.125rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
  font-weight: 650;
  font-size: 0.9375rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

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

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

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

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-ink);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
}

.btn-sm {
  font-size: 0.875rem;
  padding: 0.5rem 0.875rem;
}

/* Landing page hero */
.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: center;
  padding: 1rem 0 2rem;
}

@media (min-width: 820px) {
  .hero {
    grid-template-columns: minmax(0, 1.3fr) minmax(220px, 280px);
    gap: 3rem;
    padding: 2.5rem 0 3rem;
  }
}

.hero-title {
  margin: 0 0 0.75rem;
  font-size: clamp(2rem, 6vw, 3.25rem);
  font-weight: 850;
  letter-spacing: -0.03em;
  line-height: 1.08;
}

.hero-tagline {
  margin: 0 0 1.5rem;
  font-size: clamp(1.0625rem, 2.5vw, 1.3125rem);
  color: var(--text-muted);
  max-width: 52ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hero-preview {
  justify-self: center;
  width: min(100%, 240px);
  display: block;
  border-radius: 22px;
  overflow: hidden;
  border: 2px solid var(--border-strong);
  background: #06090e;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.hero-preview:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.hero-preview img {
  width: 100%;
  height: auto;
  aspect-ratio: 540 / 1170;
  object-fit: cover;
}

/* Feature blocks */
.features-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

@media (min-width: 720px) {
  .features-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
  }
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.feature-card--1 {
  border-top-color: var(--cable-red);
}

.feature-card--2 {
  border-top-color: var(--cable-blue);
}

.feature-card--3 {
  border-top-color: var(--accent);
}

.feature-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.feature-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Page header */
.page-head {
  margin-bottom: 1.25rem;
}

.page-head h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.5rem, 4.5vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.page-head p {
  margin: 0;
  color: var(--text-muted);
  max-width: 65ch;
}

/* Demo page */
.demo-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (min-width: 860px) {
  .demo-layout {
    grid-template-columns: minmax(290px, 350px) minmax(0, 1fr);
    gap: 2rem;
  }
}

.demo-stage {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

@media (min-width: 860px) {
  .demo-stage {
    top: 1rem;
    padding: 0;
    border-bottom: 0;
    background: transparent;
  }
}

.phone-frame {
  position: relative;
  margin: 0 auto;
  width: fit-content;
  border-radius: 20px;
  overflow: hidden;
  border: 2px solid var(--border-strong);
  background: #06090e;
  box-shadow: var(--shadow);
}

.tour-video {
  height: clamp(200px, 34svh, 310px);
  width: auto;
  aspect-ratio: 540 / 1170;
  background: #06090e;
  cursor: pointer;
}

@media (min-width: 860px) {
  .tour-video {
    height: min(60vh, 540px);
  }
}

.player-panel {
  margin-top: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  display: grid;
  gap: 0.625rem;
}

.player-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.player-meta {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.player-step-indicator {
  font-weight: 700;
  color: var(--text);
}

.scrub-wrap {
  display: flex;
  align-items: center;
  min-height: 44px;
}

.range-input {
  width: 100%;
  height: 44px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
  background: transparent;
}

.narrate-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding-top: 0.375rem;
  border-top: 1px solid var(--border);
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.check-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  cursor: pointer;
}

.speed-control {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 160px;
  min-height: 44px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.speed-control input[type="range"] {
  flex: 1 1 80px;
  min-width: 72px;
  height: 44px;
  accent-color: var(--accent);
  cursor: pointer;
}

.speed-val {
  min-width: 3.1em;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  color: var(--text);
}

.tts-notice {
  margin: 0;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.tour-note {
  margin: 0.625rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Steps list */
.step-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.step-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid transparent;
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.step-card:hover {
  border-color: var(--border-strong);
}

.step-card.is-active {
  border-color: var(--accent);
  border-left-color: var(--accent);
  background: linear-gradient(90deg, var(--accent-soft), var(--bg-card) 42%);
}

.step-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
}

.step-num {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  font-weight: 800;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  flex: 0 0 28px;
}

.step-card.is-active .step-num {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.step-name-btn {
  background: none;
  border: 0;
  padding: 0.25rem 0;
  min-height: 44px;
  font: inherit;
  font-weight: 750;
  font-size: 1.0625rem;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.step-time {
  margin-left: auto;
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.step-caption {
  margin: 0 0 0.45rem;
  font-weight: 700;
  font-size: 0.96875rem;
  color: var(--text);
}

.step-voiceover {
  margin: 0 0 0.75rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.step-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-read.is-speaking {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}

/* Board page */
.board-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.75rem;
}

.toc-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.875rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
}

.toc-link:hover {
  border-color: var(--accent);
  color: var(--text);
}

.board-section {
  margin-bottom: 2.75rem;
  scroll-margin-top: 1rem;
}

.board-section > h2 {
  margin: 0 0 0.4rem;
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.section-sub {
  margin: 0 0 1rem;
  color: var(--text-muted);
  max-width: 70ch;
}

.screen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr));
  gap: 1.125rem;
}

.screen-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.screen-media {
  background: var(--bg-subtle);
  padding: 0.75rem;
  display: flex;
  justify-content: center;
  border-bottom: 1px solid var(--border);
}

.screen-media img {
  height: 360px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
}

.screen-body {
  padding: 0.9rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.screen-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 750;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.screen-caption {
  margin: 0;
  font-weight: 700;
  font-size: 0.925rem;
}

.screen-text {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.limits-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 1rem;
}

.limit-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
}

.limit-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  font-weight: 750;
}

.limit-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.925rem;
}

.transcript-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.transcript-head h2 {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 800;
}

.transcript-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.copy-status {
  font-size: 0.875rem;
  font-weight: 650;
  color: var(--ok);
}

.transcript-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.125rem;
  white-space: pre-wrap;
  font-family: var(--font);
  font-size: 0.925rem;
  line-height: 1.6;
  margin: 0;
  overflow-x: auto;
}

/* 404 page */
.notfound-box {
  padding: 3rem 0;
  max-width: 48ch;
}

.notfound-code {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.75rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
  padding: 1.25rem 0 calc(5rem + env(safe-area-inset-bottom, 0px));
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Feedback floating button + modal */
.fb-fab {
  position: fixed;
  right: calc(1rem + env(safe-area-inset-right, 0px));
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  box-shadow: var(--shadow);
  border-radius: 999px;
  padding: 0.625rem 1.125rem;
}

.fb-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(6, 9, 14, 0.75);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.fb-dialog {
  width: min(100%, 520px);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  display: grid;
  gap: 0.875rem;
}

.fb-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.fb-dialog-head h2 {
  margin: 0;
  font-size: 1.1875rem;
  font-weight: 800;
  line-height: 1.25;
}

.fb-close {
  flex: 0 0 44px;
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
}

.fb-form {
  display: grid;
  gap: 0.75rem;
}

.fb-field {
  display: grid;
  gap: 0.35rem;
}

.fb-field label {
  font-size: 0.875rem;
  font-weight: 650;
}

.fb-textarea,
.fb-input {
  width: 100%;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
}

.fb-textarea {
  min-height: 120px;
  resize: vertical;
}

.fb-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.fb-counter {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.fb-dictate {
  gap: 0.45rem;
}

.fb-dictate.is-listening {
  border-color: var(--cable-red);
  background: var(--danger-soft);
  color: var(--text);
}

.fb-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: currentColor;
  display: inline-block;
}

.fb-dictate.is-listening .fb-dot {
  background: var(--cable-red);
  animation: fb-pulse 1.1s ease-in-out infinite;
}

@keyframes fb-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(0.8);
  }
}

.fb-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.fb-context {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.fb-status {
  margin: 0;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
}

.fb-status--ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.fb-status--err {
  background: var(--danger-soft);
  color: var(--danger);
}

.fb-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding-top: 0.25rem;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
