/* Timepoint site styles. Front-end owns the HTML.
   Linked from site/templates/layout.html as /site/css/site.css.
   Load /fonts/fonts.css as well so the brand faces resolve.

   Theme: leave data-theme unset to follow prefers-color-scheme.
   html[data-theme="light"] and html[data-theme="dark"] override it.

   Hooks for page bodies:
   .tp-doors > a.tp-door
   p.tp-verdict[data-verdict="route"|"no-route"|"no_route"]
   article.tp-preview
     .tp-odds .tp-odds-value
     ul.tp-stances .tp-role .tp-stance
     .tp-turning
     ol.tp-moves
     .tp-nearest
*/

:root {
  color-scheme: light;
  --bg-void: #fefcf8;
  --bg-deep: #f5f1ea;
  --bg-panel: #ede9e0;
  --bg-card: #ffffff;
  --bg-card-hover: #f9f6f1;
  --gold: #9a6f22;
  --gold-bright: #b8852a;
  --gold-ink: #6e4d12;
  --gold-wash: #f6edd8;
  --ice: #1a7a9a;
  --ice-ink: #145e7a;
  --ice-wash: #e7f3f7;
  --ivory: #1a1510;
  --text-primary: #2d2520;
  --text-secondary: #6b6055;
  --border: #d8d0c4;
  --border-strong: #b7ab9c;
  --focus: #6e4d12;
  --on-gold: #fefcf8;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: Sora, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --gutter: 16px;
  --measure: 68ch;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg-void: #06080d;
    --bg-deep: #0c1016;
    --bg-panel: #12171f;
    --bg-card: #161c26;
    --bg-card-hover: #1c2430;
    --gold: #c9a84c;
    --gold-bright: #d4a24e;
    --gold-ink: #e8c56b;
    --gold-wash: #2a2416;
    --ice: #7eb8c9;
    --ice-ink: #9fd0dc;
    --ice-wash: #12262c;
    --ivory: #e8e0d0;
    --text-primary: #e8e0d0;
    --text-secondary: #b7aea3;
    --border: #2a3140;
    --border-strong: #3d4758;
    --focus: #e8c56b;
    --on-gold: #1a1408;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-void: #06080d;
  --bg-deep: #0c1016;
  --bg-panel: #12171f;
  --bg-card: #161c26;
  --bg-card-hover: #1c2430;
  --gold: #c9a84c;
  --gold-bright: #d4a24e;
  --gold-ink: #e8c56b;
  --gold-wash: #2a2416;
  --ice: #7eb8c9;
  --ice-ink: #9fd0dc;
  --ice-wash: #12262c;
  --ivory: #e8e0d0;
  --text-primary: #e8e0d0;
  --text-secondary: #b7aea3;
  --border: #2a3140;
  --border-strong: #3d4758;
  --focus: #e8c56b;
  --on-gold: #1a1408;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg-void: #fefcf8;
  --bg-deep: #f5f1ea;
  --bg-panel: #ede9e0;
  --bg-card: #ffffff;
  --bg-card-hover: #f9f6f1;
  --gold: #9a6f22;
  --gold-bright: #b8852a;
  --gold-ink: #6e4d12;
  --gold-wash: #f6edd8;
  --ice: #1a7a9a;
  --ice-ink: #145e7a;
  --ice-wash: #e7f3f7;
  --ivory: #1a1510;
  --text-primary: #2d2520;
  --text-secondary: #6b6055;
  --border: #d8d0c4;
  --border-strong: #b7ab9c;
  --focus: #6e4d12;
  --on-gold: #fefcf8;
}

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

html {
  overflow-x: clip;
}

body.tp-site {
  margin: 0;
  min-width: 0;
  overflow-x: clip;
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
}

body.tp-site::before {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse at 50% -8%, var(--gold-wash), transparent 52%);
  opacity: 0.35;
}

img,
svg,
video,
canvas {
  max-width: 100%;
  height: auto;
}

p,
h1,
h2,
h3,
li,
dd,
figcaption {
  overflow-wrap: anywhere;
}

pre,
table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.tp-skip {
  position: absolute;
  left: var(--gutter);
  top: 0.4rem;
  z-index: 20;
  transform: translateY(-160%);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--border-strong);
  text-decoration: none;
}

.tp-skip:focus,
.tp-skip:focus-visible {
  transform: none;
}

.tp-header,
.tp-main,
.tp-footer {
  position: relative;
  z-index: 1;
}

.tp-wrap {
  width: min(1120px, 100%);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.tp-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg-void) 92%, transparent);
  border-bottom: 1px solid var(--border);
}

.tp-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  min-height: 4rem;
}

.tp-brand {
  margin-right: auto;
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 1.2rem;
}

.tp-nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.tp-nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
}

.tp-nav-links a:hover {
  color: var(--text-primary);
}

