/* ==========================================================================
   FORAY site — shared stylesheet
   Design tokens carried from the page previously live at foray.dunin7.com.
   Style only.
   Served same-origin; no external stylesheets, no external JS.
   ========================================================================== */

/* Typography — IBM Plex, self-hosted. SIL OFL at /fonts/LICENSE-IBM-Plex.txt */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url('/fonts/ibm-plex-sans-var.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/ibm-plex-mono-400.woff2') format('woff2');
}

:root {
  --primary-teal: #0D7377;
  --secondary-navy: #1B365D;
  --accent-cyan: #14B8B8;
  --highlight-mint: #7DD3D6;
  --action-amber: #E6A817;
  --text-light: #F7F9FA;
  --bg-dark: #1A1D21;
  --gray-600: #636E72;
  --gray-400: #94A3A8;
  --hairline: rgba(125, 211, 214, 0.1);
  --measure: 46rem;
  --mono: 'IBM Plex Mono', 'Space Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-dark);
  color: var(--text-light);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent-cyan); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--highlight-mint); text-decoration: underline; }

/* --- Nav ---------------------------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 2rem;
  padding: 1rem 2rem;
  background: rgba(26, 29, 33, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--hairline);
}
.nav-logo { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; }
.nav-logo:hover { text-decoration: none; }
.nav-logo .mark { color: var(--primary-teal); }
.nav-logo .word { color: var(--text-light); font-weight: 400; }
.nav-links { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: center; margin-left: auto; }
.nav-link { color: var(--gray-400); font-size: 0.9rem; font-weight: 500; }
.nav-link:hover { color: var(--accent-cyan); text-decoration: none; }
.nav-link[aria-current="page"] { color: var(--text-light); }
.nav-link.pending {
  color: var(--gray-600);
  cursor: default;
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
}
.nav-link.pending::after {
  content: 'soon';
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--action-amber);
  border: 1px solid rgba(230, 168, 23, 0.35);
  border-radius: 3px;
  padding: 0.05rem 0.3rem;
}

/* Preview-only banner. Removed before anything ships to production. */
.preview-banner {
  background: rgba(230, 168, 23, 0.12);
  border-bottom: 1px solid rgba(230, 168, 23, 0.3);
  color: var(--action-amber);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-align: center;
  padding: 0.5rem 1rem;
}

/* --- Hero --------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 5rem 2rem 4rem;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(13, 115, 119, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(20, 184, 184, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(230, 168, 23, 0.05) 0%, transparent 60%);
  pointer-events: none;
}
.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(125, 211, 214, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(125, 211, 214, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  animation: gridMove 20s linear infinite;
  pointer-events: none;
}
@keyframes gridMove {
  0% { transform: translate(0, 0); }
  100% { transform: translate(60px, 60px); }
}
.hero-content { position: relative; z-index: 1; max-width: 1200px; margin-inline: auto; }
.hero-title {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
}
.hero-title-gradient {
  background: linear-gradient(135deg, var(--accent-cyan), var(--highlight-mint), var(--action-amber));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-subtitle {
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  color: var(--gray-400);
  max-width: 900px;
  line-height: 1.7;
}
.hero-subtitle strong { color: var(--text-light); font-weight: 500; }
.page-hero { padding: 4rem 2rem 2rem; }
.page-hero .hero-title { font-size: clamp(2rem, 4vw, 3rem); }

/* --- Sections ----------------------------------------------------------- */
.section { position: relative; max-width: 1200px; margin: 0 auto; padding: 3rem 2rem; }
.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--action-amber);
  margin-bottom: 1rem;
}
.section-title {
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  max-width: var(--measure);
}
.prose { max-width: var(--measure); }
.prose p { margin-bottom: 1.1rem; }
.prose p.muted { color: var(--gray-400); }
.prose p:last-child { margin-bottom: 0; }
.prose ul { margin: 0 0 1.1rem 1.2rem; }
.prose li { margin-bottom: 0.5rem; }
.lede { font-size: 1.15rem; line-height: 1.7; }

/* --- Cards -------------------------------------------------------------- */
.statement {
  background: linear-gradient(135deg, rgba(13, 115, 119, 0.1), rgba(27, 54, 93, 0.2));
  border: 1px solid rgba(125, 211, 214, 0.15);
  border-left: 3px solid var(--primary-teal);
  border-radius: 16px;
  padding: 2rem;
  max-width: var(--measure);
}
.statement-title { font-size: 1.25rem; font-weight: 600; margin-bottom: 1rem; color: var(--highlight-mint); }
.statement p { margin-bottom: 1rem; }
.statement p:last-child { margin-bottom: 0; }
.statement .close { font-size: 1.1rem; font-weight: 600; color: var(--text-light); margin-top: 1.5rem; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1.25rem; }
.card {
  background: rgba(26, 29, 33, 0.8);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 1.5rem;
}
.card h3 { font-size: 1.02rem; font-weight: 600; color: var(--highlight-mint); margin-bottom: 0.6rem; }
.card p { font-size: 0.95rem; color: var(--gray-400); }
.card p + p { margin-top: 0.7rem; }
.card a { font-size: 0.9rem; }

