/* security (/security/): the page's own sections. #security is the four steps with their parameters (and the cipher plate
 * motion.js adds); #overview, #keys, #leaves, #threats, #limits and #sources are styled at the end of this file. */
.security-head { display: grid; gap: var(--space-5); max-width: 46rem; margin-bottom: var(--space-8); }

/* The sequence: a numbered rail with one thread running through it, prose, and the exact parameters as a readout. */
.security-steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.security-steps > li { counter-increment: step; position: relative; display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr) minmax(0, 1.1fr); column-gap: var(--space-6);
  padding-bottom: var(--space-8); }
.security-steps > li:last-child { padding-bottom: 0; }
.security-steps > li::before { content: counter(step); grid-column: 1; grid-row: 1 / span 2;
  font: 300 var(--text-3xl) / 0.8 var(--font-display); color: var(--accent); }
/* The thread from one step's numeral down to the next. */
.security-steps > li:not(:last-child)::after { content: ""; position: absolute; inset-inline-start: 0.6rem; top: 4.25rem; bottom: var(--space-3);
  border-inline-start: var(--rule) solid var(--vein); }
.step-text { grid-column: 2; display: grid; gap: var(--space-3); align-content: start;
  padding-top: var(--space-4); border-top: var(--rule) solid var(--vein); }
.step-text p { color: var(--ink-2); max-width: 32em; }

.step-spec { grid-column: 3; margin: 0; padding-top: var(--space-4); border-top: var(--rule) solid var(--ink);
  font-family: var(--font-mono); font-size: var(--text-sm); line-height: 1.45; }
.step-spec > div { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: var(--space-4);
  padding-block: var(--space-2); }
.step-spec > div + div { border-top: var(--rule) solid var(--vein); }
.step-spec dt { font-size: var(--text-xs); letter-spacing: var(--tracking-mono); text-transform: uppercase;
  color: var(--ink-2); padding-top: 0.15em; }
.step-spec dd { margin: 0; color: var(--ink); }

@media (max-width: 1000px) {
  .security-steps > li { grid-template-columns: 3.5rem minmax(0, 1fr); column-gap: var(--space-5); }
  .security-steps > li::before { grid-row: 1 / span 2; }
  .security-steps > li:not(:last-child)::after { inset-inline-start: 0.6rem; top: 3.5rem; }
  .step-text, .step-spec { grid-column: 2; }
  .step-spec { margin-top: var(--space-5); }
}
@media (max-width: 560px) {
  .security-steps > li { grid-template-columns: 2.25rem minmax(0, 1fr); column-gap: var(--space-4); padding-bottom: var(--space-7); }
  .security-steps > li::before { font-size: var(--text-2xl); }
  .security-steps > li:not(:last-child)::after { inset-inline-start: 0.4rem; top: 2.75rem; }
  .step-spec > div { grid-template-columns: minmax(0, 1fr); gap: 0; }
}

/* The encryption sequence (js/motion.js builds it only when motion runs; without it the steps stand as above). One photo
 * tile from the app's grid (the passports in iphone-grid.webp, the hero's own file, so no new download) cut into five
 * pieces that turn to ciphertext, a ledger of the keys being sealed, and the iCloud Drive line the sealed pieces rise to, each under a random name. */
.cipher { --tile: clamp(16rem, 21vw, 19rem); }
.cipher-in { position: relative; width: calc(var(--tile) + 5ch); color: var(--on-deep); }
.cipher-cloud { margin: 0 0 var(--space-6); padding-bottom: var(--space-2); border-bottom: var(--rule) solid var(--deep-line);
  font: 400 var(--text-xs) / 1.45 var(--font-mono); letter-spacing: var(--tracking-mono); text-transform: uppercase; color: var(--on-deep-2); }
.cipher-tile { position: relative; width: var(--tile); }
.piece { position: relative; height: calc(var(--tile) / 5); perspective: 60rem; }
.piece .card { position: absolute; inset: 0; transform-style: preserve-3d; }
.piece .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
/* The tile sits at x 364, y 679, 174 px square in the 720 × 1036 screenshot; each piece shows its fifth of it. */
.piece .photo { background: url(/img/iphone-grid.webp) no-repeat var(--deep);
  background-size: calc(var(--tile) * 720 / 174) auto;
  background-position: calc(var(--tile) * -364 / 174) calc(var(--tile) * -679 / 174 - var(--i) * var(--tile) / 5); }
.piece .code { transform: rotateX(180deg); background: var(--night-surface); color: var(--on-deep-2);
  padding: var(--space-1) var(--space-2); font: 400 0.6875rem / 1.3 var(--font-mono); letter-spacing: 0.04em; word-break: break-all;
  box-shadow: inset 0 0 0 var(--rule) var(--deep-line); }
/* Three whole lines fit every tile size, so no line is cut in half at the piece's edge. On the span: the face itself
 * is stretched to the piece, so a clamp there would still show the next line. */