.tp-btn,
a.tp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--gold-ink);
  background: var(--gold-ink);
  color: var(--on-gold);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

a.tp-btn:hover {
  color: var(--on-gold);
}

.tp-main {
  padding-block: 2rem 4rem;
}

.tp-main h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.3rem, 6vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin: 0 0 0.75rem;
}

.tp-main h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  line-height: 1.1;
  margin: 2rem 0 0.6rem;
}

.tp-main h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.35rem;
  margin: 0 0 0.35rem;
}

.tp-main p,
.tp-main li {
  color: var(--text-secondary);
}

.tp-main a {
  color: var(--ice-ink);
}

/* Buttons keep their own ink; the body link colour must not reach them. */
.tp-main a.tp-btn,
.tp-main a.tp-btn:hover {
  color: var(--on-gold);
}

.tp-kicker {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-ink);
  margin: 0 0 0.75rem;
}

.tp-lede {
  max-width: var(--measure);
}

.tp-doors,
.tp-pair {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

.tp-door,
.tp-card {
  display: block;
  min-width: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1.1rem 1rem 1.2rem;
  color: inherit;
  text-decoration: none;
}

a.tp-door:hover,
.tp-card:hover {
  background: var(--bg-card-hover);
}

.tp-door strong,
.tp-door h2 {
  display: block;
  margin: 0 0 0.4rem;
  color: var(--text-primary);
  font-family: var(--serif);
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 500;
  line-height: 1.1;
  text-transform: none;
}

.tp-verdict {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  padding: 0.4rem 0.75rem 0.4rem 0.55rem;
  border: 1px solid transparent;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--text-primary);
}

.tp-verdict::before {
  content: "";
  width: 1.15rem;
  height: 1.15rem;
  flex: none;
  background: currentColor;
}

.tp-verdict[data-verdict="route"] {
  color: var(--gold-ink);
  background: var(--gold-wash);
  border-color: var(--gold-ink);
}

.tp-verdict[data-verdict="route"]::before {
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='black' d='M1.5 12h4.4l2.3-6.2h5.2v1.7H9.2L6.9 13.5H1.5z'/><circle cx='2.6' cy='12' r='1.5'/><circle cx='13.3' cy='4.4' r='1.5'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='black' d='M1.5 12h4.4l2.3-6.2h5.2v1.7H9.2L6.9 13.5H1.5z'/><circle cx='2.6' cy='12' r='1.5'/><circle cx='13.3' cy='4.4' r='1.5'/></svg>") center / contain no-repeat;
}

.tp-verdict[data-verdict="no-route"],
.tp-verdict[data-verdict="no_route"] {
  color: var(--ice-ink);
  background: var(--ice-wash);
  border-color: var(--ice-ink);
}

.tp-verdict[data-verdict="no-route"]::before,
.tp-verdict[data-verdict="no_route"]::before {
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><circle cx='8' cy='8' r='5.25' fill='none' stroke='black' stroke-width='1.8'/><circle cx='8' cy='8' r='1.55'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><circle cx='8' cy='8' r='5.25' fill='none' stroke='black' stroke-width='1.8'/><circle cx='8' cy='8' r='1.55'/></svg>") center / contain no-repeat;
}

.tp-preview {
  display: grid;
  gap: 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1.15rem 1rem 1.3rem;
  min-width: 0;
}

.tp-preview h1,
.tp-preview h2 {
  margin-top: 0;
}

.tp-odds {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.8rem;
  margin: 0;
  color: var(--text-primary);
}

.tp-odds-value {
  font-family: var(--serif);
  font-size: clamp(3rem, 8vw, 4.5rem);
  line-height: 0.9;
  color: var(--gold-ink);
}

.tp-stances,
.tp-moves {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.tp-stances li,
.tp-moves li {
  display: grid;
  gap: 0.15rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.tp-role,
.tp-move-n {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-ink);
}

.tp-stance {
  color: var(--text-primary);
}

.tp-turning {
  margin: 0;
  padding: 0.7rem 0.85rem;
  border-left: 3px solid var(--gold-ink);
  background: var(--bg-deep);
  color: var(--text-primary);
}

.tp-nearest {
  margin: 0;
  padding: 0.8rem 0.9rem;
  background: var(--ice-wash);
  color: var(--ice-ink);
  border: 1px solid var(--ice-ink);
}

.tp-label {
  display: block;
  margin-bottom: 0.3rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.tp-main input,
.tp-main textarea,
.tp-main select {
  width: 100%;
  max-width: 36rem;
  min-width: 0;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-primary);
  font: inherit;
}

.tp-footer {
  border-top: 1px solid var(--border);
  padding-block: 1.4rem 2rem;
  color: var(--text-secondary);
}

.tp-footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

.tp-footer a:hover {
  color: var(--text-primary);
}

.tp-copy {
  margin: 0.6rem 0 0;
}

.tp-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.tp-promises,
.tp-cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

.tp-promise,
.tp-door,
.tp-meeting-card,
.tp-route-card,
.tp-moment,
.tp-seal,
.tp-legal,
.tp-404 {
  min-width: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1.1rem 1rem 1.25rem;
}

.tp-doors {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

.tp-label,
.tp-meta {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-ink);
}

.tp-meta {
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--text-secondary);
}

