/* ============================================================================
   Office of F. Tejland — Registry of Filed Instruments
   Bone-dry legal aesthetic: parchment, serif, restrained.
   ========================================================================= */

:root {
  --paper:        #f4ecd8;
  --paper-dark:   #ebe0c2;
  --ink:          #1a1a1a;
  --ink-soft:     #3a3a3a;
  --rule:         #1a1a1a;
  --rule-soft:    #888;
  --green:        #1f5e3a;
  --amber:        #8a6116;
  --grey:         #5a5a5a;
  --stamp-red:    #b1212c;
  --paper-shadow: rgba(0, 0, 0, 0.08);
  --modal-veil:   rgba(20, 16, 8, 0.55);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper-dark);
  color: var(--ink);
  font-family: "EB Garamond", "Libre Caslon Text", Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.page {
  background: var(--paper);
  max-width: 760px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 36px 28px 80px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.06), 0 4px 30px var(--paper-shadow);
}

/* -------- Letterhead -------- */
.letterhead {
  text-align: center;
  border-bottom: 2px solid var(--rule);
  padding-bottom: 18px;
  margin-bottom: 28px;
  position: relative;
}
.letterhead .seal {
  width: 56px; height: 56px;
  border: 1.5px solid var(--rule);
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: serif;
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 10px;
  color: var(--ink-soft);
  background: var(--paper);
}
.letterhead .seal span {
  display: block;
  text-align: center;
  line-height: 1.1;
}
.letterhead h1 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 4px;
  text-transform: uppercase;
  margin: 4px 0 2px;
}
.letterhead .sub {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* -------- Section / page titles -------- */
.docket-title, .doc-title {
  text-align: center;
  margin: 30px 0 22px;
}
.docket-title h2, .doc-title h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 1px;
  margin: 0 0 6px;
}
.docket-title .label, .doc-title .label {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-top: 1px solid var(--rule-soft);
  border-bottom: 1px solid var(--rule-soft);
  padding: 4px 14px;
  margin-top: 4px;
}

/* -------- Cards (registry) -------- */
.cards { display: flex; flex-direction: column; gap: 18px; }

.card {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 18px 20px;
  position: relative;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
  color: inherit;
  display: block;
}
.card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.10);
}
.card .case-no {
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.card h3 {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}
.card .meta {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 12px;
}
.card .meta span { white-space: nowrap; }
.card .meta .sep { margin: 0 8px; color: var(--rule-soft); }

.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid currentColor;
  border-radius: 2px;
}
.badge.green { color: var(--green); }
.badge.grey  { color: var(--grey); }
.badge.amber { color: var(--amber); }

.intro {
  font-size: 14px;
  color: var(--ink-soft);
  text-align: center;
  margin: 0 auto 24px;
  max-width: 540px;
  line-height: 1.5;
}

/* -------- Modal (decoy rejections) -------- */
.modal-veil {
  position: fixed; inset: 0;
  background: var(--modal-veil);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}
.modal-veil.open { display: flex; }

.modal {
  background: var(--paper);
  border: 1px solid var(--rule);
  max-width: 460px;
  width: 100%;
  padding: 28px 26px 22px;
  box-shadow: 0 12px 50px rgba(0,0,0,0.4);
  font-family: inherit;
}
.modal .modal-label {
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--stamp-red);
  border-bottom: 1px solid var(--stamp-red);
  padding-bottom: 6px;
  margin-bottom: 14px;
  text-align: center;
}
.modal h4 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 12px;
  text-align: center;
}
.modal p {
  font-size: 14.5px;
  margin: 0 0 18px;
  color: var(--ink-soft);
  line-height: 1.55;
}
.modal .modal-close {
  display: block;
  margin: 0 auto;
  background: transparent;
  border: 1px solid var(--rule);
  padding: 8px 22px;
  font: inherit;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
}
.modal .modal-close:hover { background: var(--ink); color: var(--paper); }

/* -------- Contract content (accord page) -------- */
.recitals { margin: 22px 0 32px; }
.recitals p { margin: 0 0 12px; text-align: justify; }
.recitals .small-caps {
  font-variant: small-caps;
  letter-spacing: 1.5px;
  font-weight: 600;
}

.article { margin: 26px 0; }
.article h3 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 5px;
  margin: 0 0 14px;
}
.article p, .article li { text-align: justify; }
.article ol {
  list-style: none;
  padding-left: 0;
  margin: 0;
}
.article ol li {
  margin: 0 0 10px;
  padding-left: 42px;
  position: relative;
}
.article ol li .clause-no {
  position: absolute;
  left: 0;
  top: 0;
  font-weight: 600;
  width: 36px;
}
.article .schedule-note {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 14.5px;
}

/* -------- Execution block (signing) -------- */
.execution {
  margin-top: 40px;
  border-top: 2px solid var(--rule);
  padding-top: 26px;
}
.execution h3 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-align: center;
  margin: 0 0 22px;
}

.signature-block {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  margin-bottom: 22px;
}
@media (min-width: 620px) {
  .signature-block { grid-template-columns: 1fr 1fr; }
}

