/*
  CodeSMS legal and support site. One file, no build, no external fonts or CDNs.
  Language from DESIGN.md: paper ground, ink, 1px hairlines, the ticket with a tear line and a stub.
  State colours (held, returned, void) are reserved for credit state and are not used on these pages.
*/

:root {
  color-scheme: light dark;
  --paper: #FAFAFA;
  --card: #FFFFFF;
  --ink: #111113;
  --ink-2: #636369;
  --hairline: #E4E4E7;
  --on-ink: #FFFFFF;
  --word: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --figure: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --gutter: 16px;
  --max: 1040px;
  --read: 42rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0B0B0C;
    --card: #18181B;
    --ink: #F4F4F5;
    --ink-2: #A1A1AA;
    --hairline: #2A2A2E;
    --on-ink: #111113;
  }
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--word);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.25em; }
li { margin: 0.25em 0; }
code { font-family: var(--figure); font-size: 0.92em; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.fig { font-family: var(--figure); font-variant-numeric: tabular-nums; }

/* Placeholders the owner still fills in */
mark.ph {
  background: transparent;
  color: inherit;
  border-bottom: 1px dashed var(--ink-2);
}

/* Header */
.site-header { border-bottom: 1px solid var(--hairline); }
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  min-height: 60px;
  flex-wrap: wrap;
}
.brand { font-weight: 700; letter-spacing: -0.01em; text-decoration: none; }
.nav { display: flex; align-items: center; gap: 4px 20px; font-size: 0.9375rem; flex-wrap: wrap; }
.nav a { color: var(--ink-2); text-decoration: none; padding: 8px 0; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }

/* Footer */
.site-footer { border-top: 1px solid var(--hairline); padding: 32px 0 40px; color: var(--ink-2); font-size: 0.9375rem; }
.footer-grid { display: grid; gap: 24px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 20px; list-style: none; padding: 0; margin: 0 0 12px; }
.footer-links a { color: var(--ink); padding: 6px 0; display: inline-block; }
.site-footer p { margin: 0 0 8px; }
.fineprint { font-size: 0.8125rem; }

/* Ticket: content, tear line, stub. Used once, on the index pages. */
.ticket { position: relative; background: var(--card); border: 1px solid var(--hairline); border-radius: 16px; }
.ticket-body { padding: 16px; }
.tear {
  position: relative;
  height: 14px;
  background: radial-gradient(circle, var(--hairline) 1.3px, transparent 1.7px) 0 5px / 8px 4px repeat-x;
}
.tear::before, .tear::after {
  content: "";
  position: absolute;
  top: 0;
  width: 14px;
  height: 14px;
  box-sizing: border-box;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--hairline);
}
.tear::before { left: -8px; clip-path: inset(0 0 0 7px); }
.tear::after { right: -8px; clip-path: inset(0 7px 0 0); }
.stub { padding: 10px 16px 14px; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; font-size: 0.9375rem; color: var(--ink-2); }
.stub .addr { font-family: var(--figure); color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }

/* Receipt lines: label left, value right */
.lines { margin: 0; padding: 0; list-style: none; }
.lines li { margin: 0; border-top: 1px solid var(--hairline); }
.lines li:first-child { border-top: 0; }
.lines a { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 14px 0; text-decoration: none; font-weight: 600; }
.lines a:hover span:first-child { text-decoration: underline; }
.lines .path { font-family: var(--figure); font-weight: 400; font-size: 0.875rem; color: var(--ink-2); }

.index { max-width: 34rem; margin: 0 auto; padding: 56px 0 72px; }
.index h1 { font-size: clamp(2rem, 7vw, 3rem); line-height: 1.05; letter-spacing: -0.03em; margin-bottom: 12px; }
.index .lede { color: var(--ink-2); margin-bottom: 28px; }

/* Legal pages and support */
.prose { max-width: var(--read); margin: 0 auto; padding: 40px 0 64px; }
.prose h1 { font-size: clamp(1.875rem, 6.4vw, 2.5rem); line-height: 1.1; letter-spacing: -0.025em; margin-bottom: 8px; }
.prose .meta { color: var(--ink-2); font-size: 0.9375rem; margin-bottom: 24px; }
.prose h2 { font-size: 1.25rem; line-height: 1.3; letter-spacing: -0.01em; margin: 2.2em 0 0.6em; padding-top: 1.1em; border-top: 1px solid var(--hairline); }
.prose h2:first-of-type { margin-top: 1.6em; }
.prose h2.plain { border-top: 0; padding-top: 0; margin-top: 1.6em; }
.prose .note { color: var(--ink-2); font-size: 0.9375rem; }
.prose blockquote { margin: 0 0 1.5em; padding: 14px 16px; background: var(--card); border: 1px solid var(--hairline); border-radius: 16px; }
.prose blockquote p { margin: 0; }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; margin: 1em 0 1.4em; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 10px 14px 10px 0; border-top: 1px solid var(--hairline); }
.prose th { color: var(--ink-2); font-weight: 600; font-size: 0.8125rem; }
.prose tbody tr:last-child td { border-bottom: 1px solid var(--hairline); }
.toc { margin: 0 0 1em; border: 1px solid var(--hairline); border-radius: 12px; background: var(--card); }
.toc summary { cursor: pointer; padding: 12px 16px; font-weight: 600; font-size: 0.9375rem; }
.toc ol { margin: 0; padding: 0 16px 12px 40px; font-size: 0.9375rem; }
.toc a { color: var(--ink-2); text-decoration: none; }
.toc a:hover { color: var(--ink); text-decoration: underline; }

.mail-card { margin: 24px 0 8px; padding: 16px; background: var(--card); border: 1px solid var(--hairline); border-radius: 16px; }
.mail-card p { margin: 0 0 4px; color: var(--ink-2); font-size: 0.9375rem; }
.mail-card .addr { font-family: var(--figure); font-size: 1.125rem; font-weight: 600; overflow-wrap: anywhere; }

.faq { margin: 32px 0 0; border-bottom: 1px solid var(--hairline); }
.faq details { border-top: 1px solid var(--hairline); }
.faq summary { position: relative; cursor: pointer; list-style: none; padding: 16px 32px 16px 0; font-weight: 600; line-height: 1.35; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 16px; font-family: var(--figure); font-weight: 400; color: var(--ink-2); }
.faq details[open] summary::after { content: "\2212"; }
.faq .answer { padding: 0 0 6px; color: var(--ink-2); }
.faq .answer p:last-child { margin-bottom: 16px; }

.center { max-width: 34rem; margin: 0 auto; padding: 72px 0 96px; }
.center h1 { font-size: clamp(1.875rem, 6.4vw, 2.5rem); letter-spacing: -0.025em; margin-bottom: 12px; }

@media (min-width: 760px) {
  .footer-grid { grid-template-columns: 1.2fr 1fr; gap: 48px; }
}

/* Tables become stacked rows on phones */
@media (max-width: 640px) {
  .prose table, .prose tbody, .prose tr, .prose td { display: block; width: 100%; }
  .prose thead { display: none; }
  .prose tr { padding: 12px 0; border-top: 1px solid var(--hairline); }
  .prose tbody tr:last-child { border-bottom: 1px solid var(--hairline); }
  .prose td { border: 0 !important; padding: 2px 0; }
  .prose td::before { content: attr(data-label); display: block; color: var(--ink-2); font-size: 0.75rem; font-weight: 600; margin-top: 6px; }
  .prose td:first-child { font-weight: 600; }
  .prose td:first-child::before { display: none; }
}

@media (max-width: 420px) {
  .nav { gap: 4px 14px; }
}
