/* ─── DevSense — page sections ──────────────────────────────────────────── */
/* Depends on tokens.css + base.css (shared with flowcraft.systems). */

/* ─── Reveal on scroll ──────────────────────────────────────────────────── */
/* Scoped to .js so content is never hidden when scripting is unavailable. */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}
.js .reveal.in-view { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* ─── Nav ───────────────────────────────────────────────────────────────── */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  background: rgba(6, 6, 13, 0.72);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease-out);
}
.nav.scrolled { border-bottom-color: var(--border); }
.nav-inner {
  max-width: var(--container); margin: 0 auto; padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.nav-brand { display: flex; align-items: center; gap: 10px; }
.nav-mark {
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
}
.nav-name { font-weight: 700; letter-spacing: -0.01em; }
.nav-name em { font-style: normal; color: var(--text-muted); font-weight: 500; }
.nav-links { display: flex; align-items: center; gap: 26px; font-size: 0.9rem; }
.nav-links a { color: var(--text-soft); transition: color 0.2s var(--ease-out); }
.nav-links a:hover { color: var(--text); }
.nav-cta {
  color: var(--text) !important; font-weight: 600;
  margin-left: 6px;
  padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--primary-border); background: var(--primary-dim);
  transition: background 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}
.nav-cta:hover { background: rgba(139, 92, 246, 0.22); border-color: var(--primary); }

/* ─── Headings ──────────────────────────────────────────────────────────── */
/* Balanced wrapping with a bounded measure, rather than hardcoded <br> tags —
   the break point then adapts to width, font and locale instead of guessing. */
h1, h2 { text-wrap: balance; }

/* ─── Hero ──────────────────────────────────────────────────────────────── */
.hero { padding: clamp(132px, 17vw, 184px) 0 clamp(56px, 7vw, 80px); }
.hero-inner { text-align: center; }
.hero h1 { max-inline-size: 20ch; margin-inline: auto; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 16px; border-radius: 999px; margin-bottom: 30px;
  border: 1px solid var(--border-bright); background: var(--surface-1);
  font-size: 0.8rem; color: var(--text-soft); letter-spacing: 0.01em;
}
.hero-badge .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}
.hero h1 { margin-bottom: 24px; }
.hero-sub {
  font-size: clamp(1.05rem, 1.5vw, 1.18rem);
  max-width: 60ch; margin: 0 auto 36px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.hero-note {
  margin-top: 20px; font-size: 0.76rem;
  color: var(--text-muted); letter-spacing: 0.04em;
}

/* ─── Section shell ─────────────────────────────────────────────────────── */
.section { padding: var(--space-section) 0; }
.section-alt { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-alt::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(21, 21, 42, 0.35), transparent 70%);
}
/* The demo sits right under the hero — pull it up so they read as one unit. */
.section-try { padding-top: clamp(24px, 4vw, 48px); }

/* ─── The workspace (interactive demo) ──────────────────────────────────── */
.ws {
  max-width: 860px; margin: 0 auto;
  border: 1px solid var(--border-bright);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--surface-2), var(--surface-1) 46%);
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.9), var(--primary-glow);
  overflow: hidden;
}
.ws-bar {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.28);
}
.ws-dots { display: flex; gap: 6px; flex: none; }
.ws-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--border-bright); }
.ws-title { font-size: 0.78rem; color: var(--text-soft); flex: 1; }
.ws-stat { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }
.ws-stat b { color: var(--text); font-weight: 500; }
.ws-stat .up { color: var(--red); }

.ws-body { padding: clamp(20px, 3vw, 30px); }

.msg { display: grid; grid-template-columns: auto 1fr; gap: 16px; }
.msg-avatar {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.06em;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
}
.msg-who {
  font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--primary-soft); margin-bottom: 9px;
}
.msg-main p { font-size: 0.96rem; }
.msg-main code {
  color: var(--cyan); background: rgba(34, 211, 238, 0.08);
  padding: 1px 5px; border-radius: 5px;
}

.diff {
  margin: 15px 0; padding: 15px 18px;
  border-radius: var(--r); border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.42);
  font-size: 0.82rem; line-height: 1.6;
  overflow-x: auto;
}
.diff .ln-add { color: var(--green); display: block; }
.diff .ln-del { color: var(--red); display: block; }

