/* ==========================================================================
   DateSpark stylesheet, direction D: product app UI.
   A phone screenshot of this site should pass for a native app: compact app
   bar, sticky segmented-control toolbar, tappable list rows, mobile bottom
   action bar, light + dark product surfaces, one warm ember accent.
   Fonts: Hanken Grotesk (UI voice), DM Mono (numerals, badges, meta).
   Every color pair below is AA-verified in both modes (tools_contrast.py).
   ========================================================================== */

/* ---- Fonts ---------------------------------------------------------------- */

@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/hanken-grotesk-var.woff2") format("woff2");
}

@font-face {
  font-family: "DM Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/dm-mono-500.woff2") format("woff2");
}

/* ---- Tokens ---------------------------------------------------------------- */

:root {
  color-scheme: light dark;

  /* contract tokens */
  --bg: #F7F5F2;
  --surface: #FFFFFF;
  --ink: #211C17;
  --muted: #5F574D;
  --accent: #B8431C;
  --accent-soft: #F9E7DF;
  --font-display: "Hanken Grotesk", "Avenir Next", system-ui, sans-serif;
  --font-body: "Hanken Grotesk", "Avenir Next", system-ui, sans-serif;

  /* app tokens */
  --font-mono: "DM Mono", "SF Mono", ui-monospace, Menlo, monospace;
  --surface-2: #EDEAE4;
  --surface-hover: #FBF8F3;
  --seg-fill: #FFFFFF;
  --border: #E4E0D8;
  --accent-ink: #FFFFFF;
  --accent-hover: #A53A15;
  --spot-ring: rgba(184, 67, 28, 0.4);
  --shadow-row: 0 1px 2px rgba(33, 24, 15, 0.04);
  --shadow-seg: 0 1px 2px rgba(33, 24, 15, 0.1), 0 0 0 1px rgba(33, 24, 15, 0.04);
  --shadow-btn: 0 1px 2px rgba(33, 24, 15, 0.14);

  /* price tier badge tints */
  --tier-free-bg: #E3EFDF;
  --tier-free-tx: #2F6132;
  --tier-u25-bg: #ECE9E2;
  --tier-u25-tx: #5A5245;
  --tier-mid-bg: #F4E9D4;
  --tier-mid-tx: #775010;
  --tier-spl-bg: #F9E4DB;
  --tier-spl-tx: #9E3917;

  --appbar-h: 56px;
  --radius-row: 12px;
  --radius-ctl: 10px;
  --ease-out: cubic-bezier(0.2, 0.7, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141110;
    --surface: #1D1916;
    --ink: #EFE9E1;
    --muted: #ABA196;
    --accent: #FF7047;
    --accent-soft: #33211A;

    --surface-2: #272119;
    --surface-hover: #241F1B;
    --seg-fill: #3A322A;
    --border: #302A24;
    --accent-ink: #2A1208;
    --accent-hover: #FF825E;
    --spot-ring: rgba(255, 112, 71, 0.4);
    --shadow-row: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-seg: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-btn: 0 1px 2px rgba(0, 0, 0, 0.35);

    --tier-free-bg: #232C1F;
    --tier-free-tx: #AECC9F;
    --tier-u25-bg: #2A2620;
    --tier-u25-tx: #C0B6A7;
    --tier-mid-bg: #322A1B;
    --tier-mid-tx: #DBB475;
    --tier-spl-bg: #362019;
    --tier-spl-tx: #F29B79;
  }
}

/* ---- Reset and base -------------------------------------------------------- */

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 0.4em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(1.5rem, 1.1rem + 1.6vw, 1.875rem);
  font-weight: 700;
}

h2 {
  font-size: 1.125rem;
  font-weight: 600;
}

h3 {
  font-size: 0.9375rem;
  font-weight: 600;
}

p {
  margin: 0 0 0.8em;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
  transition: color 140ms var(--ease-out);
}

a:hover {
  color: var(--accent-hover);
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

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

button {
  font: inherit;
}

main {
  display: block;
  max-width: 1080px;
  margin-inline: auto;
  padding-inline: clamp(1rem, 3vw, 1.5rem);
}

/* ---- Visually hidden utility ------------------------------------------------ */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---- Skip link ------------------------------------------------------------- */

.skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link:focus-visible {
  position: fixed;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 100;
  width: auto;
  height: auto;
  clip-path: none;
  padding: 0.55rem 0.9rem;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-ctl);
}

/* ---- App bar ----------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--appbar-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.site-header__in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 100%;
  max-width: 1080px;
  margin-inline: auto;
  padding-inline: clamp(1rem, 3vw, 1.5rem);
}

.site-header__brand {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.site-header__brand img {
  display: block;
  height: 20px;
  width: auto;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  min-width: 0;
}

.site-nav__link {
  color: var(--muted);
  font-size: 0.84375rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  padding-block: 0.35rem;
  transition: color 140ms var(--ease-out);
}

.site-nav__link:hover {
  color: var(--ink);
}

.site-nav__link[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
}

/* ---- Screen header (compact, the tool is the hero) ---------------------------- */

