/* Crownlet website. Colors, spacing, radii and fonts come from the design tokens
   (assets/design/tokens.css, copied from design/ by sync.sh, dark theme from the system
   setting). The CSP allows no inline styles, so everything lives here. */

@font-face {
  font-family: "Figtree";
  src: url("/assets/design/fonts/Figtree.ttf") format("truetype");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/assets/design/fonts/BricolageGrotesque.ttf") format("truetype");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;
}

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

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 24px;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:focus-visible {
  outline: var(--stroke-focus) solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 4px;
}

p {
  margin: 0;
}

/* ---------- Layout ---------- */

.wrap {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding-left: max(var(--space-4), env(safe-area-inset-left));
  padding-right: max(var(--space-4), env(safe-area-inset-right));
}

.wrap.wide {
  max-width: 680px;
}

.site-header {
  padding-top: max(var(--space-4), env(safe-area-inset-top));
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand img {
  display: block;
  width: 28px;
  height: 28px;
}

main {
  flex: 1;
  padding-top: var(--space-4);
  padding-bottom: var(--space-8);
}

.stack {
  display: grid;
  align-content: start;
  gap: var(--space-6);
}

.site-footer {
  padding-top: var(--space-6);
  padding-bottom: max(var(--space-6), env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 18px;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
}

.site-footer a {
  display: inline-block;
  padding: var(--space-1) 0;
}

/* ---------- Type ---------- */

.display {
  margin: 0;
  font-family: var(--font-display);
  font-size: 40px;
  line-height: 44px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 32px;
  font-weight: 700;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.heading {
  margin: 0;
  font-size: 18px;
  line-height: 24px;
  font-weight: 700;
}

.muted {
  color: var(--ink-muted);
}

.caption {
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
  color: var(--ink-muted);
}

.label {
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.tabular {
  font-variant-numeric: tabular-nums;
}

/* ---------- Buttons and cards ---------- */

.actions {
  display: grid;
  gap: var(--space-3);
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 20px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.btn.primary {
  background: var(--action);
  color: var(--on-action);
}

.btn.secondary {
  background: var(--surface-raised);
  color: var(--ink);
  border-color: var(--line);
}

/* Before launch: where the App Store button will be. Dashed and unfilled, so it does not read as
   a button. */
.soon {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  margin: 0;
  padding: 12px 20px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-md);
  color: var(--ink-muted);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 20px;
  font-weight: 700;
  text-align: center;
}

.btn:focus-visible {
  outline: var(--stroke-focus) solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-md);
}

.card {
  background: var(--surface-raised);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-4);
}

.note {
  text-align: center;
}

/* ---------- Home, card and 404 ---------- */

.hero {
  display: grid;
  gap: var(--space-4);
  justify-items: center;
  text-align: center;
  padding-top: var(--space-6);
}

.hero-crown {
  display: block;
  width: 96px;
  height: 96px;
}

/* A sample board on the home page (drawn with the design tokens' light palette). */
.sample-board {
  display: block;
  width: min(100%, 320px);
  height: auto;
  margin-top: var(--space-2);
  filter: drop-shadow(0 1px 2px rgba(26, 32, 51, 0.12)) drop-shadow(0 16px 32px rgba(26, 32, 51, 0.14));
}

.hero .actions {
  width: 100%;
  margin-top: var(--space-2);
}

.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2) var(--space-6);
}

.links a {
  display: inline-block;
  padding: var(--space-1) 0;
}

/* ---------- Challenge ---------- */

.challenge {
  display: grid;
  gap: var(--space-4);
}

.challenge-head {
  display: grid;
  gap: var(--space-1);
}

.beat {
  display: grid;
  gap: 2px;
}

.beat-time {
  margin: 0;
  font-family: var(--font-display);
  font-size: 40px;
  line-height: 44px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.problem {
  display: grid;
  gap: var(--space-2);
}

/* ---------- Board (assets/board.js) ---------- */

.tray {
  background: var(--surface-raised);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 10px;
}

.board {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  overflow: visible;
}

.board-bed {
  fill: var(--board-line);
}

.board .rock {
  fill: var(--surface-sunken);
}

.pebble {
  fill: var(--line);
  stroke: var(--board-line);
  stroke-linejoin: round;
}

.lines-thin {
  fill: none;
  stroke: var(--cell-line);
  stroke-width: var(--stroke-cell);
  vector-effect: non-scaling-stroke;
}

.lines-thick {
  fill: none;
  stroke: var(--board-line);
  stroke-width: var(--stroke-region);
  stroke-linecap: square;
  vector-effect: non-scaling-stroke;
}

.board-frame {
  fill: none;
  stroke: var(--board-line);
  stroke-width: calc(2 * var(--stroke-region));
  vector-effect: non-scaling-stroke;
}

.r1 { fill: var(--region-1); }
.r2 { fill: var(--region-2); }
.r3 { fill: var(--region-3); }
.r4 { fill: var(--region-4); }
.r5 { fill: var(--region-5); }
.r6 { fill: var(--region-6); }
.r7 { fill: var(--region-7); }
.r8 { fill: var(--region-8); }
.r9 { fill: var(--region-9); }
.r10 { fill: var(--region-10); }
.r11 { fill: var(--region-11); }
.r12 { fill: var(--region-12); }

/* ---------- Privacy and support ---------- */

.prose {
  display: grid;
  gap: var(--space-4);
}

.prose h2 {
  margin: var(--space-4) 0 0;
  font-size: 18px;
  line-height: 24px;
  font-weight: 700;
}

.prose ul {
  margin: 0;
  padding-left: 1.25em;
  display: grid;
  gap: var(--space-2);
}

.notice {
  background: var(--surface-sunken);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-weight: 700;
}

.placeholder {
  font-weight: 700;
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
  padding: 0 var(--space-1);
}