.defs { max-width: var(--measure); }
.defs dt { font-weight: 600; color: var(--highlight-mint); margin-top: 1.5rem; }
.defs dt:first-child { margin-top: 0; }
.defs dd { margin-top: 0.35rem; }

.column-title { font-size: 1.15rem; font-weight: 600; color: var(--accent-cyan); margin: 2.5rem 0 0.75rem; }

/* --- Anchors ------------------------------------------------------------ */
.anchor {
  background: linear-gradient(135deg, rgba(27, 54, 93, 0.3), rgba(13, 115, 119, 0.1));
  border: 1px solid rgba(13, 115, 119, 0.2);
  border-left: 3px solid var(--primary-teal);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  max-width: var(--measure);
}
.anchor .label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--action-amber);
  margin-bottom: 0.5rem;
}
.anchor .note { color: var(--gray-400); font-size: 0.95rem; margin-bottom: 0.8rem; }
.txid {
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.6;
  word-break: break-all;
  display: block;
}
.txid-link { display: inline-block; margin-top: 0.7rem; font-size: 0.9rem; font-weight: 500; }
code { font-family: var(--mono); font-size: 0.88em; color: var(--highlight-mint); }

/* --- Buttons ------------------------------------------------------------ */
.btn-row { display: flex; flex-wrap: wrap; gap: 1rem; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.6rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid var(--gray-600);
  color: var(--text-light);
}
.btn:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); text-decoration: none; }
.btn.pending { color: var(--gray-600); border-color: rgba(99, 110, 114, 0.4); cursor: default; }
.btn.pending:hover { color: var(--gray-600); border-color: rgba(99, 110, 114, 0.4); }

/* --- Footer ------------------------------------------------------------- */
.footer {
  border-top: 1px solid var(--hairline);
  max-width: 1200px;
  margin: 3rem auto 0;
  padding: 2.5rem 2rem 3rem;
  font-size: 0.88rem;
  color: var(--gray-400);
}
.footer-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.footer-mark { font-weight: 700; letter-spacing: -0.02em; color: var(--text-light); font-size: 1rem; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.footer-nav a { color: var(--gray-400); }
.footer-nav span { color: var(--gray-600); }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; }

@media (max-width: 768px) {
  .nav { padding: 0.85rem 1.25rem; gap: 0.75rem 1rem; }
  .nav-links { gap: 1rem; width: 100%; margin-left: 0; }
  .hero { padding: 3.5rem 1.25rem 2.5rem; }
  .section { padding: 2.5rem 1.25rem; }
  .footer { padding: 2rem 1.25rem 2.5rem; }
  .statement, .anchor, .card { padding: 1.5rem 1.25rem; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-grid { animation: none; }
}

/* --- Tamper demonstration ---------------------------------------------- */
.tamper-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 1.25rem;
}
.tamper-panel {
  background: rgba(26, 29, 33, 0.8);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 1.25rem;
  min-width: 0;
}
.tamper-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--action-amber);
  margin-bottom: 0.9rem;
}
.tamper-panel pre {
  overflow-x: auto;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.9rem;
}
.tamper-panel code {
  font-family: var(--mono);
  font-size: 0.76rem;
  line-height: 1.65;
  color: var(--text-light);
  /* pre-wrap: the record is a single line; it wraps visually for display
     without any newline being inserted into the text, so selection, copy
     and the hashed bytes stay identical. */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.tamper-digit {
  color: var(--bg-dark);
  background: var(--action-amber);
  border-radius: 3px;
  padding: 0 0.18em;
  font-weight: 600;
}
.tamper-hash {
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.6;
  word-break: break-all;
  color: var(--gray-400);
}
.tamper-hash span { color: var(--highlight-mint); }

/* Copy button — rendered by the inline script only; the page is fully
   functional without JS, in which case no button appears. */
.copy-btn {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-light);
  background: transparent;
  border: 1px solid var(--gray-600);
  border-radius: 6px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.copy-btn:hover { color: var(--accent-cyan); border-color: var(--accent-cyan); }
.copy-btn.copied { color: var(--action-amber); border-color: var(--action-amber); }
.caution { font-size: 0.9rem; }

/* Formatted-view modal — native <dialog>, opened by the inline script. */
.panel-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.record-modal {
  /* The global `* { margin: 0 }` reset overrides the UA stylesheet's
     `margin: auto` on <dialog>, which is what centres a modal. Restore it. */
  margin: auto;
  border: 1px solid rgba(125, 211, 214, 0.2);
  border-radius: 16px;
  background: var(--bg-dark);
  color: var(--text-light);
  padding: 0;
  max-width: min(46rem, calc(100vw - 2.5rem));
  width: 100%;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
.record-modal::backdrop { background: rgba(10, 12, 14, 0.72); }
.record-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--hairline);
}
.record-modal-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--action-amber);
}
.record-modal-close {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-light);
  background: transparent;
  border: 1px solid var(--gray-600);
  border-radius: 6px;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
}
.record-modal-close:hover { color: var(--accent-cyan); border-color: var(--accent-cyan); }
.record-modal pre {
  margin: 1.2rem 1.4rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  overflow-x: auto;
}
.record-modal code {
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.65;
  color: var(--text-light);
  white-space: pre;
}
.record-modal-foot {
  margin: 0;
  padding: 0 1.4rem 1.3rem;
  font-size: 0.85rem;
  color: var(--gray-400);
}

