/* Stake — a paper contract on a wooden desk. Serious, warm, mobile-first. */

:root {
  --paper: #f3efe6;
  --paper-2: #e8e1d2;
  --card: #faf7f0;
  --ink: #1c1915;
  --ink-soft: #5c564c;
  --line: #d4ccb8;
  --gold: #9a7b3c;
  --gold-soft: #c4a86a;
  --seal: #8c2f24;
  --seal-deep: #6b2119;
  --seal-soft: #f4e4df;
  --forest: #1f6b45;
  --forest-soft: #e3f0e8;
  --amber: #8a5a12;
  --amber-soft: #f5ebd6;
  --shadow: 0 1px 1px rgba(28, 25, 21, 0.04), 0 8px 28px rgba(28, 25, 21, 0.08);
  --serif: "Cormorant Garamond", "Palatino Linotype", Palatino, "Times New Roman", serif;
  --sans: "Figtree", "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "SF Mono", ui-monospace, monospace;
  --max: 42rem;
  --wide: 58rem;
  --radius: 4px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.6;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, #fff8ea 0%, transparent 60%),
    var(--paper);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

[hidden] { display: none !important; }

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--ink);
  color: var(--paper);
  padding: 0.5rem 0.8rem;
  z-index: 10;
}
.skip:focus { top: 0.5rem; }

a { color: var(--seal); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--seal-deep); }

code {
  font-family: var(--mono);
  font-size: 0.84em;
  background: var(--paper-2);
  padding: 0.08em 0.35em;
  border-radius: 3px;
  word-break: break-all;
}

/* ── header ── */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.4rem;
  max-width: var(--wide);
  margin: 0 auto;
  width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--ink);
}
.brand:hover { color: var(--ink); }

.seal {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #c45a4a, var(--seal) 55%, var(--seal-deep));
  color: #f6e6d8;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.2rem;
  box-shadow: 0 0 0 2px #e8c4b8 inset, 0 1px 2px rgba(80, 16, 10, 0.35);
  line-height: 1;
}

.brand-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.55rem;
  letter-spacing: 0.02em;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 500;
}
.nav a {
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.2rem 0;
  border-bottom: 2px solid transparent;
}
.nav a:hover, .nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--gold);
}

/* ── main ── */

main {
  flex: 1;
  width: 100%;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0.5rem 1.4rem 3.5rem;
}

.view { animation: rise 0.35s ease; }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .view { animation: none; }
}

.hero {
  max-width: 38rem;
  padding: 1.5rem 0 1rem;
}

.kicker {
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 0.8rem;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.18;
  margin: 0 0 0.6rem;
}

.hero h1 {
  font-size: clamp(2.2rem, 5.4vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.9rem;
}
.hero h1 em {
  font-style: italic;
  font-weight: 500;
  color: var(--seal);
}

.lede {
  font-size: 1.14rem;
  color: var(--ink);
  margin: 0 0 1.5rem;
}

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-bottom: 0.9rem;
}

.cta-note {
  font-size: 0.92rem;
  color: var(--ink-soft);
  max-width: 36rem;
  margin: 0;
}

/* ── buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.7rem 1.2rem;
  border-radius: var(--radius);
  border: 1.5px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  text-decoration: none;
  line-height: 1.2;
  transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { background: #2c2822; color: var(--paper); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 3px solid var(--gold-soft);
  outline-offset: 2px;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  background: var(--seal);
  border-color: var(--seal-deep);
  color: #fbf3ef;
  box-shadow: 0 1px 0 var(--seal-deep);
}
.btn.primary:hover { background: var(--seal-deep); color: #fbf3ef; }

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn.ghost:hover { background: var(--paper-2); color: var(--ink); }

.btn.success { background: var(--forest); border-color: #164e32; color: #f3faf6; }
.btn.success:hover { background: #164e32; color: #f3faf6; }
.btn.danger { background: var(--seal); border-color: var(--seal-deep); color: #fbf3ef; }
.btn.warn { background: var(--amber); border-color: #6b450c; color: #fff8eb; }

.btn.small { padding: 0.4rem 0.75rem; font-size: 0.9rem; font-weight: 500; }

/* ── honesty box ── */

