/* Roundhouse site styles. System fonts only, no external requests.
   Palette: PRODUCTION_PLAN §18.5 (felt, ivory, brass, walnut, ink). */

:root {
  color-scheme: light dark;
  --bg: #FFFBF0;          /* ivory */
  --surface: #F2EFE6;     /* light felt */
  --text: #1F2A2E;        /* ink */
  --muted: #3E4A4E;
  --accent: #1E4D3A;      /* felt */
  --accent-text: #FFFBF0;
  --link: #1E4D3A;
  --brass: #8A5A2B;       /* brass on light */
  --rule: #CFC6B0;
  --walnut: #5A3A22;
  --focus: #8A5A2B;
  --radius: 14px;
  --measure: 40rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #122E23;
    --surface: #1E4D3A;
    --text: #FFFBF0;
    --muted: #E4DCC8;
    --accent: #D9B26A;
    --accent-text: #1F2A2E;
    --link: #F0D59C;
    --brass: #D9B26A;
    --rule: #3C6A55;
    --walnut: #D9B26A;
    --focus: #F0D59C;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.1875rem;   /* 19px */
  line-height: 1.6;
}

h1, h2, h3 {
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.25;
  color: var(--text);
}
h1 { font-size: clamp(2rem, 6vw, 2.75rem); margin: 0.2em 0 0.4em; }
h2 { font-size: 1.6rem; margin: 2em 0 0.5em; padding-top: 0.6em; border-top: 2px solid var(--rule); }
h3 { font-size: 1.3rem; margin: 1.5em 0 0.4em; }

p, ul, ol, dl, table { margin: 0 0 1em; }
li { margin-bottom: 0.4em; }

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

.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-text); padding: 0.6em 1em; z-index: 10; }
.skip:focus { left: 1rem; top: 1rem; }

.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 16px; }
.wrap-wide { max-width: 64rem; margin: 0 auto; padding: 0 16px; }

