/* OpenKept website styles. Tokens come from DESIGN.md (front matter); keep them in sync. */
@font-face {
  font-family: "Source Sans 3";
  src: url("fonts/source-sans-3-latin-var.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
}

:root {
  --vault: #0E3A2D;
  --vault-raised: #134A39;
  --vault-lid: #16523F;
  --brass: #C9A54B;
  --brass-hover: #D4B25C;
  --brass-deep: #9C7F33;
  --ivory: #F1EDE3;
  --on-vault-muted: #CFD6CC;
  --paper: #F6F6F2;
  --sheet: #FFFFFF;
  --ink: #14231C;
  --ink-muted: #5A6660;
  --rule: #D9DDD6;
  --error: #B3362E;
  /* status words on vault surfaces (DESIGN.md: the light-surface ones are 2.1:1 on green) */
  --success-on-vault: #9ED9B5;
  --warning-on-vault: #E8B860;
  --error-on-vault: #F2938A;
  --display: "Zodiak", Georgia, serif;
  --body: "Source Sans 3", system-ui, sans-serif;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --ease-enter: cubic-bezier(.2, .8, .2, 1);
  --ease-open: cubic-bezier(.3, .9, .25, 1);
}

* { box-sizing: border-box; margin: 0; }
html { background: var(--vault); }
body { font-family: var(--body); font-size: 18px; line-height: 1.55; color: var(--ivory); background: var(--vault);
       -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; text-underline-offset: 3px; }
/* browser surfaces carry the palette too (DR7) */
:root { accent-color: var(--brass); caret-color: var(--brass); scrollbar-color: var(--vault-lid) var(--vault); }
::selection { background: var(--brass); color: var(--vault); }
body.light { scrollbar-color: var(--rule) var(--paper); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--ivory); outline-offset: 3px; }

.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 40px; }
@media (max-width: 720px) { .wrap { padding: 0 20px; } }

/* header */
.top { display: flex; justify-content: space-between; align-items: center; padding: 28px 0; }
.logo { display: inline-flex; align-items: center; gap: 12px; font: 700 26px var(--display); letter-spacing: -0.01em;
        text-decoration: none; }
.mark { width: 30px; height: 30px; border: 2px solid var(--brass); border-radius: 6px; position: relative; flex: none; }
.mark::after { content: ""; position: absolute; left: -2px; right: -2px; top: 9px; border-top: 2px solid var(--brass); }
.nav { display: flex; gap: 24px; }
.nav a { text-decoration: none; font-weight: 600; font-size: 16px; color: var(--on-vault-muted); }
.nav a:hover { color: var(--ivory); }

/* primary button: brass on vault (DESIGN.md button-primary) */
.btn { display: inline-block; font: 600 18px var(--body); border: 0; border-radius: var(--r-md); padding: 16px 26px;
       background: var(--brass); color: var(--vault); text-decoration: none; cursor: pointer;
       transition: transform .2s var(--ease-enter), box-shadow .2s var(--ease-enter), background .15s; }