.honest {
  background: var(--seal-soft);
  border-left: 4px solid var(--seal);
  padding: 1.1rem 1.25rem 1.15rem;
  margin: 2.2rem 0 2.4rem;
  max-width: 40rem;
}
.honest h2 {
  font-size: 1.35rem;
  margin-bottom: 0.35rem;
  color: var(--seal-deep);
}
.honest p { margin: 0; color: var(--ink); }
.shares .honest,
#stake-root > .honest {
  margin: 0 0 1.1rem;
  max-width: none;
}

/* ── three steps ── */

.steps-row {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 720px) {
  .steps-row { grid-template-columns: repeat(3, 1fr); gap: 1.4rem; }
}
.steps-row li {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.2rem 1.25rem;
}
.steps-row .n {
  display: inline-block;
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 0.3rem;
}
.steps-row h3 { font-size: 1.3rem; margin-bottom: 0.3rem; }
.steps-row p { margin: 0; color: var(--ink-soft); font-size: 0.98rem; }

/* ── page heads ── */

.page-head { margin: 1rem 0 1.6rem; max-width: var(--max); }
.page-head h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
.page-head p { margin: 0; color: var(--ink-soft); }

/* ── forms ── */

.contract-form, .verify-form, .wallet-form {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 1.4rem 1.35rem 1.5rem;
  max-width: var(--max);
}

.field, fieldset.field {
  margin: 0 0 1.15rem;
  border: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}
.field label, .field legend {
  font-weight: 600;
  font-size: 0.95rem;
}
.hint-inline {
  font-weight: 400;
  color: var(--ink-soft);
  font-style: italic;
}
.help {
  margin: 0;
  font-size: 0.86rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

input[type="text"], input[type="number"], input[type="datetime-local"], textarea {
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.55rem 0.7rem;
  width: 100%;
}
textarea { resize: vertical; min-height: 4.5rem; }
input:invalid:not(:placeholder-shown):not(:focus),
textarea:invalid:not(:placeholder-shown):not(:focus) {
  border-color: var(--seal);
}

.with-unit {
  display: flex;
  align-items: stretch;
  gap: 0;
}
.with-unit input { border-right: 0; border-radius: var(--radius) 0 0 var(--radius); }
.with-unit span {
  display: flex;
  align-items: center;
  padding: 0 0.8rem;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

.row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 1.1rem;
}
@media (min-width: 600px) {
  .row { grid-template-columns: 1fr 1fr; }
}

.choice {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-weight: 400;
  margin-top: 0.35rem;
  cursor: pointer;
}
.choice input { margin-top: 0.3rem; accent-color: var(--seal); }

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}
.form-error, .verify-out, .flash {
  margin: 0.8rem 0 0;
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
}
.form-error, .bad {
  background: var(--seal-soft);
  color: var(--seal-deep);
}
.ok { background: var(--forest-soft); color: #164e32; }
.warn-box { background: var(--amber-soft); color: var(--amber); }

/* ── the contract document ── */

.contract {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 1.6rem 1.4rem 1.7rem;
  position: relative;
  max-width: 40rem;
}
.contract::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid var(--paper-2);
  pointer-events: none;
}

.contract-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--gold-soft);
}

.contract h1 {
  font-size: 2rem;
  margin: 0 0 0.2rem;
}
.contract .status-kicker {
  margin: 0;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--gold);
}

.stamp {
  flex: 0 0 auto;
  width: 5.4rem;
  height: 5.4rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  text-align: center;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.15;
  transform: rotate(-14deg);
  border: 3px solid currentColor;
  background: transparent;
  color: var(--gold);
  opacity: 0.9;
}
.stamp.locked { color: var(--seal); }
.stamp.succeeded { color: var(--forest); }
.stamp.failed { color: var(--seal); }
.stamp.timed_out { color: var(--amber); }

.dl {
  display: grid;
  grid-template-columns: 8.2rem 1fr;
  gap: 0.45rem 1rem;
  margin: 0 0 1.2rem;
  font-size: 0.98rem;
}
.dl dt {
  color: var(--ink-soft);
  font-weight: 500;
}
.dl dd { margin: 0; word-break: break-word; }
.dl .hash { font-family: var(--mono); font-size: 0.78rem; line-height: 1.45; }

