@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(/fonts/schibsted-grotesk-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(/fonts/schibsted-grotesk-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #eaeff4;
  --ink: #13203a;
  --muted: #56647e;
  --line: #c4cedb;
  --free: #17b36a;
  --free-ink: #032a18;
  --premium: #f2b31b;
  --premium-ink: #3b2900;
  --hatch: rgba(19, 32, 58, 0.16);
  --focus: #2a5bea;
  --tile: clamp(92px, 11vw, 132px);
  --gap: 6px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0d1526;
    --ink: #e4eaf4;
    --muted: #8d9ab2;
    --line: #2a3752;
    --free: #22c07a;
    --free-ink: #02200f;
    --premium: #f2b31b;
    --premium-ink: #2d2000;
    --hatch: rgba(228, 234, 244, 0.13);
    --focus: #7d9dff;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #0d1526;
  --ink: #e4eaf4;
  --muted: #8d9ab2;
  --line: #2a3752;
  --free: #22c07a;
  --free-ink: #02200f;
  --premium: #f2b31b;
  --premium-ink: #2d2000;
  --hatch: rgba(228, 234, 244, 0.13);
  --focus: #7d9dff;
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.5 "Schibsted Grotesk", system-ui, sans-serif;
}

main {
  flex: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(40px, 9vh, 112px) 16px 48px;
}

a { color: inherit; }

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

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- the question */

.ask {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px 20px;
}

.ask-line {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.28em;
  font-size: clamp(44px, 9.5vw, 128px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.035em;
  min-width: 0;
  max-width: 100%;
}

.ask-input {
  /* width is set from the text length in app.js */
  width: 6ch;
  min-width: 3ch;
  max-width: 100%;
  padding: 0 0 0.04em;
  border: 0;
  border-bottom: 0.06em solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  letter-spacing: inherit;
  caret-color: var(--free);
}

.ask-input::placeholder { color: var(--line); opacity: 1; }
.ask-input:focus { outline: none; border-bottom-color: var(--free); }
.ask-input:focus-visible { outline: none; }

.ask-tail { color: var(--muted); white-space: nowrap; }

.ask-go {
  align-self: center;
  padding: 12px 22px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font: 700 17px/1 inherit;
  font-family: inherit;
  cursor: pointer;
}
.ask-go:hover { background: transparent; color: var(--ink); }
.ask-go[disabled] { opacity: 0.5; cursor: progress; }

.hint {
  margin: 18px 0 0;
  max-width: 60ch;
  color: var(--muted);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.5;
}

/* ---------- answer + legend */

.results { margin-top: clamp(36px, 6vh, 64px); }

.answer {
  margin: 0 0 14px;
  max-width: 40ch;
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 14px;
}
.legend li { display: inline-flex; align-items: center; gap: 7px; }

.sw {
  display: inline-block;
  width: 14px; height: 14px;
  border-radius: 3px;
}

/* ---------- the mosaic */

.mosaic {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--tile), 1fr));
  grid-auto-rows: var(--tile);
  grid-auto-flow: dense;
  gap: var(--gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.mosaic > li { display: contents; }

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 5px;
  text-decoration: none;
  overflow: hidden;
}

.tile.w2 { grid-column: span 2; }
.tile.h2 { grid-row: span 2; }

.tile-tld {
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}
.tile-tld.l5 { font-size: 23px; }
.tile-tld.l7 { font-size: 18px; letter-spacing: -0.02em; }
.tile.w2 .tile-tld { font-size: 40px; }
.tile.w2.h2 .tile-tld { font-size: clamp(56px, 7vw, 88px); }

.tile-state {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
}
.tile.w2.h2 .tile-state { font-size: 16px; }

.tile-name {
  display: block;
  font-size: 13px;
  font-weight: 500;
  opacity: 0.8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* states */

.sw-free, .tile.free {
  background: var(--free);
  color: var(--free-ink);
}

.sw-unverified, .tile.unverified {
  background: color-mix(in srgb, var(--free) 22%, var(--paper));
  box-shadow: inset 0 0 0 2px var(--free);
  color: var(--ink);
}

.sw-premium, .tile.premium {
  background: var(--premium);
  color: var(--premium-ink);
}

.sw-taken, .tile.taken,
.sw-forsale, .tile.forsale {
  background:
    repeating-linear-gradient(135deg, var(--hatch) 0 2px, transparent 2px 9px),
    var(--paper);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--muted);
}

.sw-forsale, .tile.forsale { box-shadow: inset 0 0 0 2px var(--premium); }

.tile.taken .tile-tld,
.tile.forsale .tile-tld {
  text-decoration: line-through;
  text-decoration-thickness: 0.07em;
}

.tile:hover { filter: brightness(1.06) saturate(1.08); }
.tile.taken:hover, .tile.forsale:hover { color: var(--ink); }

/* the one orchestrated moment: tiles land in rank order after a search */
@media (prefers-reduced-motion: no-preference) {
  .mosaic.reveal .tile {
    animation: land 0.32s cubic-bezier(.2, .8, .2, 1) both;
    animation-delay: calc(var(--i, 0) * 14ms);
  }
}
@keyframes land {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: none; }
}

/* loading */
.tile.ghost {
  background: color-mix(in srgb, var(--ink) 6%, var(--paper));
  box-shadow: inset 0 0 0 1px var(--line);
}

@media (prefers-reduced-motion: no-preference) {
  .tile.ghost {
    animation: scan 1.6s ease-in-out infinite;
    animation-delay: calc(var(--i, 0) * 32ms);
  }
}

@keyframes scan {
  0%, 60%, 100% { background: color-mix(in srgb, var(--ink) 6%, var(--paper)); }
  22% { background: color-mix(in srgb, var(--free) 80%, var(--paper)); }
}

.results[aria-busy="true"] .legend { visibility: hidden; }

/* ---------- about */

.about {
  margin-top: clamp(64px, 10vh, 112px);
  max-width: 68ch;
  color: var(--muted);
}
.about h2 {
  margin: 36px 0 10px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.about h2:first-child { margin-top: 0; }
.about p { margin: 0 0 12px; }
.tld-list { overflow-wrap: anywhere; }

.error {
  margin: 32px 0 0;
  padding: 14px 16px;
  max-width: 60ch;
  border-left: 4px solid var(--premium);
  background: color-mix(in srgb, var(--premium) 14%, var(--paper));
}

.foot {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  color: var(--muted);
  font-size: 14px;
}
.foot p { margin: 0; max-width: 72ch; }

@media (max-width: 560px) {
  :root { --tile: 84px; --gap: 5px; }
  .tile { padding: 8px 9px; }
  .tile-tld { font-size: 22px; }
  .tile-tld.l5 { font-size: 17px; }
  .tile-tld.l7 { font-size: 14px; }
  .tile.w2 .tile-tld { font-size: 30px; }
  .tile-state { font-size: 12px; }
}