.hero {
  padding-block: 1.25rem 0.9rem;
}

.hero h1 {
  max-width: 34ch;
  margin-bottom: 0.3em;
}

.hero p {
  max-width: 64ch;
  margin: 0 0 0.3em;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.hero .hero__kicker,
.hero .hero__hint {
  font-size: 0.8125rem;
}

@media (max-width: 719px) {
  .hero {
    padding-block: 1rem 0.75rem;
  }

  .hero h1 {
    font-size: 1.375rem;
  }

  .hero p {
    font-size: 0.8125rem;
  }
}

/* ---- Toolbar: segmented controls + primary action ----------------------------- */

.filters {
  position: sticky;
  top: var(--appbar-h);
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding-block: 0.75rem;
  scroll-margin-top: var(--appbar-h);
}

.filters__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1.25rem;
}

.filters__block {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.filters__caption {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.filters__group {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: var(--radius-ctl);
  max-width: 100%;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 30px;
  padding: 0 0.7rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 140ms var(--ease-out), color 140ms var(--ease-out),
    box-shadow 140ms var(--ease-out), transform 120ms var(--ease-out);
}

.filter-btn:hover {
  color: var(--ink);
}

.filter-btn:active {
  transform: scale(0.97);
}

.filter-btn.is-active {
  background: var(--seg-fill);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-seg);
}

.filter-btn__count {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.6875rem;
  color: var(--muted);
}

.filters__actions {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-left: auto;
  padding-bottom: 1px;
}

.filters__count {
  margin: 0;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ---- Buttons -------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font-body);
  transition: background-color 140ms var(--ease-out), transform 120ms var(--ease-out),
    box-shadow 140ms var(--ease-out);
}

.btn--surprise {
  height: 38px;
  padding: 0 1.1rem;
  border-radius: var(--radius-ctl);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-btn);
}

.btn--surprise:hover {
  background: var(--accent-hover);
}

.btn--surprise:active {
  transform: scale(0.98);
}

.ico-spark {
  flex: 0 0 auto;
}

/* ---- Results list ------------------------------------------------------------------ */

.idea-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding-block: 0.75rem 3rem;
}

.idea-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  column-gap: 0.6rem;
  row-gap: 0.3rem;
  padding: 0.8rem 1rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-row);
  box-shadow: var(--shadow-row);
  scroll-margin-top: calc(var(--appbar-h) + 8rem);
  transition: background-color 140ms var(--ease-out), border-color 140ms var(--ease-out);
}

.idea-card:hover {
  background: var(--surface-hover);
  border-color: var(--muted);
}

.idea-card:active {
  background: var(--surface-2);
}

.idea-card[hidden] {
  display: none;
}

.idea-card__labels {
  display: contents;
}

.idea-card__price {
  grid-row: 1;
  grid-column: 1;
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.6875rem;
  white-space: nowrap;
  background: var(--tier-u25-bg);
  color: var(--tier-u25-tx);
}

.idea-card[data-price="free"] .idea-card__price {
  background: var(--tier-free-bg);
  color: var(--tier-free-tx);
}

.idea-card[data-price="25-100"] .idea-card__price {
  background: var(--tier-mid-bg);
  color: var(--tier-mid-tx);
}

.idea-card[data-price="splurge"] .idea-card__price {
  background: var(--tier-spl-bg);
  color: var(--tier-spl-tx);
}

.idea-card__category {
  grid-row: 1;
  grid-column: 2;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.6875rem;
  font-weight: 500;
  white-space: nowrap;
  color: var(--muted);
  background: var(--surface-2);
}

.idea-card__title {
  grid-column: 1 / -1;
  margin: 0.1rem 0 0;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
}

.idea-card__blurb {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.idea-card__meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0.45rem;
  margin: 0.15rem 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.6875rem;
  color: var(--muted);
}

.idea-card__meta li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
}

.idea-card__meta li + li::before {
  content: "\00B7";
}

/* Desktop rows: leading badge column, trailing mood tag, Things/Linear grammar */
@media (min-width: 720px) {
  .idea-card {
    grid-template-columns: 88px 1fr auto;
    column-gap: 0.8rem;
    row-gap: 0.2rem;
    padding: 0.8rem 1.1rem;
  }

  .idea-card__price {
    grid-row: 1;
    grid-column: 1;
    justify-self: start;
    margin-top: 1px;
  }

  .idea-card__title {
    grid-row: 1;
    grid-column: 2;
    margin: 0;
  }

  .idea-card__category {
    grid-row: 1;
    grid-column: 3;
    justify-self: end;
  }

  .idea-card__blurb {
    grid-row: 2;
    grid-column: 2 / -1;
  }

  .idea-card__meta {
    grid-row: 3;
    grid-column: 2 / -1;
  }
}

/* ---- Surprise selection state --------------------------------------------------- */

