/*
 * Malaab's site. It follows the apps' look (docs/ui.md): the colors are
 * MalaabColors' (packages/malaab_ui/lib/src/foundation/colors.dart) in
 * OKLCH, so keep them in step, Figtree for reading, glass cards on a
 * backdrop of two soft glows, and nothing that moves.
 */

@font-face {
  font-family: Figtree;
  src: url("/fonts/Figtree-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: Figtree;
  src: url("/fonts/Figtree-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: Figtree;
  src: url("/fonts/Figtree-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: Figtree;
  src: url("/fonts/Figtree-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --canvas: oklch(.975 .006 75);
  --glow-cool: oklch(.93 .045 255);
  --glow-warm: oklch(.94 .045 60);
  --surface: oklch(1 0 0 / .78);
  --surface-border: oklch(.22 .006 60 / .09);
  --text: oklch(.22 .006 60);
  --text-muted: oklch(.48 .010 65);
  --inverse: oklch(.19 .004 60);
  --on-inverse: oklch(.985 .003 80);
  --hairline: oklch(.22 .006 60 / .09);
  --live: oklch(.58 .19 25);
  --on-live: oklch(.99 .005 25);
  --shadow: oklch(.30 .02 60 / .10);
  /* MalaabColors.hue(150), a league's green. */
  --league-ink: oklch(.50 .12 150);
  --league-tint: oklch(.93 .03 150);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --canvas: oklch(.17 .008 260);
    --glow-cool: oklch(.30 .06 262);
    --glow-warm: oklch(.33 .065 55);
    --surface: oklch(1 0 0 / .075);
    --surface-border: oklch(1 0 0 / .12);
    --text: oklch(.965 .004 80);
    --text-muted: oklch(.74 .008 70);
    --inverse: oklch(.965 .004 80);
    --on-inverse: oklch(.19 .004 60);
    --hairline: oklch(1 0 0 / .10);
    --live: oklch(.70 .17 28);
    --on-live: oklch(.18 .03 25);
    --shadow: oklch(.05 0 0 / .40);
    --league-ink: oklch(.80 .12 150);
    --league-tint: oklch(.33 .035 150);
  }
}

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

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

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--canvas);
  color: var(--text);
  font: 400 17px/1.6 Figtree, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* The backdrop: a cool glow from the page's top left and a warm one from
 * its bottom right, mixed in OKLab as the app mixes them. They scroll with
 * the page, so a long page reads on the plain canvas. */
body::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle 80vmax at 0% 0%, var(--glow-cool), transparent),
    radial-gradient(circle 80vmax at 100% 100%, var(--glow-warm), transparent);
  background:
    radial-gradient(circle 80vmax at 0% 0% in oklab, var(--glow-cool), transparent),
    radial-gradient(circle 80vmax at 100% 100% in oklab, var(--glow-warm), transparent);
}

/* One column, 16 pixels from a phone's edges. */
.bar,
.page,
.footer {
  width: min(100% - 32px, 1080px);
  margin-inline: auto;
}

.page {
  flex: 1;
}

a {
  color: inherit;
}

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

.only-dark {
  display: none;
}

@media (prefers-color-scheme: dark) {
  .only-light {
    display: none;
  }

  .only-dark {
    display: inline;
  }
}

/* The bar */

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.01em;
  text-decoration: none;
}

.mark {
  width: 28px;
  height: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 24px;
  border-radius: 1000px;
  background: var(--inverse);
  color: var(--on-inverse);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.button:hover {
  background: color-mix(in oklab, var(--inverse) 86%, var(--canvas));
}

.button.small {
  min-height: 44px;
  padding: 0 18px;
  font-size: 15px;
}

/* Cards: glass on the backdrop. */

.card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 26px;
  box-shadow: 0 1px 2px var(--shadow), 0 16px 40px var(--shadow);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  backdrop-filter: blur(24px) saturate(1.2);
}

/* A rounded superellipse, as the app's RoundedSuperellipseBorder: the
 * corner starts about 1.5 times further along each side than a circle's
 * would. Browsers without corner-shape keep the circular corner. */
@supports (corner-shape: superellipse(1.7)) {
  .card {
    border-radius: 40px;
    corner-shape: superellipse(1.7);
  }
}

.overline {
  margin: 0 0 16px;
  color: var(--text-muted);
  font: 500 12px/1.4 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}

/* Home */

.hero {
  display: grid;
  align-items: center;
  gap: 40px;
  padding-block: 40px 56px;
}

.hero h1 {
  margin: 0 0 20px;
  font-size: clamp(38px, 6vw, 62px);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -.03em;
  text-wrap: balance;
}

.lead {
  max-width: 34em;
  margin: 0 0 32px;
  color: var(--text-muted);
  font-size: clamp(18px, 2vw, 20px);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

.note {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
}

.features {
  display: grid;
  gap: 16px;
  padding-bottom: 88px;
}

.feature {
  padding: 24px;
}

.feature h2 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 600;
}

.feature p {
  margin: 0;
  color: var(--text-muted);
}

@media (min-width: 768px) {
  .hero {
    grid-template-columns: 1.25fr 1fr;
    gap: 56px;
    padding-block: 88px 104px;
  }

  .features {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* The game card on the home page */

.game {
  justify-self: center;
  width: 100%;
  max-width: 380px;
  padding: 22px;
}

.game-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.game .overline {
  margin: 0;
  color: var(--league-ink);
}

.live {
  padding: 6px 10px;
  border-radius: 1000px;
  background: var(--live);
  color: var(--on-live);
  font: 600 11px/1 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.team {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 12px;
  padding-block: 6px;
}

.badge {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--league-tint);
  color: var(--league-ink);
  font: 600 11px/1 var(--mono);
}

.name {
  font-size: 19px;
  font-weight: 500;
}

.score {
  font-size: 34px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

.trailing .name,
.trailing .score {
  color: var(--text-muted);
}

.game-foot {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--hairline);
  color: var(--text-muted);
  font-size: 15px;
}

/* Long-form pages: privacy, support, deleting an account. */

.prose {
  max-width: 680px;
  padding-block: 32px 88px;
  overflow-wrap: break-word;
}

.prose h1 {
  margin: 0 0 16px;
  font-size: clamp(34px, 5vw, 46px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -.025em;
}

.prose h2 {
  margin: 48px 0 12px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.prose h3 {
  margin: 28px 0 8px;
  font-size: 18px;
  font-weight: 600;
}

.prose p {
  margin: 0 0 16px;
}

.prose ul,
.prose ol {
  margin: 0 0 16px;
  padding-left: 1.3em;
}

.prose li + li {
  margin-top: 8px;
}

.prose em {
  color: var(--text-muted);
}

.prose a {
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* The footer */

.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-block: 28px 40px;
  border-top: 1px solid var(--hairline);
  color: var(--text-muted);
  font-size: 15px;
}

.footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.footer a {
  text-decoration: none;
}

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

.footer p {
  margin: 0;
}