.btn:hover { background: var(--brass-hover); transform: translateY(-2px); box-shadow: 0 6px 0 -2px var(--brass-deep); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

/* splash */
.splash { flex: 1; display: grid; grid-template-columns: 1.05fr 1fr; align-items: center; gap: 48px; padding-bottom: 72px; }
.splash h1 { font: 700 clamp(2.8rem, 6vw, 5.2rem)/1 var(--display); letter-spacing: -0.03em; max-width: 12ch; }
.splash h1 .word { display: inline-block; opacity: 0; transform: translateY(14px); animation: rise .6s var(--ease-enter) forwards; }
.splash .lede { font-size: 20px; color: var(--on-vault-muted); margin: 24px 0 34px; max-width: 36ch;
                opacity: 0; animation: rise .6s .45s var(--ease-enter) forwards; }
.splash .cta { opacity: 0; animation: rise .6s .6s var(--ease-enter) forwards; }
.splash .fine { margin-top: 16px; font-size: 15px; color: var(--on-vault-muted); }
@keyframes rise { to { opacity: 1; transform: none; } }
@media (max-width: 900px) { .splash { grid-template-columns: 1fr; gap: 24px; padding-bottom: 48px; } }

/* the box: hinged lid lifts, the firm's card rises out (DESIGN.md "the one authored moment") */
.scene { position: relative; height: 420px; display: grid; place-items: center; perspective: 1400px; }
.box { width: min(340px, 86vw); height: 240px; position: relative; transform-style: preserve-3d; transform: rotateX(8deg); }
.box-base { position: absolute; inset: 0; background: var(--vault-raised); border: 2px solid var(--brass); border-radius: 12px; }
.box-lid { position: absolute; inset: 0 0 auto 0; height: 46%; background: var(--vault-lid); border: 2px solid var(--brass);
           border-radius: 12px 12px 4px 4px; transform-origin: top center; z-index: 3;
           transition: transform 1.1s var(--ease-open) .5s; }
.box-latch { position: absolute; left: 50%; bottom: -2px; width: 34px; height: 12px; margin-left: -17px;
             border: 2px solid var(--brass); border-top: 0; border-radius: 0 0 6px 6px; }
.box-card { position: absolute; left: 18px; right: 18px; bottom: 18px; z-index: 2; background: var(--ivory); color: var(--vault);
            border-radius: 8px; padding: 16px 18px; opacity: 0; transform: translateY(30px);
            transition: opacity .7s var(--ease-open) 1.25s, transform .7s var(--ease-open) 1.25s; }
.box-card b { display: block; font: 700 22px var(--display); }
.box-card span { font-size: 15px; color: var(--vault-lid); }
.box.open .box-lid { transform: rotateX(-118deg); }
.box.open .box-card { opacity: 1; transform: translateY(-168px); }
@media (max-width: 900px) { .scene { height: 320px; } }

/* inner pages: light paper surface for reading (DESIGN.md: light for long reads) */
.page { background: var(--paper); color: var(--ink); flex: 1; }
.page .inner { max-width: 760px; padding: 64px 0 96px; }
.page h1 { font: 700 clamp(2.2rem, 4.5vw, 3.4rem)/1.05 var(--display); letter-spacing: -0.02em; color: var(--vault); }
.page h2 { font: 700 1.5rem/1.2 var(--display); letter-spacing: -0.01em; color: var(--vault); margin: 56px 0 10px; }
.page p, .page li { color: var(--ink); max-width: 62ch; }
.page p + p { margin-top: 14px; }
.page .lede { font-size: 20px; color: var(--ink-muted); margin-top: 18px; }
.promises { list-style: none; padding: 0; margin-top: 28px; display: grid; gap: 28px; }
.promises li b { display: block; font: 700 1.25rem var(--display); color: var(--vault); margin-bottom: 4px; }
.facts { margin-top: 16px; border-top: 1px solid var(--rule); }
.facts div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.facts dt { color: var(--ink-muted); }
.facts dd { margin: 0; text-align: right; }
.page .btn { margin-top: 40px; }
.page .btn:focus-visible { outline-color: var(--vault); }
.page-top { background: var(--vault); }

/* start form */
.form { margin-top: 32px; display: grid; gap: 18px; max-width: 440px; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: 15px; color: var(--ink); }
.form input, .form textarea { font: 18px var(--body); color: var(--ink); background: var(--sheet); border: 1px solid var(--rule);
                              border-radius: var(--r-sm); padding: 12px 14px; }
.form input:focus-visible, .form textarea:focus-visible { outline: 2px solid var(--vault); outline-offset: 1px; }
.form .btn { margin-top: 8px; justify-self: start; }
.notice { margin-top: 24px; padding: 16px 18px; border-radius: var(--r-md); background: var(--sheet); border: 1px solid var(--rule);
          max-width: 520px; }
.notice.error { border-color: var(--error); }
.notice.error b { color: var(--error); }
[hidden] { display: none !important; }

footer { color: var(--on-vault-muted); font-size: 14px; padding: 24px 0 32px; }
body.light { background: var(--paper); }
body.light footer { color: var(--ink-muted); }

/* ---------- setup screens (U8; PLAN.md DR1-DR14) ---------- */
[tabindex="-1"]:focus { outline: none; }   /* headings focused for screen readers, not keyboard users */
.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; }
.who { display: flex; align-items: center; gap: 14px; font-size: 15px; color: var(--on-vault-muted); }
.who form { display: inline; }
.linkish { font: inherit; color: var(--ivory); background: none; border: 0; padding: 0; cursor: pointer;
           text-decoration: underline; text-underline-offset: 3px; min-height: 44px; }
