/* EMD Finder: a claims office for domain names.
   Warm newsprint, ink, signage type, and a green stamp for open ground.

   Mobile first: everything below is the phone layout. Wider screens get the
   same single column with a little more room (see the end of the file). */

:root {
  --paper: #f1ece1;
  --paper-2: #e7e0d1;
  --panel: #fbf8f2;
  --ink: #181712;
  --ink-soft: #5f5b50;
  --ink-faint: #8f8a7c;
  --line: #ddd5c4;
  --line-strong: #b9b09c;
  --city: #1d4f7c;
  --svc: #b4511b;
  --state: #6b4f93;
  --ok: #0f7a3f;
  --ok-bg: #d6eedc;
  --no: #a19b8d;
  --maybe: #9a6200;
  --maybe-bg: #f6e6c4;
  --shadow: 0 1px 0 rgba(24, 23, 18, .04), 0 10px 28px -18px rgba(24, 23, 18, .35);
  /* Parentheses are percent-encoded so Sprockets does not mistake the filter reference for an asset path. */
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .07 0'/></filter><rect width='100%' height='100%' filter='url%28%23n%29'/></svg>");

  --display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --body: "Familjen Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --gutter: 1rem;
  --column: 720px;
  --bar-h: 68px;                 /* bottom bar height, without the iPhone home-indicator inset */
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tap: 44px;                   /* minimum comfortable touch target */
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12120e;
    --paper-2: #1c1c17;
    --panel: #1b1b16;
    --ink: #eee9dd;
    --ink-soft: #aaa596;
    --ink-faint: #767163;
    --line: #2f2e27;
    --line-strong: #494739;
    --city: #82b6e8;
    --svc: #f2945c;
    --state: #b79ae0;
    --ok: #58d38f;
    --ok-bg: #12301f;
    --no: #686458;
    --maybe: #e8b24f;
    --maybe-bg: #33280f;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 14px 36px -20px rgba(0, 0, 0, .8);
  }
}