.msg-ask { margin-top: 14px; font-size: 0.96rem; }
.conf {
  display: inline-block;
  font-family: var(--mono); font-size: 0.74rem;
  color: var(--amber); background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.28);
  padding: 2px 9px; border-radius: 999px;
  margin-right: 4px;
}

/* Interactive controls only appear once scripting is confirmed; the static
   outcome list below is the no-JS fallback and is removed when JS takes over. */
.ws-choice { display: none; }
.js .ws-choice {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin-top: 26px; padding-top: 24px;
  border-top: 1px dashed var(--border-bright);
}
.js .ws-choice[hidden] { display: none; }
.js .ws-static { display: none; }

/* ── Outcome ── */
.out { animation: outIn 0.45s var(--ease-out) both; }
@keyframes outIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .out { animation: none; } }

.ws-out .out, .ws-static .out {
  margin-top: 26px; padding-top: 24px;
  border-top: 1px dashed var(--border-bright);
}
.out-head {
  display: flex; align-items: center; gap: 9px;
  font-size: 0.8rem; letter-spacing: 0.04em;
  margin-bottom: 12px;
}
.out-head:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; }
.out-icon { width: 18px; height: 18px; flex: none; }
.out-bad .out-head { color: var(--red); }
.out-good .out-head { color: var(--green); }

.out-metric {
  font-size: 0.82rem; color: var(--text-soft);
  padding: 10px 14px; margin-bottom: 14px;
  border-radius: var(--r); background: rgba(0, 0, 0, 0.34);
  border: 1px solid var(--border);
}
.out-metric b { color: var(--text); font-weight: 500; }
.out p { font-size: 0.94rem; }
.out p + p { margin-top: 11px; }
.out-note { color: var(--text-muted) !important; }

.ws-reset {
  position: relative;
  margin-top: 18px; padding: 0;
  background: none; border: none; cursor: pointer;
  font-size: 0.85rem; font-weight: 600; color: var(--primary-soft);
  transition: color 0.2s var(--ease-out);
}
.ws-reset:hover { color: var(--text); }

/* Inline text controls keep their link-like look but get a 44px-tall hit area,
   so they clear the minimum touch target without disturbing layout. */
.ws-reset::after, .email-copy::after {
  content: ''; position: absolute; left: 0; right: 0;
  top: 50%; transform: translateY(-50%);
  height: 44px; min-height: 100%;
}

/* ─── The loop rail ─────────────────────────────────────────────────────── */
.rail {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px;
  max-width: 860px; margin: 34px auto 0;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--border); overflow: hidden;
}
.rail li {
  padding: 16px 16px 18px;
  background: var(--surface-1);
  font-size: 0.8rem; color: var(--text-muted); line-height: 1.5;
}
.rail li span {
  display: block; margin-bottom: 6px;
  font-size: 0.68rem; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--cyan);
}

/* ─── The shift — asymmetric beats ──────────────────────────────────────── */
.beats { display: grid; grid-template-columns: 1fr 1.15fr; gap: clamp(36px, 6vw, 80px); align-items: start; }
.beats-head { position: sticky; top: 108px; }
.beats-head h2 { margin-top: 14px; }
.beat { padding: 24px 0; border-top: 1px solid var(--border); }
.beat:first-child { border-top: none; padding-top: 0; }
.beat h3 { font-family: var(--sans); font-size: 1.08rem; margin-bottom: 8px; }
.beat p { font-size: 0.95rem; }

/* ─── Competency list ───────────────────────────────────────────────────── */
.comp-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 48px; }
.comp {
  display: grid; grid-template-columns: auto 1fr; gap: 16px;
  padding: 20px 0; border-bottom: 1px solid var(--border);
}
.comp-num { font-size: 0.76rem; color: var(--text-muted); padding-top: 4px; }
.comp h3 { font-family: var(--sans); font-size: 1rem; margin-bottom: 5px; }
.comp p { font-size: 0.9rem; }

/* ─── Scenario chips ────────────────────────────────────────────────────── */
.chips {
  display: flex; flex-wrap: wrap; gap: 9px; align-items: center;
  margin-top: 44px;
}
.chips-label {
  font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-muted); margin-right: 4px;
}
/* Non-interactive labels: deliberately no hover/cursor affordance, so they
   don't read as clickable controls. */
