/* Home: security section. Everything here sits on the ink band, so the band's
   tokens (--ink, --muted, --line, --brass-text, --raised) already carry the
   on-band colours. Brass is the single accent. Without JS the section shows
   its end state; .is-anim (added by home-security.js, never under Reduce
   Motion) is what winds it back to the start. */

.sec { --sec-brass: var(--on-band-brass); }
.sec-head { display: grid; gap: var(--s-4); }
@media (min-width: 900px) {
  .sec-head { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: end; }
}
.sec-lede { max-width: 38ch; font-size: var(--t-lede); line-height: 1.55; color: var(--muted); text-wrap: pretty; }

/* Line icons, in the brand's line style. */
.sec svg { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.sec .shackle { transform-box: fill-box; transform-origin: 100% 100%; transition: transform 0.45s var(--ease-spring); }

/* ------------------------------------------------------------ the journey */

.sx {
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin-top: clamp(40px, 2rem + 3vw, 80px);
}
@media (min-width: 900px) {
  .sx { grid-template-columns: minmax(0, 1fr) minmax(86px, 0.5fr) minmax(0, 1.2fr) minmax(86px, 0.5fr) minmax(0, 1fr); align-items: start; }
}
.sx-who { font-size: var(--t-small); font-weight: 600; color: var(--muted); margin-bottom: var(--s-3); }
.sx-card {
  position: relative;
  display: grid;
  min-height: 132px;
  align-content: center;
  padding: var(--s-5);
  border: 1.5px solid color-mix(in srgb, var(--ink) 38%, transparent);
  border-radius: 20px;
  background: var(--raised);
  transition: border-color var(--dur-standard) linear;
}
.sx-text {
  grid-area: 1 / 1;
  min-height: 3.2em;
  padding-right: 34px;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  line-height: 1.25;
  font-variation-settings: "opsz" 36, "SOFT" 0, "WONK" 0;
  overflow-wrap: anywhere;
  transition: opacity var(--dur-standard) linear;
}
.sx-text.is-cipher { font-family: var(--mono); font-size: var(--t-small); line-height: 1.6; color: var(--sec-brass); letter-spacing: 0.02em; }
.sx-badge { position: absolute; top: 14px; right: 14px; width: 22px; height: 26px; color: var(--sec-brass); }
.sx-keyline { display: flex; align-items: center; gap: var(--s-2); margin-top: var(--s-3); font-size: var(--t-small); line-height: 1.4; color: var(--muted); }
.key { flex: none; width: 26px; height: 16px; color: var(--sec-brass); }
.key .cross { stroke: var(--ink); }

.sx-bars { grid-area: 1 / 1; display: grid; gap: 10px; align-content: center; padding-right: 34px; opacity: 0; transition: opacity var(--dur-standard) linear; }
.sx-bars i { height: 9px; border-radius: 5px; background: color-mix(in srgb, var(--ink) 22%, transparent); }
.sx-bars i:nth-child(2) { width: 72%; }
.sx-bars i:nth-child(3) { width: 48%; }

/* The server: asleep, with a ledger of the only things it knows. */
.sx-face { display: block; width: 120px; height: 40px; margin: -4px auto var(--s-3); color: var(--ink); }
.sx-face .z { stroke: var(--sec-brass); stroke-width: 1.4; animation: sec-z 2.8s ease-in-out infinite; }
.sx-face .z2 { animation-delay: 0.6s; }
@keyframes sec-z { 0%, 100% { opacity: 0.3; translate: 0 2px; } 50% { opacity: 1; translate: 0 -3px; } }
.sx-ledger { display: grid; }
.sx-ledger > div { display: grid; grid-template-columns: 6.5em minmax(0, 1fr); gap: var(--s-3); padding-block: 9px; border-top: 1px solid var(--line); font-size: var(--t-small); }
.sx-ledger dt { color: var(--muted); }
.sx-ledger dd { min-width: 0; overflow-wrap: anywhere; transition: opacity var(--dur-standard) linear; }
.sx-hex { font-family: var(--mono); letter-spacing: 0.02em; line-height: 1.6; color: var(--sec-brass); }
.sx-none { font-style: italic; color: var(--muted); }
.sx-stamp {
  position: absolute;
  right: 12px; top: -14px;
  padding: 3px 12px;
  border: 1.5px solid var(--sec-brass);
  border-radius: 8px;
  background: var(--band);
  color: var(--sec-brass);
  font-size: var(--t-small);
  font-weight: 700;
  rotate: 4deg;
  transition: opacity var(--dur-micro) linear, scale 0.45s var(--ease-spring);
}

/* The roads between them. */
.sx-track { position: relative; height: 72px; }
.sx-line { position: absolute; left: 50%; top: 10px; bottom: 10px; border-left: 1.5px dashed color-mix(in srgb, var(--ink) 40%, transparent); }
.sx-line::after { content: ""; position: absolute; left: -5.5px; bottom: 0; width: 9px; height: 9px; border: solid color-mix(in srgb, var(--ink) 60%, transparent); border-width: 0 1.5px 1.5px 0; rotate: 45deg; translate: 0 -2px; }
.sx-chip {
  position: absolute; left: 50%; top: 0;
  translate: -50% 0;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px 5px 9px;
  border: 1.5px solid var(--sec-brass);
  border-radius: 999px;
  background: var(--band);
  color: var(--sec-brass);
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  transition: top 0.95s var(--ease-spring), left 0.95s var(--ease-spring), translate 0.95s var(--ease-spring), opacity var(--dur-standard) linear;
}
.sx-chip .lock { width: 12px; height: 14px; }
.sx-chip .sx-hex { line-height: 1.2; }
@media (min-width: 900px) {
  .sx-track { height: auto; min-height: 150px; align-self: center; margin-top: 30px; }
  .sx-line { left: 8px; right: 8px; top: 50%; bottom: auto; border-left: 0; border-top: 1.5px dashed color-mix(in srgb, var(--ink) 40%, transparent); }
  .sx-line::after { left: auto; right: 0; top: -5.5px; bottom: auto; translate: -2px 0; rotate: -45deg; }
  .sx-chip { left: 0; top: 50%; translate: 0 -50%; }
}

/* Which step is showing (s1..s5 are cumulative; set by the script). */
.sx:not(.is-anim) .sx-b .shackle,
.sx.is-anim:not(.s1) .sx-a .shackle,
.sx.is-anim.s5 .sx-b .shackle { transform: translateY(-3.5px) rotate(-22deg); }
.sx.is-anim.s5 .sx-b .shackle { transform: translateY(-3.5px) rotate(-22deg); }
.sx.is-anim:not(.s5) .sx-b .sx-text { opacity: 0; }
.sx.is-anim:not(.s5) .sx-b .sx-bars { opacity: 1; }
.sx.is-anim:not(.s3) .sx-ledger dd { opacity: 0; }
.sx.is-anim:not(.s3) .sx-stamp { opacity: 0; scale: 1.5; }
.sx.is-anim.s1 .sx-a .sx-card, .sx.is-anim.s3 .sx-srv, .sx.is-anim.s5 .sx-b .sx-card { border-color: var(--sec-brass); }
.sx.is-anim.s2:not(.s3) .t1 .sx-chip,
.sx.is-anim.s4:not(.s5) .t2 .sx-chip { opacity: 1; top: 100%; translate: -50% -100%; }
@media (min-width: 900px) {
  .sx.is-anim.s2:not(.s3) .t1 .sx-chip,
  .sx.is-anim.s4:not(.s5) .t2 .sx-chip { top: 50%; left: 100%; translate: -100% -50%; }
}
.sx.is-anim:not(.s2) .t1 .sx-chip, .sx.is-anim:not(.s4) .t2 .sx-chip { transition: none; }

.sx-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-4) var(--s-6); margin-top: var(--s-6); padding-top: var(--s-5); border-top: 1px solid var(--line); }
.sx-cap { flex: 1 1 28rem; max-width: 62ch; min-height: 3.2em; font-size: var(--t-body); line-height: 1.6; color: var(--ink); text-wrap: pretty; }
.sx-replay[hidden] { display: none; }