.tp-card-route > .tp-label,
.tp-route-card[data-verdict="route"] > .tp-label,
.tp-verdict[data-verdict="route"] {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.75rem;
  padding: 0.4rem 0.75rem 0.4rem 0.55rem;
  color: var(--gold-ink);
  background: var(--gold-wash);
  border: 1px solid var(--gold-ink);
}

.tp-card-no_route > .tp-label,
.tp-route-card[data-verdict="no_route"] > .tp-label,
.tp-route-card[data-verdict="no-route"] > .tp-label {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.75rem;
  padding: 0.4rem 0.75rem 0.4rem 0.55rem;
  color: var(--ice-ink);
  background: var(--ice-wash);
  border: 1px solid var(--ice-ink);
}

.tp-card-route > .tp-label::before,
.tp-route-card[data-verdict="route"] > .tp-label::before {
  content: "";
  width: 1.15rem;
  height: 1.15rem;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='black' d='M1.5 12h4.4l2.3-6.2h5.2v1.7H9.2L6.9 13.5H1.5z'/><circle cx='2.6' cy='12' r='1.5'/><circle cx='13.3' cy='4.4' r='1.5'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='black' d='M1.5 12h4.4l2.3-6.2h5.2v1.7H9.2L6.9 13.5H1.5z'/><circle cx='2.6' cy='12' r='1.5'/><circle cx='13.3' cy='4.4' r='1.5'/></svg>") center / contain no-repeat;
}

.tp-card-no_route > .tp-label::before,
.tp-route-card[data-verdict="no_route"] > .tp-label::before,
.tp-route-card[data-verdict="no-route"] > .tp-label::before {
  content: "";
  width: 1.15rem;
  height: 1.15rem;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><circle cx='8' cy='8' r='5.25' fill='none' stroke='black' stroke-width='1.8'/><circle cx='8' cy='8' r='1.55'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><circle cx='8' cy='8' r='5.25' fill='none' stroke='black' stroke-width='1.8'/><circle cx='8' cy='8' r='1.55'/></svg>") center / contain no-repeat;
}

.tp-meeting-card .tp-odds {
  align-items: baseline;
}

.tp-odds-p {
  font-family: var(--serif);
  font-size: clamp(3rem, 8vw, 4.5rem);
  line-height: 0.9;
  color: var(--gold-ink);
}

.tp-odds-band,
.tp-odds-outcome {
  color: var(--text-secondary);
}

.tp-turn {
  margin: 0;
  padding: 0.7rem 0.85rem;
  border-left: 3px solid var(--gold-ink);
  background: var(--bg-deep);
  color: var(--text-primary);
}

.tp-stances,
.tp-moves,
.tp-milestones,
.tp-tried,
.tp-list,
.tp-endings {
  margin: 0;
  padding-left: 1.1rem;
  max-width: 100%;
}

.tp-stances li,
.tp-moves li,
.tp-milestones li,
.tp-tried li,
.tp-list li {
  display: list-item;
  overflow-wrap: break-word;
  border-bottom: 1px solid var(--border);
  padding-block: 0.45rem;
}

.tp-hash,
.tp-code,
code {
  overflow-wrap: anywhere;
}

/* Long URLs in code samples wrap at phone width instead of running off-screen. */
.tp-code,
.tp-code code {
  white-space: pre-wrap;
}

.tp-hash,
.tp-code {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.85rem;
}

.tp-btn-primary {
  background: var(--gold-ink);
  color: var(--on-gold);
  border-color: var(--gold-ink);
}

.tp-btn-disabled {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-strong);
  cursor: default;
}

.tp-private-note {
  color: var(--text-secondary);
  max-width: var(--measure);
}

.tp-dl {
  display: grid;
  grid-template-columns: minmax(0, 8rem) minmax(0, 1fr);
  gap: 0.35rem 0.75rem;
  margin: 0;
}

.tp-dl dd {
  margin: 0;
  min-width: 0;
}

@media (min-width: 768px) {
  :root {
    --gutter: 24px;
  }

  .tp-promises,
  .tp-cards,
  .tp-pair {
    grid-template-columns: 1fr 1fr;
  }

  .tp-main {
    padding-block: 3rem 5rem;
  }
}

.tp-btn,
a.tp-btn,
.tp-btn-disabled {
  max-width: 100%;
  white-space: normal;
  text-align: center;
}

@media (min-width: 1200px) {
  :root {
    --gutter: 32px;
  }

  .tp-page-meetings .tp-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