/* ------------------------------------------------------------------- base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: var(--grain), var(--paper);
  color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--bar-h) + var(--safe-b) + 1rem); /* room for the bar */
}
button, input { font: inherit; color: inherit; }
button, label, a { -webkit-tap-highlight-color: transparent; }
code { font-family: var(--mono); }
:focus-visible { outline: 2.5px solid var(--city); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.app { max-width: var(--column); margin: 0 auto; padding: 0 var(--gutter); }

/* Which screen is showing */
body[data-view="results"] .hero,
body[data-view="results"] .setup,
body[data-view="results"] .foot { display: none; }
body[data-view="setup"] .results { display: none; }

/* --------------------------------------------------------------- masthead */
.masthead { padding-top: calc(env(safe-area-inset-top, 0px) + 1rem); }
.masthead-top {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding-bottom: .75rem; border-bottom: 1.5px solid var(--ink);
}
.brand { display: flex; align-items: center; gap: .55rem; margin: 0; font-weight: 700; font-size: 1rem; letter-spacing: -.01em; }
.brand-mark { width: 13px; height: 13px; border-radius: 3px; background: var(--ok); box-shadow: 4px 4px 0 var(--svc); margin-right: 4px; }
.tagline { margin: 0; font-family: var(--mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }

.hero { padding: 1.4rem 0 1.6rem; }
.wordmark {
  margin: 0; font-family: var(--display); font-weight: 900; text-transform: lowercase;
  font-size: clamp(3rem, 15vw, 7rem); line-height: .88; letter-spacing: -.01em;
  white-space: nowrap; /* app.js shrinks the font so the whole name fits on one line */
}
.seg { transition: color .3s; }
.seg.city { color: var(--city); }
.seg.svc { color: var(--svc); }
.seg.tld { color: var(--ink-faint); font-weight: 700; }
.caret {
  display: inline-block; width: .07em; height: .78em; margin-left: .06em; vertical-align: -.04em;
  background: var(--ink); animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.lede { margin: 1rem 0 0; color: var(--ink-soft); font-size: 1rem; max-width: 52ch; }

/* ------------------------------------------------------------ setup cards */
.setup { display: flex; flex-direction: column; gap: .9rem; }
.card {
  margin: 0; min-width: 0; padding: 1rem 1rem 1.1rem;
  background: var(--panel); border: 1.5px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
}
/* float + width makes the legend sit inside the card like a normal heading */
.card > legend { float: left; width: 100%; padding: 0; margin-bottom: .75rem; display: flex; align-items: baseline; gap: .55rem; font-weight: 700; font-size: 1.1rem; }
.card > legend + * { clear: both; }
.step { font-family: var(--mono); font-size: .7rem; font-weight: 500; color: var(--ink-faint); letter-spacing: .05em; }
.count { margin-left: auto; font-weight: 500; font-size: .85rem; color: var(--svc); }

/* 16px text in inputs stops iOS Safari from zooming in when you tap them */
input[type="text"], input[type="search"] {
  width: 100%; min-width: 0; height: var(--tap); padding: 0 .85rem; font-size: 16px;
  border: 1.5px solid var(--line-strong); border-radius: 10px; background: var(--paper);
  transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none;
}
input[type="text"]:focus, input[type="search"]:focus { outline: none; border-color: var(--city); box-shadow: 0 0 0 3px color-mix(in srgb, var(--city) 18%, transparent); }
::placeholder { color: var(--ink-faint); }

.loc-status { margin: 0 0 .7rem; }
.loc-status strong { color: var(--city); }
.loc-form { display: flex; gap: .5rem; }
.loc-form input { flex: 1; }
.variants { margin: .6rem 0 0; font-size: .85rem; color: var(--ink-soft); line-height: 1.7; }
.variants code { font-size: .78rem; background: var(--paper-2); padding: .1rem .4rem; border-radius: 4px; }

.btn-quiet {
  height: var(--tap); padding: 0 1.1rem; border: 1.5px solid var(--ink); border-radius: 10px;
  background: transparent; cursor: pointer; font-weight: 600;
}
.btn-quiet:active { background: var(--ink); color: var(--paper); }
.link {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 36px; padding: 0; background: none; border: 0;
  color: var(--city); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; cursor: pointer; font-size: .92rem;
}
.link svg { width: 16px; height: 16px; flex: none; }
.link:disabled { color: var(--ink-faint); cursor: default; text-decoration: none; }
#loc-detect { margin-top: .35rem; text-decoration: none; font-weight: 500; }

/* business types */
.niche-tools { display: flex; gap: .9rem; align-items: center; margin-bottom: .9rem; }
.niche-tools input { flex: 1; }
.niche-tools .link { flex: none; white-space: nowrap; }
.niches { display: flex; flex-direction: column; gap: 1.1rem; }
.niche-group-head { display: flex; justify-content: space-between; align-items: center; margin: 0 0 .45rem; }
.niche-group-head h3 { margin: 0; font-family: var(--mono); font-size: .7rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.group-all { font-size: .8rem; min-height: 32px; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 .9rem;
  border: 1.5px solid var(--line-strong); border-radius: 999px; background: var(--panel);
  font-size: .95rem; cursor: pointer; user-select: none;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.chip span:active { transform: scale(.96); }
.chip input:checked + span { background: var(--svc); border-color: var(--svc); color: #fff; }
.chip input:focus-visible + span { outline: 2.5px solid var(--city); outline-offset: 2px; }
.niche-empty { margin: 0; font-size: .92rem; color: var(--ink-soft); }

/* name patterns: full-width rows with custom checkboxes */
.patterns { display: flex; flex-direction: column; }
.opt { display: flex; gap: .75rem; align-items: center; min-height: 52px; padding: .45rem 0; cursor: pointer; border-top: 1px solid var(--line); }
.opt:first-child { border-top: 0; padding-top: 0; min-height: 44px; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt-box {
  flex: none; width: 22px; height: 22px; border: 1.5px solid var(--line-strong); border-radius: 6px; background: var(--paper);
  display: grid; place-items: center; transition: background .15s, border-color .15s;
}
.opt-box::after { content: ""; width: 10px; height: 5px; border: 2px solid var(--paper); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); opacity: 0; }
.opt input:checked + .opt-box { background: var(--ink); border-color: var(--ink); }
.opt input:checked + .opt-box::after { opacity: 1; }
.opt input:focus-visible + .opt-box { outline: 2.5px solid var(--city); outline-offset: 2px; }
.opt-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.opt-text code { font-size: .78rem; color: var(--ink-soft); margin-top: .1rem; overflow-wrap: anywhere; }

/* extensions: an even grid of big buttons */
.tlds { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.tld-opt input { position: absolute; opacity: 0; pointer-events: none; }
.tld-opt span {
  display: grid; place-items: center; height: var(--tap); border: 1.5px solid var(--line-strong); border-radius: 10px;
  background: var(--panel); cursor: pointer; font-family: var(--mono); font-weight: 500; font-size: .95rem;
  transition: background .15s, border-color .15s, color .15s;
}
.tld-opt input:checked + span { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.tld-opt input:focus-visible + span { outline: 2.5px solid var(--city); outline-offset: 2px; }

.hint { margin: 0; padding: 0 .25rem; font-size: .9rem; color: var(--maybe); }
.hint:empty { display: none; }

/* ---------------------------------------------------------------- results */
/* Full-bleed panel on phones: it runs edge to edge to give domains room. */
.results {
  margin: 1rem calc(var(--gutter) * -1) 0; min-height: 60vh;
  background: var(--panel); border-top: 1.5px solid var(--line); border-bottom: 1.5px solid var(--line);
}
.toolbar { padding: 1rem var(--gutter) .75rem; border-bottom: 1.5px solid var(--line); display: flex; flex-direction: column; gap: .8rem; }
.context { margin: 0; font-family: var(--mono); font-size: .7rem; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-soft); }
.context:empty { display: none; }

.tally { display: flex; gap: 1.5rem; }
.stat { display: flex; flex-direction: column; line-height: 1; }
.stat b { font-family: var(--display); font-weight: 900; font-size: 2.4rem; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat span { font-family: var(--mono); font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); margin-top: .3rem; }
.stat-ok b { color: var(--ok); }
.stat-maybe b { color: var(--maybe); }
.stat-no b { color: var(--no); }
.stat b.bump { animation: bump .35s ease-out; }
@keyframes bump { 40% { transform: translateY(-3px); } }

.tools { display: flex; align-items: center; gap: .75rem; }
.tools input { flex: 1; }
.switch { flex: none; display: flex; align-items: center; gap: .65rem; min-height: var(--tap); cursor: pointer; font-weight: 500; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { position: relative; width: 46px; height: 28px; border-radius: 999px; background: var(--line-strong); transition: background .2s; flex: none; }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--panel); box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + .switch-track { background: var(--ok); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2.5px solid var(--city); outline-offset: 2px; }

.status-line { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0 1rem; }
.progress-text { margin: 0; font-size: .85rem; color: var(--ink-soft); }
.bar-actions { display: flex; gap: 1.1rem; }

/* result sections */
/* overflow-anchor: none, so rows moving up into "Available" push the list down
   instead of the browser scrolling you along with the taken ones */
.groups { padding: 0 var(--gutter) 1rem; overflow-anchor: none; }
.group-head {
  display: flex; align-items: center; gap: .6rem; margin: 1.2rem 0 0; font-family: var(--mono); font-weight: 500;
  font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft);
}
.group-head::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.group-n { color: var(--ink-faint); }
.group[data-group="available"] .group-head { color: var(--ok); }
.group[data-group="unknown"] .group-head { color: var(--maybe); }

.list { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .15rem .75rem; align-items: center;
  padding: .75rem 0; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.dom { font-weight: 700; font-size: 1.1rem; letter-spacing: -.012em; overflow-wrap: anywhere; line-height: 1.25; }
.dom .city { color: var(--city); }
.dom .svc { color: var(--svc); }
.dom .state { color: var(--state); }
.dom .tld { color: var(--ink-faint); font-weight: 500; }
.meta { grid-column: 1; font-family: var(--mono); font-size: .72rem; color: var(--ink-soft); letter-spacing: -.01em; }
.acts { grid-row: 1 / span 2; grid-column: 2; display: flex; gap: .45rem; align-items: center; }

/* The section heading already says "Available"/"Taken", so rows only get a
   stamp while they're still waiting. */
.stamp { display: none; font-family: var(--mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); white-space: nowrap; }
.s-pending .stamp, .s-skipped .stamp { display: inline; }
.s-pending .stamp::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

.icon-btn, .buy {
  display: inline-grid; place-items: center; height: 40px; border-radius: 10px; border: 1.5px solid var(--line-strong);
  background: var(--panel); cursor: pointer; color: var(--ink-soft); transition: border-color .15s, color .15s, background .15s;
}
.icon-btn { width: 40px; padding: 0; }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.did { border-color: var(--ok); color: var(--ok); }
.buy { padding: 0 .85rem; font-size: .9rem; font-weight: 600; text-decoration: none; color: var(--paper); background: var(--ink); border-color: var(--ink); white-space: nowrap; }
.s-unknown .buy { background: var(--panel); color: var(--ink); border-color: var(--line-strong); }

.s-available .dom { font-size: 1.16rem; }
.s-taken { padding: .55rem 0; }
.s-taken .dom { color: var(--no); text-decoration: line-through; text-decoration-thickness: 1.5px; font-weight: 500; font-size: 1rem; }
.s-taken .dom span { color: inherit; }
.s-pending .dom, .s-skipped .dom { color: var(--ink-soft); }
.s-pending .dom span, .s-skipped .dom span { color: inherit; opacity: .8; }

.row.fresh { animation: land 1s ease-out; }
@keyframes land { from { background: var(--ok-bg); } to { background: transparent; } }

.empty { padding: 3.5rem 1.5rem; text-align: center; color: var(--ink-soft); max-width: 40ch; margin: 0 auto; }
.empty-title { font-family: var(--display); font-weight: 900; font-size: 2rem; color: var(--ink); margin: 0 0 .5rem; line-height: 1; }
.empty p { margin: 0 0 .5rem; }

.foot { padding: 1.5rem 0 1rem; font-size: .82rem; color: var(--ink-soft); }
.foot p { margin: 0; padding-top: 1rem; border-top: 1px solid var(--line); }

/* ------------------------------------------------------------- bottom bar */
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: .6rem var(--gutter) calc(.6rem + var(--safe-b));
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1.5px solid var(--line);
}
.bar-progress { position: absolute; top: -1.5px; left: 0; right: 0; height: 3px; }
.bar-fill { height: 100%; width: 0; background: var(--ok); transition: width .3s ease-out; }
.bar-row { max-width: calc(var(--column) - var(--gutter) * 2); margin: 0 auto; display: flex; gap: .6rem; align-items: center; min-height: 48px; }
.bar-btn {
  height: 48px; padding: 0 1rem; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--panel);
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  font-weight: 600; font-size: 1rem; white-space: nowrap; cursor: pointer; transition: transform .1s, background .15s;
}
.bar-btn:active { transform: scale(.97); }
.bar-btn:disabled { opacity: .5; cursor: default; transform: none; }
.bar-go { flex: 1; justify-content: space-between; background: var(--ink); border-color: var(--ink); color: var(--paper); font-weight: 700; font-size: 1.05rem; box-shadow: var(--shadow); }
.bar-count { font-family: var(--mono); font-weight: 400; font-size: .8rem; opacity: .75; }
.bar-to-results b { font-family: var(--display); font-weight: 900; font-size: 1.35rem; color: var(--ok); line-height: 1; }
.bar-back { padding: 0 .9rem 0 .65rem; }
.bar-back svg { width: 16px; height: 16px; }
.bar-status { flex: 1; min-width: 0; margin: 0; display: flex; flex-direction: column; line-height: 1.2; }
.bar-status b { color: var(--ok); }
.bar-status span { font-size: .78rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-act { background: var(--ok); border-color: var(--ok); color: var(--panel); font-weight: 700; }
.bar-act.is-stop { background: var(--panel); border-color: var(--line-strong); color: var(--ink); }

body[data-view="setup"] :is(.bar-back, .bar-status, .bar-act) { display: none; }
body[data-view="results"] :is(.bar-go, .bar-to-results) { display: none; }

/* ------------------------------------------------------------------ toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--bar-h) + var(--safe-b) + .75rem); z-index: 40;
  transform: translate(-50%, .75rem); opacity: 0; pointer-events: none;
  max-width: calc(100vw - 2rem); padding: .65rem 1rem; border-radius: 10px;
  background: var(--ink); color: var(--paper); font-size: .92rem; font-weight: 500; box-shadow: var(--shadow);
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------- mouse & trackpad only */
/* Hover effects only where there's a real pointer, so they don't stick after a tap. */
@media (hover: hover) {
  .btn-quiet:hover { background: var(--ink); color: var(--paper); }
  .link:hover { text-decoration-thickness: 2px; }
  .chip span:hover { border-color: var(--svc); }
  .tld-opt span:hover { border-color: var(--ink); }
  .row:hover { background: linear-gradient(90deg, transparent, var(--paper) 12%, var(--paper) 88%, transparent); }
  .icon-btn:hover { border-color: var(--ink); color: var(--ink); }
  .buy:hover { background: var(--ok); border-color: var(--ok); }
  .s-unknown .buy:hover { background: var(--panel); border-color: var(--ink); }
  .bar-go:hover { background: var(--ok); border-color: var(--ok); }
}

/* --------------------------------------------------------- bigger screens */
/* Same layout, more room. */
@media (min-width: 560px) {
  :root { --gutter: 1.5rem; }
  .tlds { grid-template-columns: repeat(6, 1fr); }
  .card { padding: 1.25rem 1.4rem 1.4rem; }
}
@media (min-width: 760px) {
  body { font-size: 17px; }
  .masthead { padding-top: 1.75rem; }
  .hero { padding: 2rem 0 2.2rem; }
  .lede { font-size: 1.1rem; }
  /* the results panel has room to be a card again */
  .results { margin: 1rem 0 0; border: 1.5px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); overflow: clip; }
  .dom { font-size: 1.2rem; }
  .s-available .dom { font-size: 1.28rem; }
}

/* ------------------------------------------------------------- page load */
.masthead, .card, .results { animation: rise .55s cubic-bezier(.2, .7, .2, 1) backwards; }
.card:nth-of-type(1) { animation-delay: .06s; }
.card:nth-of-type(2) { animation-delay: .1s; }
.card:nth-of-type(3) { animation-delay: .14s; }
.card:nth-of-type(4) { animation-delay: .18s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