.piece .code > span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
/* Sealed, a piece shows its random file name as its own first line, a solid band over the ciphertext's first line. */
.piece-name { position: absolute; inset: 0 0 auto; padding: var(--space-1) var(--space-1) 0.15em; padding-inline-start: var(--space-2); background: var(--night-surface);
  border-bottom: var(--rule) solid var(--deep-line); font: 400 0.6875rem / 1.3 var(--font-mono); letter-spacing: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--on-deep); }
.piece-no { position: absolute; inset-inline-start: calc(100% + 1ch); top: 50%; translate: 0 -50%;
  font: 400 var(--text-xs) / 1 var(--font-mono); letter-spacing: 0.04em; color: var(--on-deep-2); }

.cipher-ledger { margin: var(--space-6) 0 0; border-top: var(--rule) solid var(--on-deep);
  font: 400 var(--text-xs) / 1.45 var(--font-mono); }
.cipher-ledger > div { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: var(--space-3); padding-block: var(--space-2);
  border-bottom: var(--rule) solid var(--deep-line); }
.cipher-ledger dt { letter-spacing: var(--tracking-mono); text-transform: uppercase; color: var(--on-deep-2); }
.cipher-ledger dd { margin: 0; display: grid; min-width: 0; }
.cipher-ledger dd, .cipher-ledger dd > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cipher-ledger dd > span { grid-area: 1 / 1; }

/* Wide screens: the plate stays in view (sticky) beside the steps while they scroll; the steps take their narrower form. */
@media (min-width: 1001px) {
  .cipher-on .wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--space-9); }
  .cipher-on .security-head { grid-column: 1 / -1; }
  .cipher-on .security-steps { grid-column: 1; grid-row: 2; }
  .cipher-on .cipher { grid-column: 2; grid-row: 2; }
  .cipher-on .cipher-in { position: sticky; top: calc(var(--top-h, 0px) + var(--space-7)); }
  .cipher-on .security-steps > li { grid-template-columns: 3.5rem minmax(0, 1fr); }
  .cipher-on .step-text, .cipher-on .step-spec { grid-column: 2; }
  .cipher-on .step-spec { margin-top: var(--space-5); }
}
/* Narrow screens: a smaller plate above the steps, played once. */
@media (max-width: 1000px) {
  .cipher { --tile: min(calc(100vw - 2 * var(--gutter) - 5ch), 18rem); margin-bottom: var(--space-8); }
}

/* ---------------------------------------------------------------- the rest of /security/ */
/* Shared: each section's head is the h2 with its lede under it, on the page's left edge. */
:is(.keys-head, .leaves-head, .threats-head, .limits-head) { display: grid; gap: var(--space-5); max-width: 46rem;
  margin-bottom: var(--space-8); }

/* #overview: the short version on one white panel, the page's sections beside it as a contents list. */
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: var(--space-9); align-items: start; }
.overview-panel { background: var(--surface); border-radius: var(--radius-panel); padding: var(--space-7);
  display: grid; gap: var(--space-5); }
.overview-panel h2 { font-size: var(--text-2xl); line-height: 1.05; }
.overview-list { list-style: none; margin: 0; padding: 0; }
.overview-list li { padding-block: var(--space-4); border-top: var(--rule) solid var(--vein); max-width: 38em; }
.overview-list li:last-child { padding-bottom: 0; }
/* The one loss no one can undo: set off by the heavier rule the try ladder uses for "Erased". */
.overview-list .overview-loss { border-top: 3px solid var(--danger); font-weight: 600; }
.overview-nav { display: grid; gap: var(--space-4); }
.overview-nav .readout { color: var(--ink-2); }
.overview-nav ol { margin: 0; padding: 0; list-style: none; border-top: 2px solid var(--ink); }
.overview-nav li { border-bottom: var(--rule) solid var(--vein); }
.overview-nav a { display: block; padding-block: var(--space-3); color: var(--ink); text-decoration: none;
  font: 500 var(--text-lg) / 1.2 var(--font-display); letter-spacing: 0.005em; }
.overview-nav a:hover { color: var(--link); text-decoration: underline; }

/* #keys and #threats: real tables. Row heads in the display face; a heavy rule under the column heads. */
:is(.keys, .threats) { width: 100%; border-collapse: collapse; }
:is(.keys, .threats) thead th { padding: 0 0 var(--space-3); padding-inline-end: var(--space-5); border-bottom: 2px solid var(--ink); text-align: start;
  font: 400 var(--text-xs) / 1.45 var(--font-mono); letter-spacing: var(--tracking-mono); text-transform: uppercase; color: var(--ink-2); }
:is(.keys, .threats) tbody tr { border-bottom: var(--rule) solid var(--vein); }
:is(.keys, .threats) tbody th { padding-block: var(--space-5); padding-inline: 0 var(--space-5); text-align: start; vertical-align: top;
  font: 500 var(--text-xl) / 1.1 var(--font-display); letter-spacing: 0.005em; text-wrap: balance; }