.chip {
  padding: 7px 15px; border-radius: 999px;
  border: 1px solid var(--border-bright); background: var(--surface-1);
  font-size: 0.85rem; color: var(--text-soft);
}
.chip-quiet {
  border-style: dashed; border-color: var(--border);
  color: var(--text-muted); font-style: italic;
}

/* ─── Claims ────────────────────────────────────────────────────────────── */
.claims-wrap { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: clamp(36px, 6vw, 72px); align-items: start; }
.claims-head h2 { margin: 14px 0 16px; }
.claims-head p { font-size: 0.98rem; }
.claims-cols { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.claim-col { padding: 24px; border-radius: var(--r-lg); border: 1px solid var(--border); }
.claim-do   { background: rgba(16, 185, 129, 0.05); border-color: rgba(16, 185, 129, 0.24); }
.claim-dont { background: rgba(239, 68, 68, 0.04);  border-color: rgba(239, 68, 68, 0.20); }
.claim-col h3 {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.12em;
  text-transform: uppercase; margin-bottom: 14px;
}
.claim-do h3   { color: var(--green); }
.claim-dont h3 { color: var(--red); }
.claim-col li {
  padding: 8px 0 8px 20px; position: relative;
  font-size: 0.9rem; color: var(--text-soft);
}
.claim-col li::before { position: absolute; left: 0; top: 8px; }
.claim-do li::before   { content: '✓'; color: var(--green); }
.claim-dont li::before { content: '×'; color: var(--red); }

.claims-note {
  max-width: 780px; margin: 40px 0 0 auto; padding: 20px 26px;
  border-radius: var(--r-md);
  border: 1px solid var(--border); border-left: 2px solid var(--cyan);
  background: var(--surface-1);
}
.claims-note p { font-size: 0.92rem; }
.claims-note strong { color: var(--text); }
.claims-note .attrib {
  display: block; margin-top: 10px;
  font-size: 0.7rem; color: var(--text-muted); letter-spacing: 0.04em;
}

/* ─── CTA ───────────────────────────────────────────────────────────────── */
.cta-card {
  max-width: 720px; margin: 0 auto; text-align: center;
  padding: clamp(36px, 5vw, 56px); border-radius: var(--r-xl);
  border: 1px solid var(--primary-border); background: var(--surface-1);
  box-shadow: var(--primary-glow);
}
.cta-card h2 { margin-bottom: 16px; }
.cta-card p { max-width: 54ch; margin: 0 auto 28px; font-size: 0.98rem; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.cta-fallback { margin-top: 20px; font-size: 0.82rem; color: var(--text-muted); }
.email-copy {
  position: relative;
  font: inherit; color: var(--cyan); background: none; border: none;
  border-bottom: 1px dashed var(--cyan); padding: 0 1px; cursor: pointer;
  transition: color 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}
.email-copy:hover { color: var(--text); border-color: var(--text); }
.email-copy.copied { color: var(--green); border-color: var(--green); }
.cta-note { margin-top: 22px; font-size: 0.74rem; color: var(--text-muted); }

/* ─── Footer ────────────────────────────────────────────────────────────── */
.footer { border-top: 1px solid var(--border); padding: 44px 0; }
.footer-inner {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 20px;
}
.footer-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.footer-links { display: flex; gap: 22px; font-size: 0.88rem; }
.footer-links a { color: var(--text-soft); }
.footer-links a:hover { color: var(--text); }
.footer-note { font-size: 0.8rem; color: var(--text-muted); width: 100%; }

/* ─── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .beats, .claims-wrap { grid-template-columns: 1fr; }
  .beats-head { position: static; }
  .comp-grid { grid-template-columns: 1fr; gap: 0; }
  .rail { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .nav-links a:not(.nav-cta) { display: none; }
  .rail, .claims-cols { grid-template-columns: 1fr; }
  .hero { padding-top: 118px; }
  .ws-body { padding: 20px 16px; }
  .msg { grid-template-columns: 1fr; gap: 12px; }
  .msg-avatar { display: none; }
  .ws-choice .btn { width: 100%; justify-content: center; }
  .ws-stat { display: none; }
  .claims-note { margin-left: 0; }
}