/* Header and navigation */
.site-header { background: #1E4D3A; color: #FFFBF0; border-bottom: 4px solid #D9B26A; }
.site-header .wrap-wide { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem; padding-top: 0.8rem; padding-bottom: 0.8rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: #FFFBF0; text-decoration: none; font-weight: 700; font-size: 1.3rem; font-family: ui-rounded, "SF Pro Rounded", -apple-system, sans-serif; }
.brand img { width: 40px; height: 40px; flex: none; }
.site-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; margin: 0; padding: 0; }
.site-nav li { margin: 0; }
.site-nav a { color: #FFFBF0; text-decoration: none; display: inline-block; padding: 0.35rem 0; min-height: 44px; line-height: 2; }
.site-nav a:hover, .site-nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: #D9B26A; text-decoration-thickness: 3px; }

main { padding: 0 0 3rem; }
main > .wrap:first-child, main > .wrap-wide:first-child { padding-top: 1.5rem; }

/* Hero */
.hero { background: var(--surface); border-bottom: 2px solid var(--rule); padding: 2.5rem 0 2rem; }
.hero p.lede { font-size: 1.35rem; max-width: 34rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; margin: 1.5rem 0 1rem; }

.button, .store-badge {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 52px; padding: 0.6rem 1.3rem; border-radius: 12px;
  font-weight: 700; text-decoration: none; font-size: 1.1rem;
}
.button { background: var(--accent); color: var(--accent-text); border: 2px solid var(--accent); }
.button.secondary { background: transparent; color: var(--link); border-color: var(--link); }
.store-badge { background: #000; color: #fff; border: 2px solid #fff; outline: 1px solid #A6A6A6; }
.store-badge small { display: block; font-weight: 400; font-size: 0.8rem; line-height: 1.1; }
.store-badge span { line-height: 1.15; text-align: left; }

/* Feature blocks */
.features { display: grid; grid-template-columns: 1fr; gap: 1rem; margin: 2rem 0; padding: 0; list-style: none; }
@media (min-width: 720px) { .features { grid-template-columns: 1fr 1fr; } }
.feature { background: var(--surface); border: 2px solid var(--rule); border-radius: var(--radius); padding: 1.2rem 1.3rem; margin: 0; }
.feature h3 { margin-top: 0; }
.feature p { margin-bottom: 0; }

.note { background: var(--surface); border-left: 6px solid var(--brass); padding: 0.9rem 1.1rem; border-radius: 0 var(--radius) var(--radius) 0; }

/* Tables */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 1em; }
table { border-collapse: collapse; width: 100%; }
th, td { border: 1.5px solid var(--rule); padding: 0.5rem 0.7rem; text-align: left; vertical-align: top; }
thead th { background: var(--surface); }

/* Rules page */
.toc { background: var(--surface); border-radius: var(--radius); padding: 1rem 1.3rem; }
.toc ol { margin: 0; padding-left: 1.4rem; }
.tile { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 700; }
dt { font-weight: 700; margin-top: 1em; }
dd { margin: 0.2em 0 0.8em 0; }
details { border: 2px solid var(--rule); border-radius: var(--radius); padding: 0.6rem 1rem; margin-bottom: 0.8rem; background: var(--surface); }
summary { font-weight: 700; cursor: pointer; min-height: 44px; display: flex; align-items: center; }
details[open] summary { margin-bottom: 0.4rem; }

/* Footer */
.site-footer { border-top: 2px solid var(--rule); background: var(--surface); padding: 1.5rem 0 2rem; font-size: 1.125rem; }
.site-footer ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem; }
.site-footer p { color: var(--muted); }

/* Score sheet (screen) */
.sheet { margin: 2rem 0 3rem; }
.sheet h2 { border-top: 0; margin-top: 0; }
.sheet table { table-layout: fixed; font-size: 1.15rem; }
.sheet th, .sheet td { border: 2px solid var(--text); height: 2.6rem; padding: 0.2rem 0.4rem; }
.sheet thead th { height: 3.4rem; font-size: 1rem; color: var(--muted); font-weight: 400; vertical-align: bottom; }
.sheet .round { width: 5.5rem; font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; }
.sheet tfoot th, .sheet tfoot td { height: 3.2rem; border-top-width: 4px; font-weight: 700; }
.sheet-meta { display: flex; flex-wrap: wrap; gap: 0.3rem 2rem; font-size: 1.125rem; }
.print-only { display: none; }

/* 404 */
.big-tile { font-size: 3rem; font-weight: 800; letter-spacing: 0.1em; }

@media print {
  @page { size: letter portrait; margin: 0.45in; }
  :root { --bg: #fff; --surface: #fff; --text: #000; --muted: #000; --rule: #000; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .site-header, .site-footer, .no-print, .skip { display: none !important; }
  .print-only { display: block; }
  main { padding: 0; }
  .wrap, .wrap-wide { max-width: none; padding: 0; }
  a { color: #000; text-decoration: none; }
  .sheet { margin: 0; break-after: page; page-break-after: always; }
  .sheet:last-of-type { break-after: auto; page-break-after: auto; }
  .sheet h2 { font-size: 20pt; margin: 0 0 4pt; padding: 0; }
  .sheet-meta { font-size: 12pt; margin-bottom: 6pt; }
  .sheet table { font-size: 16pt; }
  .sheet th, .sheet td { border: 1.5pt solid #000; padding: 1pt 4pt; }
  .sheet thead th { height: 0.55in; font-size: 10pt; }
  .sheet tbody th, .sheet tbody td { height: 0.56in; }
  .sheet.d15 tbody th, .sheet.d15 tbody td { height: 0.41in; }
  .sheet tfoot th, .sheet tfoot td { height: 0.55in; border-top-width: 3pt; }
  .sheet .round { width: 0.95in; }
  .sheet-footer { font-size: 10pt; margin-top: 4pt; }
}

.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

/* Feedback form (support page) */
.feedback-form { margin: 1.5rem 0 2rem; }
.field { margin-bottom: 1.4rem; }
.field label { display: block; font-weight: 700; margin-bottom: 0.35rem; }
.field .optional { font-weight: 400; color: var(--muted); }
.field textarea, .field input {
  display: block; width: 100%; min-height: 48px;
  font: inherit; color: var(--text); background: var(--bg);
  border: 2px solid var(--rule); border-radius: 12px; padding: 0.6rem 0.8rem;
}
.field textarea { min-height: 11rem; resize: vertical; line-height: 1.5; }
.field textarea:focus-visible, .field input:focus-visible { border-color: var(--focus); }
.field [aria-invalid="true"] { border-color: #B3261E; }
.help { color: var(--muted); font-size: 1.05rem; margin: 0.35rem 0 0; }
.help:empty { display: none; }
.field-error, .form-error { font-weight: 700; margin: 0.4rem 0 0; }
.field-error::before, .form-error::before { content: "⚠ "; }
.form-error { background: var(--surface); border-left: 6px solid #B3261E; padding: 0.7rem 1rem; border-radius: 0 var(--radius) var(--radius) 0; margin-bottom: 1rem; }
.feedback-form .help + .form-error, .feedback-form > .help { margin-bottom: 1rem; }
button.button { font-family: inherit; cursor: pointer; }
button.button:disabled { opacity: 0.6; cursor: progress; }
.sent { margin: 1.5rem 0 2rem; }
.sent h3 { margin-top: 0.2rem; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