.goal-reveal {
  background: var(--paper);
  border: 1px dashed var(--gold);
  padding: 0.9rem 1rem;
  margin: 0 0 1.2rem;
}
.goal-reveal h3 {
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 0.35rem;
  font-family: var(--sans);
  font-weight: 600;
}
.goal-reveal blockquote {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-style: italic;
  line-height: 1.35;
  white-space: pre-wrap;
}
.goal-reveal .match {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  font-weight: 600;
}
.goal-reveal .match.ok { background: none; color: var(--forest); padding: 0; }
.goal-reveal .match.bad { background: none; color: var(--seal); padding: 0; }

.shares, .actions, .clock {
  margin: 1.1rem 0 0;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}
.shares h2, .actions h2, .clock h2, .wallet-card h2 {
  font-size: 1.25rem;
  margin-bottom: 0.4rem;
}
.share-row {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0.7rem 0;
}
.share-row label { font-weight: 600; font-size: 0.92rem; }
.share-row .copy-line {
  display: flex;
  gap: 0.4rem;
}
.share-row input {
  font-family: var(--mono);
  font-size: 0.78rem;
  flex: 1;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.6rem;
}

.outcome {
  margin: 1.1rem 0 0;
  padding: 1rem 1.05rem;
  border-left: 4px solid var(--forest);
  background: var(--forest-soft);
}
.outcome.failed { border-color: var(--seal); background: var(--seal-soft); }
.outcome.timed_out { border-color: var(--amber); background: var(--amber-soft); }
.outcome h2 { margin-bottom: 0.25rem; }
.outcome p { margin: 0; }

/* ── how / prose ── */

.prose { max-width: var(--max); }
.prose h2 { font-size: 1.6rem; margin: 1.8rem 0 0.5rem; }
.prose p, .prose li { margin: 0 0 0.8rem; }
.prose ol, .prose ul { padding-left: 1.25rem; }
.prose .verify-form { margin-top: 0.8rem; }

/* ── wallet ── */

.wallet-card {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 1.3rem 1.3rem 1.4rem;
  max-width: var(--max);
  margin-bottom: 1.1rem;
}
.wallet-card p { margin: 0 0 0.8rem; }
.kv {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0.3rem 0.8rem;
  font-size: 0.95rem;
  margin: 0.6rem 0 1rem;
}
.kv dt { color: var(--ink-soft); }
.kv dd { margin: 0; word-break: break-all; font-family: var(--mono); font-size: 0.82rem; }

.banner {
  background: var(--amber-soft);
  border-left: 4px solid var(--gold);
  padding: 0.85rem 1rem;
  margin: 0 0 1.2rem;
  max-width: var(--max);
  font-size: 0.98rem;
}

/* ── footer ── */

.foot {
  border-top: 1px solid var(--line);
  padding: 1.2rem 1.4rem 2rem;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.88rem;
}
.foot p { margin: 0.2rem 0; }
.foot-links a { color: var(--ink-soft); }

.noscript {
  margin: 1rem;
  padding: 1rem;
  background: var(--seal-soft);
}

/* ── tiny screens ── */

@media (max-width: 720px) {
  .top {
    flex-wrap: wrap;
    align-items: center;
    padding: 0.85rem 1rem 0.7rem;
    gap: 0.55rem 1rem;
  }
  .nav {
    flex-basis: 100%;
    justify-content: flex-start;
    gap: 0.15rem 1rem;
    font-size: 0.92rem;
  }
}
@media (max-width: 520px) {
  .top { padding: 0.85rem 1rem 0.7rem; }
  main { padding: 0.3rem 1rem 2.8rem; }
  .dl { grid-template-columns: 1fr; gap: 0.1rem 0; }
  .dl dt { margin-top: 0.45rem; font-size: 0.82rem; }
  .contract { padding: 1.2rem 1rem 1.3rem; }
  .stamp { width: 4.4rem; height: 4.4rem; font-size: 0.8rem; }
  .form-actions { justify-content: stretch; }
  .form-actions .btn { flex: 1; }
  .kv { grid-template-columns: 1fr; }
}