.is-spotlight {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.is-spotlight:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.is-spotlight::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: var(--radius-row);
  pointer-events: none;
  box-shadow: 0 0 0 0 var(--spot-ring);
  animation: spot-ping 280ms var(--ease-out) 1 forwards;
}

@keyframes spot-ping {
  to {
    box-shadow: 0 0 0 14px transparent;
  }
}

/* ---- Empty state ------------------------------------------------------------------ */

.card-hidden-note {
  margin: 0.75rem 0 0;
  padding: 1.4rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-row);
}

/* ---- Mobile bottom action bar ------------------------------------------------------ */

.action-bar {
  display: none;
}

@media (max-width: 719px) {
  .action-bar {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 60;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.55rem 1rem calc(0.7rem + env(safe-area-inset-bottom, 0px));
    background: var(--bg);
    border-top: 1px solid var(--border);
  }

  .action-bar[hidden] {
    display: none;
  }

  .action-bar__count {
    margin: 0;
    text-align: center;
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.75rem;
    color: var(--muted);
  }

  .action-bar__btn {
    width: 100%;
    height: 48px;
    font-size: 0.9375rem;
  }

  body.has-action-bar {
    padding-bottom: 108px;
  }

  /* toolbar collapses: captions off, groups become scrollable strips */
  .filters {
    padding-block: 0.6rem;
  }

  .filters__bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
  }

  .filters__caption {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .filters__group {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .filters__group::-webkit-scrollbar {
    display: none;
  }

  .filter-btn {
    flex: 0 0 auto;
  }

  /* the primary action moves to the bottom bar; the live count stays audible */
  .filters__actions {
    margin: 0;
    padding: 0;
  }

  .filters__actions .btn--surprise {
    display: none;
  }

  .filters__count {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* ---- Hub screens --------------------------------------------------------------------- */

.hub-intro {
  padding-block: 1.5rem 0.4rem;
}

.hub-intro h1 {
  max-width: 30ch;
}

.hub-intro p {
  max-width: 68ch;
  color: var(--muted);
  font-size: 0.875rem;
}

.hub-ideas h2,
.faq h2 {
  margin: 1rem 0 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.hub-ideas .idea-grid {
  padding-top: 0;
}

.hub-back {
  margin: -1.5rem 0 0;
  padding-bottom: 3rem;
}

.hub-back a {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-ctl);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 140ms var(--ease-out), border-color 140ms var(--ease-out);
}

.hub-back a:hover {
  background: var(--surface-hover);
  border-color: var(--muted);
  color: var(--ink);
}

/* ---- FAQ as settings groups ------------------------------------------------------------ */

.faq {
  max-width: 760px;
  padding-bottom: 3rem;
}

.faq__group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-row);
  box-shadow: var(--shadow-row);
}

.faq__item {
  padding: 0.85rem 1.1rem 0.9rem;
}

.faq__item + .faq__item {
  border-top: 1px solid var(--border);
}

.faq__q {
  margin: 0 0 0.25rem;
  font-size: 0.9375rem;
}

.faq__a {
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.55;
}

/* ---- Prose screens (about, privacy, 404) ------------------------------------------------- */

.prose {
  max-width: 660px;
  padding-block: 1.5rem 3.5rem;
}

.prose h1 {
  margin-bottom: 0.6em;
}

.prose h2 {
  font-size: 1rem;
  margin: 1.8em 0 0.4em;
}

.prose h3 {
  margin: 1.5em 0 0.3em;
}

.prose p,
.prose li {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.65;
}

.prose ul,
.prose ol {
  padding-left: 1.2rem;
  margin: 0 0 1em;
}

.prose li {
  margin-bottom: 0.35em;
}

.prose li::marker {
  color: var(--accent);
}

.prose strong {
  color: var(--ink);
}

.prose blockquote {
  margin: 1.4em 0;
  padding: 0.1em 0 0.1em 1em;
  border-left: 2px solid var(--accent);
  color: var(--ink);
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}

/* ---- Footer -------------------------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.site-footer__in {
  max-width: 1080px;
  margin-inline: auto;
  padding: 1.1rem clamp(1rem, 3vw, 1.5rem) 1.3rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 1.5rem;
}

.site-footer__name {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
}

.site-footer__nav {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.9rem;
}

.site-footer__nav a {
  color: var(--muted);
  font-size: 0.75rem;
  text-decoration: none;
  white-space: nowrap;
}

.site-footer__nav a:hover {
  color: var(--ink);
}

.site-footer__tagline {
  flex-basis: 100%;
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
}

/* ---- Small screens: compact nav ------------------------------------------------------------- */

@media (max-width: 719px) {
  .site-nav {
    gap: 1rem;
  }

  .site-nav__link.is-mood {
    display: none;
  }
}

/* ---- Reduced motion --------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .filter-btn:active,
  .btn--surprise:active {
    transform: none;
  }

  .is-spotlight::after {
    animation: none;
    box-shadow: 0 0 0 3px var(--spot-ring);
  }
}