.setup { flex: 1; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 56px; align-items: start;
         padding-top: 24px; padding-bottom: 72px; }
.setup h1 { font: 700 clamp(2.2rem, 4.4vw, 3.6rem)/1.05 var(--display); letter-spacing: -0.02em; max-width: 16ch;
            overflow-wrap: anywhere; }
.setup .lede { font-size: 19px; color: var(--on-vault-muted); margin-top: 16px; max-width: 46ch; }
.setup h2 { font: 700 1.35rem/1.2 var(--display); letter-spacing: -0.01em; margin: 44px 0 12px; }
.setup .scene { position: sticky; top: 24px; }
.heading-row { display: flex; align-items: flex-start; gap: 18px; }
.mini-box { display: none; }
.where { margin: 28px 0 14px; font-size: 16px; color: var(--on-vault-muted); }
.where b { color: var(--ivory); font-weight: 600; }
.where small { display: block; font-size: 14px; margin-top: 2px; }
.region-pick { display: flex; gap: 18px; margin: 4px 0 14px; border: 0; padding: 0; }
.region-pick label { display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.fine { margin-top: 14px; font-size: 15px; color: var(--on-vault-muted); }
.btn.working { cursor: progress; }
.btn.working:hover { transform: none; box-shadow: none; background: var(--brass); }
.btn-quiet { display: inline-flex; align-items: center; min-height: 44px; font: 600 16px var(--body); color: var(--ivory);
             background: transparent; border: 1px solid rgba(241, 237, 227, .45); border-radius: var(--r-md);
             padding: 10px 18px; cursor: pointer; text-decoration: none; }
.btn-quiet:hover { border-color: var(--ivory); }
.disclose { margin-top: 26px; }
.disclose > button { font: 600 16px var(--body); color: var(--ivory); background: none; border: 0; padding: 0; min-height: 44px;
                     cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.disclose > button::after { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor;
                            border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-3px);
                            transition: transform .2s var(--ease-enter); }
.disclose > button[aria-expanded="true"]::after { transform: rotate(-135deg) translateY(-1px); }
.disclose .summary { font-size: 15px; color: var(--on-vault-muted); margin-top: 2px; }

/* AI model rows: aligned rows, not cards (DR12) */
.models { margin-top: 14px; border-top: 1px solid rgba(241, 237, 227, .18); }
.model { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center;
         padding: 12px 0; border-bottom: 1px solid rgba(241, 237, 227, .18); }
.model input[type=checkbox], .model input[type=radio] { width: 20px; height: 20px; margin: 0; }
.model .name { font-weight: 600; }
.model .name span { font-weight: 400; color: var(--on-vault-muted); }
.model .place { grid-column: 2; font-size: 14px; color: var(--on-vault-muted); }
.model .default { display: flex; align-items: center; gap: 6px; font-size: 14px; min-height: 44px; cursor: pointer; }
.model.off .name { opacity: .6; }                  /* the muted line under it is faint enough already (contrast) */
.model .note { grid-column: 2 / 4; font-size: 14px; }
.sizes { margin: 14px 0 0; padding: 0; border: 0; }
.sizes legend { font-weight: 600; padding: 0; margin-bottom: 4px; }
.sizes.off { opacity: .6; }
.sizes .size { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 6px 0; font-size: 15px;
  cursor: pointer; }
.sizes .size input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; }
.sizes .size-text { display: flex; flex-direction: column; gap: 2px; }
.sizes .size-text strong { font-weight: 600; }
.sizes .size-text span { font-size: 14px; color: var(--on-vault-muted); }
.sizes .place { font-size: 14px; color: var(--on-vault-muted); }
.region-only { display: flex; align-items: center; gap: 10px; margin-top: 14px; min-height: 44px; font-size: 15px; }
.region-only input { width: 20px; height: 20px; }