.party {
  border: 1px solid var(--rule);
  padding: 14px 14px 10px;
  background: var(--paper);
}
.party .role {
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.party .name {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
}
.party .sig-line {
  border-top: 1px solid var(--rule);
  margin-top: 38px;
  padding-top: 4px;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.party.pre-signed .pre-sig {
  font-family: "Brush Script MT", "Lucida Handwriting", "Snell Roundhand", cursive;
  font-size: 28px;
  color: var(--ink);
  margin: 10px 0 -4px;
  transform: rotate(-2deg);
  display: inline-block;
}

/* Signature canvas */
.sigpad-wrap {
  border: 1px dashed var(--rule);
  background: #fbf6e7;
  border-radius: 2px;
  position: relative;
  margin-top: 10px;
}
.sigpad-wrap canvas {
  display: block;
  width: 100%;
  height: 120px;
  touch-action: none;
  cursor: crosshair;
}
.sigpad-clear {
  position: absolute;
  top: 6px;
  right: 6px;
  background: transparent;
  border: none;
  font: inherit;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink-soft);
  cursor: pointer;
}
.sigpad-clear:hover { color: var(--stamp-red); }

/* Form fields */
.field {
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
}
.field label {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 5px;
}
.field input[type="text"] {
  font: inherit;
  font-size: 16px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--rule);
  padding: 4px 0;
  color: var(--ink);
  outline: none;
}
.field input[type="text"]:focus { border-bottom-color: var(--stamp-red); }
.field input[type="text"]::placeholder { color: var(--rule-soft); font-style: italic; }

.agreement {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  margin: 18px 0;
  cursor: pointer;
}
.agreement input { margin-top: 4px; flex-shrink: 0; }

.btn-execute {
  display: block;
  width: 100%;
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 4px;
  text-transform: uppercase;
  padding: 16px 18px;
  border: none;
  cursor: pointer;
  margin-top: 10px;
  transition: background 0.15s ease;
}
.btn-execute:hover:not(:disabled) { background: var(--stamp-red); }
.btn-execute:disabled { background: var(--rule-soft); cursor: not-allowed; }

.error-msg {
  background: rgba(177, 33, 44, 0.08);
  border: 1px solid var(--stamp-red);
  color: var(--stamp-red);
  font-size: 13px;
  padding: 10px 12px;
  margin: 12px 0;
  display: none;
}
.error-msg.show { display: block; }

/* -------- EXECUTED stamp & post-sign reveal -------- */
.page.executed { position: relative; }

.executed-stamp {
  position: absolute;
  top: 180px;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-12deg) scale(2.4);
  color: var(--stamp-red);
  border: 5px solid var(--stamp-red);
  border-radius: 6px;
  padding: 10px 22px;
  font-size: 38px;
  font-weight: 700;
  letter-spacing: 6px;
  font-family: "Times New Roman", serif;
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  text-transform: uppercase;
  background: rgba(244, 236, 216, 0.0);
}
.executed-stamp.slam {
  animation: stamp-slam 0.55s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}
@keyframes stamp-slam {
  0%   { transform: translate(-50%, -50%) rotate(-12deg) scale(2.4); opacity: 0; }
  60%  { transform: translate(-50%, -50%) rotate(-8deg)  scale(1.05); opacity: 1; }
  80%  { transform: translate(-50%, -50%) rotate(-9deg)  scale(0.95); opacity: 1; }
  100% { transform: translate(-50%, -50%) rotate(-9deg)  scale(1);    opacity: 0.92; }
}

.embossed-seal {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 2px double var(--stamp-red);
  color: var(--stamp-red);
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 8.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-family: inherit;
  background: var(--paper);
  box-shadow: inset 0 0 0 2px var(--paper), 0 2px 10px rgba(0,0,0,0.15);
  z-index: 25;
  padding: 12px;
  line-height: 1.25;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.5s ease 0.4s;
}
.embossed-seal.show {
  display: flex;
  opacity: 1;
}

.post-sign-note {
  margin-top: 24px;
  padding: 16px 18px;
  border: 1px solid var(--rule);
  background: var(--paper-dark);
  font-size: 14px;
  color: var(--ink-soft);
  text-align: center;
  display: none;
}
.post-sign-note.show { display: block; }

/* -------- Celebration overlay (post-sign Numa Numa) -------- */
.celebration {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.45s ease;
}
.celebration.show {
  display: flex;
  opacity: 1;
}
.celebration-frame {
  position: relative;
  width: 100%;
  max-width: 760px;
  aspect-ratio: 16 / 9;
  background: #000;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  border-radius: 4px;
  overflow: hidden;
}
.celebration-frame iframe,
.celebration-frame video {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.celebration-close {
  position: absolute;
  top: -42px;
  right: -2px;
  background: transparent;
  border: none;
  color: #fff;
  font: inherit;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 6px 10px;
  opacity: 0.85;
}
.celebration-close:hover { opacity: 1; }
.celebration-caption {
  position: absolute;
  bottom: -38px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(244, 236, 216, 0.65);
}

@media (max-width: 540px) {
  .celebration { padding: 16px; }
  .celebration-close { top: -36px; font-size: 26px; }
  .celebration-caption { font-size: 9px; letter-spacing: 2px; bottom: -28px; }
}

/* -------- Footer -------- */
.foot {
  margin-top: 50px;
  text-align: center;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* -------- Mobile tweaks -------- */
@media (max-width: 540px) {
  body { font-size: 16px; }
  .page { padding: 26px 18px 60px; }
  .letterhead h1 { font-size: 12px; letter-spacing: 3px; }
  .card h3 { font-size: 17px; }
  .executed-stamp { font-size: 28px; padding: 8px 16px; letter-spacing: 4px; }
  .embossed-seal { width: 90px; height: 90px; font-size: 7.5px; bottom: 14px; right: 14px; }
}