/* --------------------------------------------------------- the try-it box */

.try {
  display: grid;
  gap: var(--s-6) clamp(32px, 2rem + 3vw, 96px);
  margin-top: clamp(56px, 2rem + 5vw, 120px);
  padding: clamp(20px, 1rem + 2vw, 48px);
  border: 1.5px solid var(--line);
  border-radius: 24px;
  background: var(--raised);
}
@media (min-width: 960px) { .try { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); } }
.try h3 { font-family: "Fraunces", Georgia, serif; font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); font-weight: 500; line-height: 1.15; font-variation-settings: "opsz" 40, "SOFT" 0, "WONK" 0; }
.try-intro p { margin-top: var(--s-3); max-width: 44ch; font-size: var(--t-body); line-height: 1.6; color: var(--muted); text-wrap: pretty; }
.try-label { font-size: var(--t-small); font-weight: 600; color: var(--muted); }
.try-in {
  display: block; width: 100%; margin: var(--s-2) 0 var(--s-5);
  min-height: 52px; padding: 10px 16px;
  border: 1.5px solid color-mix(in srgb, var(--ink) 38%, transparent);
  border-radius: 14px;
  background: transparent; color: var(--ink);
  font: inherit; font-family: "Fraunces", Georgia, serif; font-size: 1.25rem;
  font-variation-settings: "opsz" 36, "SOFT" 0, "WONK" 0;
}
.try-in:focus-visible { border-color: var(--sec-brass); }
.try-out {
  display: block; margin-top: var(--s-2); padding: var(--s-4);
  min-height: 7.2em; overflow-wrap: anywhere;
  border-radius: 14px; background: rgba(0, 0, 0, 0.22);
  font-size: var(--t-small);
}
.try-meta { margin-top: var(--s-3); font-size: var(--t-small); line-height: 1.5; color: var(--muted); }
.try-open { margin-top: var(--s-5); padding-top: var(--s-5); border-top: 1px solid var(--line); }
.try-open[hidden] { display: none; }
.try-seg { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); margin-top: var(--s-3); }
.try-seg .btn-quiet { min-height: 44px; padding: 8px 18px; font-size: var(--t-small); white-space: normal; }
.try-seg .btn-quiet[aria-pressed="true"] { border-color: var(--sec-brass); background: color-mix(in srgb, var(--sec-brass) 16%, transparent); }
.try-new { min-height: 44px; padding: 8px 6px; background: none; border: 0; color: var(--ink); font: inherit; font-size: var(--t-small); font-weight: 600; text-decoration: underline; text-decoration-color: var(--sec-brass); text-underline-offset: 0.22em; cursor: pointer; }
.try-result { margin-top: var(--s-3); min-height: 3.2em; font-size: var(--t-body); line-height: 1.6; }
.try-result b { font-family: "Fraunces", Georgia, serif; font-weight: 500; }