/* status words: every color also has a word (DESIGN.md) */
.ok { color: var(--success-on-vault); }
.wait { color: var(--warning-on-vault); }
.bad { color: var(--error-on-vault); }
.saved-note { font-size: 14px; }

/* the steps, ticking off for real (DESIGN.md: spin then tick) */
.now { font: 700 1.5rem/1.25 var(--display); margin-top: 26px; }
.expect { margin-top: 8px; color: var(--on-vault-muted); max-width: 48ch; }
.steps { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 4px; font-variant-numeric: tabular-nums; }
.steps li { display: grid; grid-template-columns: 26px 1fr; align-items: center; gap: 10px; min-height: 36px;
            color: var(--on-vault-muted); }
.steps li::before { content: ""; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(241, 237, 227, .35); }
.steps li[data-state=done] { color: var(--ivory); }
.steps li[data-state=done]::before { border-color: var(--success-on-vault); background:
  linear-gradient(45deg, transparent 44%, var(--success-on-vault) 44% 56%, transparent 56%) 3px 5px / 6px 6px no-repeat,
  linear-gradient(-45deg, transparent 44%, var(--success-on-vault) 44% 56%, transparent 56%) 6px 2px / 9px 9px no-repeat; }
.steps li[data-state=working] { color: var(--ivory); font-weight: 600; }
.steps li[data-state=working]::before { border-color: var(--brass) transparent var(--brass) var(--brass); animation: spin 1s linear infinite; }
.steps li[data-state=stopped] { color: var(--ivory); font-weight: 600; }
.steps li[data-state=stopped]::before { border-color: var(--error-on-vault); background:
  linear-gradient(var(--error-on-vault), var(--error-on-vault)) center / 8px 2px no-repeat; }
.steps .word { font-size: 13px; font-weight: 400; margin-left: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
.message { margin-top: 22px; padding: 16px 18px; border-radius: var(--r-md); background: var(--vault-raised); max-width: 52ch; }
.message b { display: block; }

/* the two people: signature lines (DESIGN.md "Two signature lines") */
.signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 20px; }
.signature { border-top: 1px solid var(--ivory); padding-top: 8px; }
.signature .who-name { font: 700 1.25rem var(--display); overflow-wrap: anywhere; }
.signature .role { font-size: 14px; color: var(--on-vault-muted); }
.signature .state { font-size: 14px; font-weight: 600; margin-top: 4px; }
.people-form { display: grid; gap: 22px; margin-top: 14px; max-width: 560px; }
.people-form fieldset { border: 0; padding: 0; display: grid; gap: 10px; }
.people-form legend { font-weight: 600; margin-bottom: 6px; }
.field { display: grid; gap: 4px; font-size: 14px; font-weight: 600; }
.field input { font: 17px var(--body); color: var(--ivory); background: var(--vault-raised);
               border: 1px solid rgba(241, 237, 227, .35); border-radius: var(--r-sm); padding: 11px 12px; min-height: 44px; }
.field input:focus-visible, .field select:focus-visible { outline: 2px solid var(--ivory); outline-offset: 1px; }
.field select { font: 17px var(--body); color: var(--ivory); background: var(--vault-raised); min-height: 44px;
                border: 1px solid rgba(241, 237, 227, .35); border-radius: var(--r-sm); padding: 8px 10px; }
