/* PredictionPact — a calm, ceremonial contract aesthetic.
   Restrained neutral palette, strong serif display type, generous space. */

:root {
  --paper:      #FAF8F3;   /* warm alabaster background */
  --paper-2:    #FFFFFF;   /* raised cards */
  --ink:        #1C1B18;   /* near-black text */
  --ink-soft:   #4A4740;   /* secondary text */
  --muted:      #8A857A;   /* tertiary / hints */
  --line:       #E6E1D6;   /* hairlines */
  --line-2:     #D9D3C6;
  --accent:     #243044;   /* deep ink-navy — trust */
  --accent-2:   #33445f;
  --seal:       #9A7B4F;   /* restrained gold, used sparingly */
  --seal-soft:  #C7B08A;
  --ok:         #2F6D4F;
  --danger:     #9B3B34;
  --shadow:     0 1px 2px rgba(28,27,24,.05), 0 8px 30px rgba(28,27,24,.06);
  --shadow-lg:  0 4px 12px rgba(28,27,24,.08), 0 20px 50px rgba(28,27,24,.10);
  --radius:     14px;
  --radius-sm:  10px;
  --maxw:       720px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --script:"Caveat", "Segoe Script", cursive;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* subtle paper texture via layered gradients */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(154,123,79,.06), transparent 60%),
    radial-gradient(900px 500px at 100% 110%, rgba(36,48,68,.05), transparent 60%);
  pointer-events: none;
}

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.wrap-narrow { max-width: 560px; }