:is(.keys, .threats) td { padding-block: var(--space-5); padding-inline: 0 var(--space-5); vertical-align: top; color: var(--ink-2); }
:is(.keys, .threats) :is(th, td):last-child { padding-inline-end: 0; }
.keys tbody th { width: 20%; }
.keys td { width: 40%; }
.threats tbody th { width: 26%; }
.threats td { width: 37%; }
.threats td:last-child { color: var(--ink); }
.keys-when { display: block; margin-top: var(--space-2); font: 400 var(--text-xs) / 1.45 var(--font-mono);
  letter-spacing: var(--tracking-mono); text-transform: uppercase; color: var(--ink-2); }

.keys-notes { margin-top: var(--space-8); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-7); }
.keys-notes > div { display: grid; gap: var(--space-3); align-content: start; padding-top: var(--space-4); border-top: var(--rule) solid var(--vein); }
.keys-notes p { color: var(--ink-2); }

/* #leaves: the three places anything goes, each with what a holder of it can still see. */
.leaves { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-7); }
.leaves li { display: grid; gap: var(--space-3); align-content: start; padding-top: var(--space-4); border-top: var(--rule) solid var(--on-deep); }
.leaves .readout { color: var(--link); }
.leaves p:not(.readout) { color: var(--ink-2); }
.leaves .leaves-shows { margin-top: var(--space-2); padding-top: var(--space-3); border-top: var(--rule) solid var(--vein); color: var(--ink); }
.leaves-code { margin-top: var(--space-8); padding-top: var(--space-5); border-top: var(--rule) solid var(--vein); max-width: 44em; color: var(--ink); }

/* #limits: the one loss first and largest, the rest under it. */
.limits-first { display: grid; gap: var(--space-4); max-width: 46rem; padding-top: var(--space-5); border-top: 6px solid var(--danger); }
.limits-first h3 { font-size: var(--text-3xl); line-height: 1; }
.limits-first p { font-size: var(--text-lg); line-height: 1.5; color: var(--ink); }
/* Two groups under the loss: limits every vault shares, then Secrates' own choices; the audit stands alone. */
.limits-group { margin-top: var(--space-9); display: grid; gap: var(--space-5); }
.limits-group > h3 { font-size: var(--text-2xl); line-height: 1.05; }
.limits-audit { max-width: 46rem; }
.limits-audit p { color: var(--ink-2); }
.limits-rest h4 { font: 500 var(--text-xl) / 1.1 var(--font-display); margin: 0; text-wrap: balance; }
.limits-rest { list-style: none; margin: 0; padding: 0; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: var(--space-7) var(--space-6); }
.limits-rest li { display: grid; gap: var(--space-3); align-content: start; padding-top: var(--space-4); border-top: var(--rule) solid var(--vein); }
.limits-rest p { color: var(--ink-2); max-width: 38em; }

/* #sources: the standards as a ruled list beside the head. */
.sources-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: var(--space-6) var(--space-9); align-items: start; }
.sources-head { display: grid; gap: var(--space-5); }
.sources { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.sources li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: var(--space-2) var(--space-5); align-items: baseline;
  padding-block: var(--space-3); border-bottom: var(--rule) solid var(--vein); }
.sources a { font: 500 var(--text-lg) / 1.2 var(--font-display); letter-spacing: 0.005em; }
.sources span { color: var(--ink-2); font-size: var(--text-sm); }
.sources-more { grid-column: 2; color: var(--ink-2); }

@media (max-width: 1000px) {
  .keys-notes, .leaves { grid-template-columns: minmax(0, 1fr); gap: var(--space-6); }
  .sources-grid { grid-template-columns: minmax(0, 1fr); }
  .sources-more { grid-column: 1; }
}
@media (max-width: 860px) {
  .overview-grid { grid-template-columns: minmax(0, 1fr); gap: var(--space-7); }
}
/* Phones: each table row becomes a block, its cells labelled by their column (the label is visual only: the table keeps
 * its roles and its column heads for screen readers). */
@media (max-width: 760px) {
  :is(.keys, .threats), :is(.keys, .threats) :is(tbody, tr, th, td) { display: block; }
  :is(.keys, .threats) tbody :is(th, td) { width: auto; }
  :is(.keys, .threats) thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  :is(.keys, .threats) tbody tr:first-child { border-top: 2px solid var(--ink); }
  :is(.keys, .threats) tbody tr { padding-block: var(--space-5); }
  :is(.keys, .threats) tbody th { padding: 0 0 var(--space-3); }
  :is(.keys, .threats) td { padding: var(--space-2) 0 0; }
  :is(.keys, .threats) td::before { content: attr(data-label); content: attr(data-label) / ""; display: block; margin-bottom: var(--space-1);
    font: 400 var(--text-xs) / 1.45 var(--font-mono); letter-spacing: var(--tracking-mono); text-transform: uppercase; color: var(--ink-2); }
  .keys-when { display: inline-block; margin: 0 0 0 var(--space-2); }
}
@media (max-width: 560px) {
  .overview-panel { padding: var(--space-5); }
  .sources li { grid-template-columns: minmax(0, 1fr); }
}
