/* atazs
   Look: calm grey-blue neutrals, slate accent; Fraunces (soft) heading, Nunito for everything else.
   Layout: one centred column; stacks on phones. */

/* ---- Fonts ---------------------------------------------------------------- */
/* Served from this site, so visitors' browsers never contact Google.
   Built by tools/build_fonts.py; licences (SIL OFL 1.1) are in site/fonts/. */

@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-soft-500.woff") format("woff");
  font-weight: 500; /* a single fixed style: soft, weight 500, for the heading */
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("../fonts/nunito-400-700.woff") format("woff");
  font-weight: 400 700; /* variable: any weight from regular to bold */
  font-style: normal;
  font-display: swap;
}

/* ---- Theme ---------------------------------------------------------------- */

:root {
  color-scheme: light dark;
  --bg: light-dark(#eef1f3, #161a1e);
  --ink: light-dark(#1f262c, #e6eaed);
  --muted: light-dark(#5c6872, #9aa5ae); /* ≥ 4.5:1 on every surface, checked by tests/design.test.js */
  --line: light-dark(#d5dbe0, #2c333a);
  --field: light-dark(#f8fafb, #1d2228);
  --accent: light-dark(#4a5a68, #a9b7c3);
  --accent-ink: light-dark(#f8fafb, #161a1e);
  --panel: light-dark(#ffffff, #1d2228);
  --hover: light-dark(#e6ebee, #252b32);
  --content-width: 680px;
  --heading-width: 820px;
}
:root[data-theme="light"] {
  color-scheme: light;
}
:root[data-theme="dark"] {
  color-scheme: dark;
}

/* Backup colours for browsers without light-dark(): Safari and iOS before 17.5,
   Chrome and Edge before 123, Firefox before 120. Without this block those
   browsers would show the page with no theme colours. Must match the
   light-dark() pairs above; tests/design.test.js checks that they do. */
@supports not (color: light-dark(#000, #fff)) {
  :root {
    --bg: #eef1f3;
    --ink: #1f262c;
    --muted: #5c6872;
    --line: #d5dbe0;
    --field: #f8fafb;
    --accent: #4a5a68;
    --accent-ink: #f8fafb;
    --panel: #ffffff;
    --hover: #e6ebee;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --bg: #161a1e;
      --ink: #e6eaed;
      --muted: #9aa5ae;
      --line: #2c333a;
      --field: #1d2228;
      --accent: #a9b7c3;
      --accent-ink: #161a1e;
      --panel: #1d2228;
      --hover: #252b32;
    }
  }
  :root[data-theme="dark"] {
    --bg: #161a1e;
    --ink: #e6eaed;
    --muted: #9aa5ae;
    --line: #2c333a;
    --field: #1d2228;
    --accent: #a9b7c3;
    --accent-ink: #161a1e;
    --panel: #1d2228;
    --hover: #252b32;
  }
}

/* ---- Base ----------------------------------------------------------------- */

* {
  box-sizing: border-box;
  min-width: 0;
}
[hidden] {
  display: none !important;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font:
    16px/1.55 "Nunito",
    system-ui,
    sans-serif;
  overflow-x: clip;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

main {
  flex: 1;
  display: grid;
  place-items: center;
  padding: clamp(28px, 6vw, 72px) max(5vw, 16px);
}
.wrap {
  width: 100%;
  max-width: var(--heading-width);
  text-align: center;
}
.wrap > form,
.wrap > .meta,
.wrap > .history,
.wrap > .url {
  max-width: var(--content-width);
  margin-inline: auto;
}

/* ---- Heading -------------------------------------------------------------- */

h1 {
  margin: 0 0 12px;
  font:
    500 clamp(26px, 5.4vw, 50px)/1.08 "Fraunces",
    Georgia,
    serif;
  letter-spacing: -0.01em;
  text-wrap: balance; /* one line in English; longer translations wrap evenly instead of overflowing */
}
.sub {
  margin: 0 auto 32px;
  max-width: 36em;
  color: var(--muted);
  font-size: 17px;
  text-wrap: balance;
}
/* Sentences sit side by side when they fit and wrap as whole sentences when they don't,
   so a sentence is never split across lines just because the screen is narrow. */
.sub {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: 0.3em;
}

/* ---- Search box ----------------------------------------------------------- */

.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-block: 6px;
  padding-inline: 22px 6px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.search > svg {
  flex: none;
  color: var(--muted);
}
.search input[type="search"] {
  flex: 1;
  min-height: 44px;
  padding: 12px 4px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 18px;
}
.search input::placeholder {
  color: var(--muted);
}

.go {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.go:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}
.go[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
}

/* ---- Store line and picker ------------------------------------------------ */

.meta {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 18px;
  margin-top: 18px;
  font-size: 14px;
  color: var(--muted);
}
.flag {
  display: block;
  flex: none;
  width: 22px;
  height: 15px;
  border-radius: 3px;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 14%, transparent);
}

.market-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin: -8px -10px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.market-button #market-label {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent);
  text-underline-offset: 3px;
}
.market-button:hover #market-label {
  text-decoration-color: var(--accent);
}
.market-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.market-button .chev {
  transition: transform 0.15s;
}
.market-button[aria-expanded="true"] .chev {
  transform: rotate(180deg);
}
.filter b {
  font-weight: 600;
  color: var(--ink);
}

.picker {
  position: absolute;
  top: calc(100% + 10px);
  inset-inline: 0;
  z-index: 10;
  width: min(600px, 92vw);
  margin-inline: auto;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 40px -18px rgba(20, 30, 40, 0.35);
  text-align: start;
}
.picker h2 {
  margin: 2px 4px 12px;
  color: var(--ink);
  font:
    600 15px/1.3 "Nunito",
    sans-serif;
}
.options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr));
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.option:hover,
.option:focus-visible {
  background: var(--hover);
  outline: 0;
}
.option:focus-visible {
  box-shadow: inset 0 0 0 2px var(--ink);
}
.option[aria-current="true"] {
  background: var(--hover);
  box-shadow: inset 0 0 0 1.5px var(--accent);
}
.option-name {
  display: block;
  font-size: 15px;
  line-height: 1.2;
}
.option-domain {
  display: block;
  font-size: 13px;
  color: var(--muted);
}

/* ---- Recent searches and link preview ------------------------------------- */

.history {
  margin-top: 28px;
}
.recent {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}
.recent-item {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
}
.recent-item:hover,
.recent-item:focus-within {
  border-color: var(--accent);
}
.recent-item a {
  min-height: 36px;
  padding-block: 8px;
  padding-inline: 14px 4px;
  border-start-start-radius: 999px;
  border-end-start-radius: 999px;
  color: var(--ink);
  text-decoration: none;
}
.recent-item a:hover,
.recent-item a:focus-visible {
  color: var(--accent);
  outline: 0;
}
.recent-item button {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-inline-end: 2px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.recent-item button:hover,
.recent-item button:focus-visible {
  background: var(--hover);
  color: var(--ink);
  outline: 0;
}

.history-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px 16px;
  font-size: 13px;
  color: var(--muted);
}
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  cursor: pointer;
}
.toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}
.text-button {
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent);
  text-underline-offset: 3px;
  cursor: pointer;
}
.text-button:hover {
  text-decoration-color: var(--accent);
}
.text-button:focus-visible,
.toggle input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.url {
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.url code {
  font:
    13px/1.5 ui-monospace,
    Menlo,
    monospace;
}

footer {
  padding: 16px max(5vw, 16px) 22px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
footer p {
  margin: 0;
}
footer p + p {
  margin-top: 4px; /* each footer line on its own line, close together */
}

/* ---- Small screens and motion --------------------------------------------- */

@media (max-width: 520px) {
  .search {
    flex-wrap: wrap;
    padding-block: 8px;
    padding-inline: 16px 8px;
    border-radius: 20px;
  }
  .search input[type="search"] {
    flex-basis: calc(100% - 40px);
  }
  .go {
    width: 100%;
  }
  .meta {
    flex-direction: column;
  }
}
@media (prefers-reduced-motion: reduce) {
  .search,
  .market-button .chev {
    transition: none;
  }
}
