/* Crumbkin marketing site. Tokens mirror src/theme/tokens.ts and docs/DESIGN.md in the app. */

@font-face {
  font-family: "Fraunces";
  src: url("/fonts/Fraunces-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("/fonts/Fraunces-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("/fonts/Fraunces-SemiBoldItalic.woff2") format("woff2");
  font-weight: 600;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("/fonts/DMSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("/fonts/DMSans-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("/fonts/DMSans-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
/* Fallback faces sized to the web fonts' metrics, so text keeps its place when they swap in. */
@font-face {
  font-family: "Fraunces Fallback";
  src: local("Georgia");
  font-weight: 600;
  size-adjust: 107.55%;
  ascent-override: 90.94%;
  descent-override: 23.71%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Fraunces Fallback";
  src: local("Georgia Bold"), local("Georgia-Bold");
  font-weight: 700;
  size-adjust: 96.49%;
  ascent-override: 101.36%;
  descent-override: 26.43%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "DM Sans Fallback";
  src: local("Arial"), local("ArialMT");
  size-adjust: 99.34%;
  ascent-override: 99.86%;
  descent-override: 31.21%;
  line-gap-override: 0%;
}

:root {
  color-scheme: light dark;

  --page: #F3F2EE;
  --surface: #FFFFFF;
  --ink: #202331;
  --muted: #62636D;
  --rule: #CECDD3;
  --action: #F2C84B;
  --on-accent: #202331;
  --round1: #EFA0A8;
  --round2: #8CC9E7;
  --round3: #A8BE9A;
  --finale: #B9ACD9;
  --focus: #202331;

  --mast-bg: #202331;
  --mast-fg: #F3F2EE;
  --mast-muted: #A9A6AE;
  --mast-rule: #3A3E52;
  --mast-focus: #F2C84B;

  --serif: "Fraunces", "Fraunces Fallback", Georgia, "Times New Roman", serif;
  --sans: "DM Sans", "DM Sans Fallback", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --gutter: 16px;
  --measure: 44rem;
  --radius-tile: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #14161F;
    --surface: #202331;
    --ink: #F4EDE1;
    --muted: #A9A6AE;
    --rule: #3A3E52;
    --round1: #E8939C;
    --round2: #7FBCDB;
    --round3: #9CB58D;
    --finale: #AE9FD3;
    --focus: #F2C84B;

    --mast-bg: #202331;
    --mast-fg: #F4EDE1;
  }
}

@media (min-width: 600px) {
  :root { --gutter: 20px; }
}

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

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

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}

h1, h2, h3, p, ol, ul, figure { margin: 0; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.5rem, 1.25rem + 1.2vw, 1.875rem);
  line-height: 1.2;
}

.puzzle-title {
  font-style: italic;
  font-size: 1.25rem;
  line-height: 1.3;
}

p { max-width: 36em; text-wrap: pretty; }

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-thickness: 2px; }

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

.wrap {
  width: 100%;
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Masthead */

.masthead {
  background: var(--mast-bg);
  color: var(--mast-fg);
  padding-block: 20px 40px;
  border-bottom: 1px solid var(--mast-rule);
}

.masthead :focus-visible { outline-color: var(--mast-focus); }

.wordmark {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--serif);
  font-weight: 700;
  /* A logotype: capped by viewport width so it never forces horizontal scroll at large text sizes. */
  font-size: min(2.125rem, 11vw);
  line-height: 1.12;
}

.wordmark-motif { flex: none; }

.masthead h1 {
  margin-top: 40px;
  font-size: clamp(2.125rem, 1.4rem + 3.6vw, 3.5rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  max-width: 14em;
}

.lead {
  margin-top: 20px;
  font-size: clamp(1.125rem, 1.05rem + 0.4vw, 1.3125rem);
  line-height: 1.45;
  max-width: 30em;
}

.status {
  margin-top: 28px;
  font-weight: 500;
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--mast-muted);
}


/* Sections */

.section { padding-block: 48px; }
.section + .section { border-top: 1px solid var(--rule); }
.section > * + * { margin-top: 16px; }
.section > h2 + p { margin-top: 12px; }

/* Word trail example */

.trail-figure {
  margin-top: 32px;
  container-type: inline-size;
}

.trail {
  user-select: none;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 6px;
}

.trail-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.trail-role,
.round-meta,
.earned-label {
  font-weight: 500;
  font-size: 0.8125rem;
  line-height: 1.4;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  min-width: 72px;
  padding-inline: 12px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-tile);
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.25;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tile-solved {
  background: var(--round1);
  color: var(--on-accent);
}

.trail-arrow {
  display: flex;
  align-items: center;
  height: 72px;
  color: var(--ink);
}

.trail-arrow svg { width: 22px; height: auto; }

.trail-figure figcaption,
.rounds-figure figcaption {
  margin-top: 16px;
  color: var(--muted);
  max-width: 36em;
}

.phrase {
  color: var(--ink);
  font-weight: 500;
}