/* -------------------------------------------------------- four small truths */

.sec-facts { display: grid; gap: 0 var(--s-6); margin-top: clamp(56px, 2rem + 5vw, 120px); }
@media (min-width: 640px) { .sec-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .sec-facts { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.sec-facts li { padding-block: var(--s-6) clamp(24px, 1rem + 1vw, 40px); border-top: 1px solid var(--line); }
.sec-facts h3 { margin-top: var(--s-5); font-size: var(--t-h3); font-weight: 700; line-height: 1.3; letter-spacing: -0.008em; }
.sec-facts p { margin-top: var(--s-2); max-width: 36ch; font-size: var(--t-body); line-height: 1.6; color: var(--muted); text-wrap: pretty; }
.fx { display: block; width: 168px; height: 100px; color: var(--ink); }
.fx .lk, .fx .tick { stroke: var(--sec-brass); }
.fx .dots circle { fill: var(--sec-brass); stroke: var(--sec-brass); transition: fill 0.28s linear; }
.fx .seal, .fx .pupil { fill: var(--sec-brass); stroke: var(--sec-brass); }
.fx .dg { fill: var(--ink); stroke: none; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; transition: opacity 0.3s linear; }
.fx .link-d { stroke: var(--sec-brass); stroke-dasharray: 3 4; transition: stroke-dashoffset 0.8s ease 0.3s; }
.fx .ln { stroke-dasharray: 60 0; transition: stroke-dasharray 0.6s ease 0.1s; }
.fx .tick { stroke-dasharray: 14; transition: stroke-dashoffset 0.45s ease 0.9s; }
.fx .lid { opacity: 0; fill: var(--band); }
.sec-more { margin-top: var(--s-6); font-size: var(--t-body); }

/* Their small purposeful animations, started when each one scrolls into view. */
.sec-facts.is-anim li:not(.in) .fx-device .shackle { transform: translateY(-3.5px) rotate(-22deg); }
.sec-facts.is-anim li:not(.in) .fx-device .ln { stroke-dasharray: 1 7; }
.sec-facts.is-anim li:not(.in) .fx-code .dots circle { fill: transparent; }
.sec-facts.is-anim li:not(.in) .fx-pair .dg { opacity: 0; }
.sec-facts.is-anim li:not(.in) .fx-pair .tick { stroke-dashoffset: 14; }
.sec-facts.is-anim li:not(.in) .fx-pair .link-d { stroke-dashoffset: 28; }
.sec-facts.is-anim li.in .fx-code .dots circle { transition-delay: calc(var(--i, 0) * 70ms + 150ms); }
.fx-code .dots circle:nth-child(2) { --i: 1; } .fx-code .dots circle:nth-child(3) { --i: 2; } .fx-code .dots circle:nth-child(4) { --i: 3; }
.fx-code .dots circle:nth-child(5) { --i: 4; } .fx-code .dots circle:nth-child(6) { --i: 5; } .fx-code .dots circle:nth-child(7) { --i: 6; } .fx-code .dots circle:nth-child(8) { --i: 7; }
.fx-code .dots circle:nth-child(9) { --i: 8; } .fx-code .dots circle:nth-child(10) { --i: 9; } .fx-code .dots circle:nth-child(11) { --i: 10; } .fx-code .dots circle:nth-child(12) { --i: 11; }
.sec-facts.is-anim li.in .fx-eye .pupil { animation: sec-look 5s ease-in-out 1s infinite; }
.sec-facts.is-anim li.in .fx-eye .lid { animation: sec-blink 5s ease-in-out 1s infinite; }
@keyframes sec-look { 0%, 12%, 100% { translate: 0 0; } 30%, 55% { translate: 8px 0; } 70%, 88% { translate: 3px 1px; } }
@keyframes sec-blink { 0%, 60%, 100% { opacity: 0; } 62%, 66% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .sx *, .sec-facts *, .try * { transition: none !important; animation: none !important; }
  .sx-face .z { opacity: 1; }
}

@media (hover: hover) { .try-new:hover { text-decoration-thickness: 2.5px; } }
