/* SecretLah — self-hosted, no external fonts or resources permitted. */

:root {
  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --border: #E4E7EC;
  --border-strong: #D0D5DD;
  --text-primary: #101828;
  --text-secondary: #475467;
  --text-muted: #98A2B3;
  --accent: #4338CA;
  --accent-hover: #3730A3;
  --accent-soft: #EEF2FF;
  --accent-text-on: #FFFFFF;
  --warning: #B45309;
  --warning-soft: #FFFAEB;
  --danger: #B42318;
  --danger-soft: #FEF3F2;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

  --radius: 10px;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 680px;
  margin: 0 auto;
  padding: 56px 20px 48px;
}

/* ---- Header + nav ---- */

.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 36px;
}

.brand {
  min-width: 0;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  color: var(--accent);
  flex-shrink: 0;
}

.wordmark {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.tagline {
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 14px;
  max-width: 34ch;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  padding-top: 4px;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}

.nav-link:hover {
  color: var(--text-primary);
}

.nav-link[aria-current="page"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---- Cards ---- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 32px;
}

.card[aria-hidden="true"] {
  display: none;
}

h1 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  margin: 0 0 20px;
}

h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 16px;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin: 20px 0 6px;
}

.field-label:first-of-type {
  margin-top: 0;
}

textarea,
input[type="text"] {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  padding: 12px 14px;
}

textarea {
  resize: vertical;
  min-height: 140px;
  line-height: 1.5;
}

input#challenge-input,
input#result-url,
input#result-key {
  font-family: var(--font-mono);
  font-size: 14px;
}

textarea:focus,
input:focus,
button:focus-visible,
.nav-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.field-meta {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.field-meta span {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.note {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 12px 0 0;
}

.warn-text {
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 14px;
  line-height: 1.6;
  margin: 20px 0 0;
  padding: 12px 14px;
  border-radius: 8px;
}

.error-text {
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 14px;
  margin: 16px 0 0;
  padding: 10px 14px;
  border-radius: 8px;
}

.copy-row {
  display: flex;
  gap: 8px;
}

.copy-row input {
  flex: 1;
  min-width: 0;
}

button {
  font-family: var(--font-sans);
  font-size: 15px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  min-height: 44px;
}

.btn-primary {
  display: block;
  width: 100%;
  background: var(--accent);
  color: var(--accent-text-on);
  font-weight: 600;
  padding: 12px 16px;
  margin-top: 24px;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}

.btn-secondary {
  display: block;
  width: 100%;
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text-primary);
  font-weight: 500;
  padding: 12px 16px;
  margin-top: 24px;
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-copy {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0 16px;
  white-space: nowrap;
}

.btn-copy:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.revealed-secret {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 0 16px;
}

/* ---- Footer ---- */

.site-footer {
  margin-top: 40px;
  text-align: left;
}

.site-footer p {
  color: var(--text-muted);
  font-size: 13px;
  margin: 4px 0;
}

/* ---- How-it-works: technical timeline ---- */

.timeline {
  position: relative;
  margin: 28px 0;
  padding-left: 28px;
  border-left: 2px solid var(--border);
}

.timeline-step {
  position: relative;
  margin-bottom: 26px;
}

.timeline-step:last-child {
  margin-bottom: 0;
}

.timeline-step::before {
  content: attr(data-step);
  position: absolute;
  left: -41px;
  top: 0;
  width: 26px;
  height: 26px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-sans);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
}

.timeline-step h3 {
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.timeline-step-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}

.timeline-step p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
}

.process-section {
  margin: 40px 0;
}

.process-section h2 {
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.process-list {
  margin: 0;
  padding-left: 20px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.8;
}

.process-list li {
  margin-bottom: 6px;
}

.process-list code,
.never-list code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 1px 5px;
  border-radius: 4px;
}

.never-list {
  list-style: none;
  padding-left: 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.8;
}

.never-list li::before {
  content: "\2717  ";
  color: var(--danger);
  font-weight: 600;
}

/* ---- How-it-works: protocol flow diagrams ---- */

.flow-diagram {
  width: 100%;
  height: auto;
  display: block;
  margin: 8px 0 4px;
}

.diagram-lane-label {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  fill: var(--text-primary);
}

.diagram-lane-rule {
  stroke: var(--border-strong);
  stroke-width: 1.5;
}

.diagram-box {
  fill: var(--surface);
  stroke: var(--border-strong);
  stroke-width: 1.4;
}

.diagram-box-title {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  fill: var(--text-primary);
}

.diagram-box-sub {
  font-family: var(--font-sans);
  font-size: 12.5px;
  fill: var(--text-secondary);
}

.diagram-connector {
  stroke: var(--border-strong);
  stroke-width: 1.4;
  fill: none;
}

.diagram-request {
  stroke: var(--accent);
  stroke-width: 1.8;
  fill: none;
}

.diagram-response {
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-dasharray: 5 4;
  fill: none;
  opacity: 0.75;
}