/* Annotation comments in the documentation example. */
.anno { color: var(--action-amber); }

/* Specification page — the normative artifact rendered in house style. */
.spec-status { list-style: none; margin: 0; }
.spec-status li { margin-bottom: 0.7rem; padding-inline-start: 1rem; border-inline-start: 2px solid var(--hairline); }
.spec-status li:last-child { margin-bottom: 0; }
.spec-body { max-width: 52rem; }
.spec-body h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 700; letter-spacing: -0.02em; margin: 2.5rem 0 1rem; }
.spec-body h2 { font-size: 1.35rem; font-weight: 650; margin: 2.2rem 0 0.8rem; padding-top: 1.2rem; border-top: 1px solid var(--hairline); }
.spec-body h3 { font-size: 1.08rem; font-weight: 600; color: var(--highlight-mint); margin: 1.7rem 0 0.6rem; }
.spec-body h4 { font-size: 0.98rem; font-weight: 600; margin: 1.3rem 0 0.5rem; }
.spec-body p { margin-bottom: 1rem; }
.spec-body ul, .spec-body ol { margin: 0 0 1rem 1.3rem; }
.spec-body li { margin-bottom: 0.4rem; }
.spec-body code { font-family: var(--mono); font-size: 0.86em; color: var(--highlight-mint); }
.spec-body pre { background: rgba(0,0,0,0.3); border-radius: 8px; padding: 1rem; overflow-x: auto; margin-bottom: 1.2rem; }
.spec-body pre code { color: var(--text-light); font-size: 0.78rem; line-height: 1.6; }
/* --- Tables -------------------------------------------------------------
   One treatment for every table on the site, whether hand-authored inside a
   .table-scroll wrapper or produced by the markdown render inside .spec-body.
   Header rows follow the .section-label convention (amber, uppercase, tracked).
   On narrow viewports the table scrolls horizontally rather than squeezing:
   .table-scroll scrolls the wrapper; .spec-body tables scroll themselves,
   since the markdown render emits no wrapper to hang it on.
   ---------------------------------------------------------------------- */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1.4rem;
  max-width: var(--measure);
  /* Wide tables (4+ columns of hash-length content) exceed --measure even on
     desktop, not just mobile — found on /proofs' mapping tables, where the
     canonical-name column silently scrolled off-screen with no visible cue.
     A persistent, visible scrollbar replaces the OS-default hover-only one
     so the extra content is never mistaken for missing. */
  scrollbar-width: thin;
  scrollbar-color: var(--gray-400) transparent;
}
.table-scroll::-webkit-scrollbar { height: 8px; }
.table-scroll::-webkit-scrollbar-track { background: transparent; }
.table-scroll::-webkit-scrollbar-thumb {
  background: var(--gray-400);
  border-radius: 4px;
}
.table-scroll::-webkit-scrollbar-thumb:hover { background: var(--accent-cyan); }

table,
.spec-body table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 1.4rem;
  font-size: 0.92rem;
  background: rgba(26, 29, 33, 0.6);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  overflow: hidden;
}
.table-scroll table { margin-bottom: 0; min-width: 34rem; }
/* The markdown render emits bare tables; make the element itself the
   scroll container so long spec tables never squeeze their columns. */
.spec-body table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

th, td,
.spec-body th, .spec-body td {
  text-align: left;
  vertical-align: top;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--hairline);
}
thead th,
.spec-body th {
  color: var(--action-amber);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(230, 168, 23, 0.06);
  border-bottom: 1px solid rgba(230, 168, 23, 0.28);
  white-space: nowrap;
}
tbody tr:nth-child(even),
.spec-body tbody tr:nth-child(even) { background: rgba(125, 211, 214, 0.03); }
tbody tr:last-child td,
.spec-body tbody tr:last-child td { border-bottom: none; }
td code, th code { white-space: nowrap; }
.spec-body blockquote { margin: 1rem 0; padding: 0.6rem 1rem; border-inline-start: 3px solid var(--primary-teal); color: var(--gray-400); }
.spec-body hr { border: none; border-top: 1px solid var(--hairline); margin: 2rem 0; }