/* ---------- typography ---------- */
h1, h2, h3 { font-family: var(--serif); font-weight: 560; letter-spacing: -.01em; color: var(--ink); line-height: 1.15; margin: 0 0 .4em; }
h1 { font-size: clamp(2rem, 6vw, 3rem); }
h2 { font-size: clamp(1.4rem, 4vw, 1.9rem); }
h3 { font-size: 1.15rem; }
p  { margin: 0 0 1rem; color: var(--ink-soft); }
a  { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.lede { font-size: 1.12rem; color: var(--ink-soft); }
.eyebrow { font-family: var(--sans); text-transform: uppercase; letter-spacing: .16em; font-size: .72rem; font-weight: 600; color: var(--seal); margin: 0 0 .9rem; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }

/* ---------- top brand bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(250,248,243,.82); backdrop-filter: saturate(180%) blur(10px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; max-width: 960px; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-family: var(--serif); font-weight: 600; font-size: 1.16rem; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand .mark { width: 26px; height: 26px; flex: 0 0 auto; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: var(--sans); font-weight: 600; font-size: 1rem;
  padding: .8rem 1.3rem; border-radius: 999px; border: 1px solid transparent;
  cursor: pointer; transition: transform .06s ease, box-shadow .2s ease, background .2s ease, border-color .2s;
  text-decoration: none; line-height: 1; -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--accent-2); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--muted); text-decoration: none; background: rgba(255,255,255,.6); }
.btn-block { width: 100%; }
.btn-lg { padding: 1rem 1.7rem; font-size: 1.06rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }

/* ---------- cards / sections ---------- */
.card { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.section { padding: 56px 0; }
.section-tight { padding: 34px 0; }

/* ---------- home ---------- */
.hero { text-align: center; padding: 68px 0 40px; }
.hero .lede { max-width: 30rem; margin: 0 auto 1.8rem; }
.hero-cta { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }
.pill-note { display: inline-flex; align-items: center; gap: .5rem; font-size: .8rem; color: var(--muted); margin-top: 1.4rem; }

.steps { display: grid; gap: 16px; grid-template-columns: repeat(3, 1fr); margin-top: 8px; }
.step { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.step .n { font-family: var(--serif); font-size: 1.2rem; color: var(--seal); display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 1px solid var(--seal-soft); border-radius: 50%; margin-bottom: .7rem; }
.step h3 { margin-bottom: .25rem; }
.step p { margin: 0; font-size: .93rem; }

.disclaimer { border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 18px 20px; background: rgba(255,255,255,.5); font-size: .9rem; color: var(--ink-soft); }
.disclaimer strong { color: var(--ink); }

/* preview of an example agreement on the home page */
.preview-frame { position: relative; }
.preview-frame .stamp {
  position: absolute; top: -14px; right: 14px; transform: rotate(6deg);
  font-family: var(--serif); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--seal); border: 1.5px solid var(--seal-soft); border-radius: 6px; padding: .3rem .55rem; background: var(--paper);
}

/* ---------- forms ---------- */
.field { margin-bottom: 20px; }
.field > label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .4rem; color: var(--ink); }
.field .hint { font-size: .82rem; color: var(--muted); margin: .3rem 0 0; }
.field .req { color: var(--seal); }
.input, .textarea {
  width: 100%; font-family: var(--sans); font-size: 1rem; color: var(--ink);
  background: var(--paper-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: .78rem .9rem; transition: border-color .15s, box-shadow .15s; -webkit-appearance: none;
}
.input:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(36,48,68,.12); }
.textarea { resize: vertical; min-height: 92px; line-height: 1.5; }
.field.invalid .input, .field.invalid .textarea { border-color: var(--danger); }
.field .error { color: var(--danger); font-size: .82rem; margin-top: .35rem; display: none; }
.field.invalid .error { display: block; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
fieldset { border: 0; padding: 0; margin: 0 0 8px; }
legend { font-family: var(--serif); font-size: 1.15rem; margin-bottom: 4px; padding: 0; }
.divider-soft { height: 1px; background: var(--line); margin: 28px 0; border: 0; }

/* ---------- status banners / chips ---------- */
.statusbar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: 18px; }
.chip { display: inline-flex; align-items: center; gap: .45rem; font-size: .8rem; font-weight: 600; padding: .35rem .7rem; border-radius: 999px; border: 1px solid var(--line-2); background: var(--paper-2); color: var(--ink-soft); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.chip.draft   .dot { background: var(--seal); }
.chip.waiting .dot { background: #C58B2B; }
.chip.finalized { border-color: var(--ok); color: var(--ok); }
.chip.finalized .dot { background: var(--ok); }

.notice { border-radius: var(--radius-sm); padding: 12px 15px; font-size: .9rem; display: flex; gap: .6rem; align-items: flex-start; }
.notice svg { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 1px; }
.notice-warn { background: #FBF3E4; border: 1px solid #ECD9AE; color: #7A5A18; }
.notice-info { background: #EEF1F6; border: 1px solid #D3DBE8; color: var(--accent); }
.notice-lock { background: #F3F1EC; border: 1px solid var(--line-2); color: var(--ink-soft); }

/* ---------- the agreement / certificate ---------- */
.doc { position: relative; }
.certificate {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
  position: relative;
  overflow: hidden;
}
.certificate::before { /* inner ceremonial frame */
  content: ""; position: absolute; inset: 12px; border: 1px solid var(--line); border-radius: 8px; pointer-events: none;
}
.cert-inner { position: relative; }
.cert-head { text-align: center; padding-bottom: 22px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.cert-head .kicker { font-family: var(--sans); text-transform: uppercase; letter-spacing: .22em; font-size: .68rem; color: var(--seal); font-weight: 600; }
.cert-head h1 { font-size: clamp(1.6rem, 5vw, 2.3rem); margin: .5rem 0 .3rem; }
.cert-head .between { font-size: .95rem; color: var(--muted); }

.statement {
  font-family: var(--serif); font-size: clamp(1.15rem, 3.4vw, 1.5rem); line-height: 1.4;
  color: var(--ink); text-align: center; margin: 6px auto 26px; max-width: 34rem; font-weight: 480;
}
.statement .quote { color: var(--seal-soft); font-size: 1.4em; line-height: 0; vertical-align: -.25em; }

.terms { display: grid; gap: 2px; margin: 8px 0 26px; }
.term { padding: 14px 0; border-bottom: 1px solid var(--line); }
.term:last-child { border-bottom: 0; }
.term .k { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 600; margin-bottom: .25rem; }
.term .v { color: var(--ink); }
.term .v.multiline { white-space: pre-wrap; }

/* resolution date block + countdown */
.resolve {
  text-align: center; margin: 8px auto 26px; padding: 22px; border: 1px solid var(--line);
  border-radius: var(--radius); background: linear-gradient(180deg, rgba(154,123,79,.05), rgba(255,255,255,0));
}
.resolve .k { font-size: .7rem; text-transform: uppercase; letter-spacing: .18em; color: var(--seal); font-weight: 600; }
.resolve .date { font-family: var(--serif); font-size: clamp(1.4rem, 4.6vw, 2rem); margin: .3rem 0 .5rem; }
.countdown { display: inline-flex; gap: 14px; }
.countdown .unit { min-width: 54px; }
.countdown .num { font-family: var(--serif); font-size: 1.5rem; line-height: 1; color: var(--ink); }
.countdown .lbl { font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-top: .3rem; }
.countdown.past .num { color: var(--seal); }
.resolve .past-note { font-size: .9rem; color: var(--seal); margin-top: .3rem; }

/* signatures */
.sigs { display: grid; gap: 18px; grid-template-columns: 1fr 1fr; margin-top: 8px; }
.sig {
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 18px; background: rgba(255,255,255,.6);
  display: flex; flex-direction: column;
}
.sig .role { font-size: .7rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); font-weight: 600; }
.sig .name { font-weight: 600; margin: .15rem 0 auto; }
.sig .signed {
  font-family: var(--script); font-size: 2rem; line-height: 1.1; color: var(--accent); margin-top: 14px;
  border-bottom: 1px solid var(--line-2); padding-bottom: 6px; min-height: 44px; word-break: break-word;
}
.sig .when { font-size: .76rem; color: var(--muted); margin-top: .5rem; }
.sig .pending { margin-top: 14px; min-height: 44px; border-bottom: 1px dashed var(--line-2); padding-bottom: 6px; color: var(--muted); font-style: italic; display: flex; align-items: flex-end; }

.cert-foot { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); font-size: .78rem; color: var(--muted); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.cert-foot .id { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .03em; }
.platform-note { text-align: center; font-size: .82rem; color: var(--muted); margin: 18px auto 0; max-width: 30rem; }

/* seal */
.seal-badge {
  width: 74px; height: 74px; margin: 0 auto 4px; border-radius: 50%;
  border: 2px solid var(--seal-soft); display: flex; align-items: center; justify-content: center;
  color: var(--seal); background: radial-gradient(circle at 50% 35%, rgba(154,123,79,.10), transparent 70%);
}
.seal-badge svg { width: 34px; height: 34px; }

/* ---------- share panel ---------- */
.share-url { display: flex; gap: 8px; align-items: stretch; margin: 6px 0 10px; }
.share-url input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .92rem; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }

/* ---------- sign form ---------- */
.role-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 6px; }
.role-opt { border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 14px; cursor: pointer; background: var(--paper-2); transition: border-color .15s, box-shadow .15s; }
.role-opt:hover { border-color: var(--muted); }
.role-opt.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(36,48,68,.1); }
.role-opt.taken { opacity: .55; cursor: not-allowed; }
.role-opt .role-lbl { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 600; }
.role-opt .role-name { font-weight: 600; margin-top: .15rem; }
.role-opt .role-status { font-size: .78rem; color: var(--ok); margin-top: .2rem; }
.sig-preview { font-family: var(--script); font-size: 2rem; color: var(--accent); min-height: 46px; border-bottom: 1px solid var(--line-2); padding: 4px 2px; margin-top: 6px; }

/* draw / type signature */
.sig-modes { display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 12px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--paper); }
.sig-mode { border: 0; background: transparent; font: inherit; font-weight: 600; font-size: .85rem; color: var(--muted); padding: .42rem 1rem; border-radius: 999px; cursor: pointer; transition: background .15s, color .15s; -webkit-tap-highlight-color: transparent; }
.sig-mode.active { background: var(--accent); color: #fff; }
.sig-pad-wrap { position: relative; }
.sig-pad { width: 100%; height: 170px; display: block; background: var(--paper-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm); touch-action: none; cursor: crosshair; }
.sig-pad-baseline { position: absolute; left: 22px; right: 22px; bottom: 46px; border-bottom: 1px dashed var(--line-2); pointer-events: none; }
.sig-clear { position: absolute; top: 10px; right: 10px; border: 1px solid var(--line-2); background: var(--paper-2); color: var(--ink-soft); font: inherit; font-size: .78rem; font-weight: 600; padding: .32rem .75rem; border-radius: 999px; cursor: pointer; }
.sig-clear:hover { border-color: var(--muted); }
.sig-pad-hint { position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; font-size: .82rem; color: var(--muted); pointer-events: none; }
.sig-img { max-width: 100%; max-height: 62px; margin-top: 14px; align-self: flex-start; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: .7rem 1.1rem; border-radius: 999px; font-size: .9rem; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- misc ---------- */
.center { text-align: center; }
.stack > * + * { margin-top: 14px; }
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 80px 0; color: var(--muted); }
footer.site { text-align: center; padding: 40px 20px; color: var(--muted); font-size: .84rem; border-top: 1px solid var(--line); margin-top: 40px; }
footer.site a { color: var(--ink-soft); }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .steps { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .sigs { grid-template-columns: 1fr; }
  .action-grid { grid-template-columns: 1fr; }
  .role-toggle { grid-template-columns: 1fr; }
  .certificate { padding: 26px 18px; }
  .certificate::before { inset: 8px; }
  .card { padding: 22px; }
  .section { padding: 40px 0; }
}

/* print / pdf snapshot cleanliness */
@media print {
  .topbar, .no-print, footer.site { display: none !important; }
  body { background: #fff; }
  .certificate { box-shadow: none; border-color: #ccc; }
}