.phrase b {
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--round1);
  text-decoration-thickness: 3px;
  text-underline-offset: 0.18em;
}

/* Narrow: stack the trail vertically, keeping START, answer, END order (as the app does below ~360 wide).
   Measured in rem so larger text sizes stack sooner. */
@container (max-width: 21rem) {
  .trail {
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }
  .trail-step .tile { min-width: min(11rem, 100cqi); }
  .trail-arrow {
    justify-content: center;
    height: 32px;
  }
  .trail-arrow svg { transform: rotate(90deg); }
}

/* Steps */

.steps {
  list-style: none;
  padding: 0;
  counter-reset: step;
  margin-top: 40px;
}

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  column-gap: 12px;
  padding-block: 20px;
  border-top: 1px dashed var(--rule);
}

.steps li:last-child { border-bottom: 1px dashed var(--rule); }

.steps li::before {
  content: counter(step);
  grid-row: span 2;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--muted);
}

.steps p { margin-top: 6px; }

/* Rounds to Big Link diagram */

.rounds-figure { margin-top: 40px; }

.rounds {
  --gap: 8px;
  --drop: 20px;
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
}

.round {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-bottom: var(--drop);
  text-align: center;
}

.round::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  height: var(--drop);
  border-left: 2px dashed var(--ink);
  transform: translateX(-1px);
}

.glyph {
  stroke: var(--on-accent);
  stroke-width: 1.5;
}
.glyph-r1 { fill: var(--round1); }
.glyph-r2 { fill: var(--round2); }
.glyph-r3 { fill: var(--round3); }
.glyph-big { fill: var(--finale); }

@media (prefers-color-scheme: dark) {
  .glyph { stroke: none; }
}

.round-name,
.biglink-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.125rem;
  line-height: 1.25;
}

.earned {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 9rem;
  min-height: 64px;
  margin-top: 8px;
  padding: 6px;
  border: 2px dashed var(--ink);
  border-radius: var(--radius-tile);
  background: var(--surface);
}

.earned-dots {
  color: var(--muted);
  letter-spacing: 0.1em;
  line-height: 1.2;
}

.earned-label { font-size: 0.75rem; }

.merge {
  position: relative;
  height: 20px;
  margin-inline: calc((100% - 16px) / 6);
  border-top: 2px dashed var(--ink);
}

.merge::after {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  height: 100%;
  border-left: 2px dashed var(--ink);
  transform: translateX(-1px);
}

.biglink {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  max-width: 20rem;
  margin-inline: auto;
  padding: 16px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-tile);
  background: var(--finale);
  color: var(--on-accent);
  text-align: center;
}

.biglink .glyph { stroke: var(--on-accent); fill: none; }
.biglink .round-meta { color: var(--on-accent); }

.biglink-name { font-size: 1.375rem; }

.rounds-figure figcaption { text-align: center; margin-inline: auto; }

/* Ways to play */

.modes {
  display: grid;
  margin-top: 28px;
}

.mode {
  padding-block: 20px;
  border-top: 1px dashed var(--rule);
}

.mode:last-child { border-bottom: 1px dashed var(--rule); }

.mode p { margin-top: 6px; }

@media (min-width: 40em) {
  .modes {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-block: 1px solid var(--rule);
  }
  .mode,
  .mode:last-child {
    border: 0;
    padding: 20px 20px 24px;
  }
  .mode:first-child { padding-left: 0; }
  .mode:last-child { padding-right: 0; }
  .mode + .mode { border-left: 1px dashed var(--rule); }
}

/* Families */

.section > .puzzle-title { margin-top: 32px; }

.easy {
  list-style: none;
  padding: 0;
}

.easy li {
  padding: 12px 0;
  border-top: 1px dashed var(--rule);
}

.easy li:last-child { border-bottom: 1px dashed var(--rule); }


/* Footer */

.footer {
  border-top: 1px solid var(--rule);
  padding-block: 32px 48px;
}

.footer-inner > * + * { margin-top: 8px; }

.wordmark-small {
  font-size: 1.375rem;
  margin-bottom: 12px;
}

.footer-meta {
  color: var(--muted);
  font-size: 0.9375rem;
}

/* 404 */

.notfound {
  padding-block: 56px 72px;
}

.notfound > * + * { margin-top: 16px; }

.notfound h1 {
  font-size: clamp(2rem, 1.5rem + 2.4vw, 2.75rem);
  line-height: 1.12;
}

.notfound .tile { border-style: dashed; color: var(--muted); }

.home-link {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  margin-top: 28px;
  padding: 10px 20px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-tile);
  background: var(--action);
  color: var(--on-accent);
  font-weight: 700;
  text-decoration: none;
}

.home-link:hover { text-decoration: underline; }

.masthead a.wordmark-link {
  display: inline-flex;
  color: inherit;
  text-decoration: none;
}

@media (prefers-reduced-motion: no-preference) {
  a { transition: text-decoration-thickness 150ms ease-out; }
}