.field[hidden], .people-form fieldset[hidden] { display: none; }
/* A change to who can open the records, waiting to be finished (PLAN.md "key generations"). */
.change-card { border: 1px solid var(--vault-lid); background: var(--vault-raised); border-radius: var(--r-md);
               padding: 16px 20px; margin-top: 18px; max-width: 560px; }
.change-card h3 { font: 600 19px/1.3 var(--body); margin: 0 0 6px; }
.change-card p { margin: 6px 0; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 400; }
.check input { width: 20px; height: 20px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-top: 10px; }
.inline-form .field { flex: 1 1 240px; }
.form-error { color: var(--error-on-vault); font-size: 15px; margin-top: 8px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 30px; }
.box-plate { position: absolute; left: 14%; right: 14%; bottom: 14%; z-index: 4; text-align: center; color: var(--ivory);
             font: 700 22px/1.15 var(--display); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
             overflow: hidden; overflow-wrap: anywhere; transition: opacity .3s; }
.box-plate.long { font-size: 20px; }
.box.open .box-plate { opacity: 0; }
.box-card .card-name { display: block; font: 700 22px/1.15 var(--display); overflow-wrap: anywhere; outline: none;
                       display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.box-card .card-name.long { font-size: 20px; }
.box-card .address { font-size: 14px; color: var(--vault-lid); overflow-wrap: anywhere; }
.box-card .card-people { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.box-card .card-people li { font-size: 13px; font-weight: 600; background: var(--vault); color: var(--ivory);
                            border-radius: var(--r-sm); padding: 3px 8px; opacity: 0; transform: scale(.8);
                            transition: opacity .2s var(--ease-enter), transform .2s var(--ease-enter); }
.box-card .card-people li.pending { background: transparent; color: var(--warning); border: 1px solid var(--warning);
                                    opacity: 1; transform: none; transition: none; }
.box.open .box-card .card-people li { opacity: 1; transform: none; }
.box.open .box-card .card-people li:nth-child(1) { transition-delay: 2.1s; }
.box.open .box-card .card-people li:nth-child(2) { transition-delay: 2.35s; }
.opening { flex: 1; display: grid; justify-items: center; align-content: start; gap: 8px; padding: 12px 0 72px; text-align: center; }
.opening .scene { width: 100%; height: 460px; }
.opening .box { width: min(400px, 88vw); height: 270px; }
.box.open.tall .box-card { transform: translateY(-190px); }
.box.still, .box.still * { transition: none !important; }        /* the box already opened: shown, not replayed */
.keep-together { white-space: nowrap; }
.invite { opacity: 0; transition: opacity .4s var(--ease-enter) .6s; }   /* after the people pop in */
.opening.done .invite { opacity: 1; }

@media (max-width: 900px) {
  .setup { grid-template-columns: 1fr; gap: 0; padding-top: 4px; }
  .setup > .scene { display: none; }
  .mini-box { display: block; flex: none; width: 96px; height: 72px; position: relative; margin-top: 4px; }
  .mini-box .mini-base { position: absolute; inset: 0; background: var(--vault-raised); border: 2px solid var(--brass); border-radius: 9px; }
  .mini-box .mini-lid { position: absolute; inset: 0 0 auto 0; height: 44%; background: var(--vault-lid);
                        border: 2px solid var(--brass); border-radius: 9px 9px 3px 3px; }
  .heading-row h1 { flex: 1; min-width: 0; }
  .setup .btn { width: 100%; text-align: center; min-height: 52px; }
  .signatures { grid-template-columns: 1fr; }
  .who .name { display: none; }
  .opening .scene { height: 380px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important;
                           transition-duration: .01ms !important; transition-delay: 0s !important; }
  .splash h1 .word, .splash .lede, .splash .cta { opacity: 1; transform: none; }
  .steps li[data-state=working]::before { animation: none; border-color: var(--brass); }
}