.diagram-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin: 4px 0 32px;
  font-size: 13px;
  color: var(--text-secondary);
}

.diagram-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.diagram-legend-swatch {
  display: inline-block;
  width: 22px;
  height: 0;
  border-top: 2px solid var(--accent);
}

.diagram-legend-swatch.is-response {
  border-top-style: dashed;
  opacity: 0.75;
}

/* ---- Full-flow page: poster headline + banded diagram ---- */

.diagram-divider-label {
  font-family: var(--font-sans);
  font-size: 12px;
  font-style: italic;
  fill: var(--text-muted);
}

.poster-header {
  text-align: center;
  margin-bottom: 32px;
}

.poster-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin: 0 0 8px;
}

.poster-subtitle {
  font-size: 15px;
  font-style: italic;
  color: var(--text-secondary);
  margin: 0;
}

.band-rect {
  fill-opacity: 1;
}

.band-rect.prepare { fill: var(--accent); }
.band-rect.send-store { fill: #0F9488; }
.band-rect.reveal { fill: #D34F6E; }
.band-rect.verify { fill: #2F9E44; }

.band-label {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  fill: #ffffff;
  letter-spacing: 0.04em;
}

.phase-box.prepare { fill: var(--accent); }
.phase-box.send-store { fill: #0F9488; }
.phase-box.reveal { fill: #D34F6E; }
.phase-box.verify { fill: #2F9E44; }

.phase-box-title {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  fill: #ffffff;
}

.phase-box-sub {
  font-family: var(--font-sans);
  font-size: 12.5px;
  fill: #ffffff;
  fill-opacity: 0.85;
}

.phase-box-formula {
  font-family: var(--font-mono);
  font-size: 12px;
  fill: #ffffff;
  fill-opacity: 0.95;
}

.phase-connector {
  stroke: var(--text-muted);
  stroke-width: 1.4;
  fill: none;
}

.phase-divider {
  stroke: var(--border-strong);
  stroke-width: 1;
  stroke-dasharray: 5 5;
}

@media (max-width: 480px) {
  .diagram-box-sub {
    font-size: 10.5px;
  }
}

/* ---- How-it-works: technical/plain-English toggle ---- */

.view-toggle {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 32px;
  gap: 4px;
}

.toggle-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  min-height: auto;
}

.toggle-btn[aria-selected="true"] {
  background: var(--accent);
  color: #fff;
}

/* ---- How-it-works: plain-English mini flow diagram ---- */

.mini-flow {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 8px 0 4px;
}

.mini-flow-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 108px;
  text-align: center;
}

.mini-flow-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.mini-flow-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.mini-flow-arrow {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  padding-top: 16px;
}

/* ---- How-it-works: detailed value cards ---- */

.generated-list-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 16px 0 8px;
}

.generated-list {
  margin: 0 0 8px;
  padding-left: 20px;
  font-size: 14px;
}

.generated-list li {
  margin-bottom: 4px;
}

.generated-list a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.generated-list a:hover {
  text-decoration: underline;
}

.value-detail-name-link {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  border-bottom: 1px dashed var(--border-strong);
  cursor: pointer;
}

.value-detail-name-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.value-detail-name-link::after {
  content: " ↑";
  font-size: 12px;
  color: var(--text-muted);
}

.value-detail {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 22px;
  margin-bottom: 16px;
}

.value-detail-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}

.value-detail-size {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 5px;
}

.value-detail-plain {
  color: var(--text-primary);
  font-size: 14.5px;
  margin: 0 0 12px;
}

.value-detail-example-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 4px;
}

.value-detail-example {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 0 0 12px;
  word-break: break-all;
}

.value-detail-why-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 4px;
}

.value-detail-why {
  color: var(--text-secondary);
  font-size: 13.5px;
  line-height: 1.6;
  margin: 0 0 12px;
}

.value-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  font-size: 12.5px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.value-detail-meta strong {
  color: var(--text-secondary);
  font-weight: 600;
}

/* ---- How-it-works: technical note pill (used in the plain-English steps) ---- */

.tech-note {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  background: var(--accent-soft);
  padding: 3px 8px;
  border-radius: 5px;
  margin-top: 4px;
}

/* ---- How-it-works: summary callout ---- */

.summary-box {
  background: var(--accent-soft);
  border-radius: 10px;
  padding: 18px 20px;
  color: var(--text-primary);
  font-size: 14.5px;
  margin: 24px 0;
}

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

/* ---- How-it-works: mobile responsiveness for the mini flow diagram ---- */

@media (max-width: 600px) {
  .mini-flow-arrow {
    transform: rotate(90deg);
    padding: 2px 0;
  }

  .mini-flow {
    flex-direction: column;
    align-items: center;
  }
}

@media (max-width: 480px) {
  .page {
    padding: 36px 14px 32px;
  }

  .card {
    padding: 22px 18px;
  }

  .timeline {
    padding-left: 24px;
  }

  .timeline-step::before {
    left: -36px;
    width: 22px;
    height: 22px;
    font-size: 11px;
  }
}
