/* Drop the Feel: one family (Bricolage Grotesque, self-hosted), lavender base,
   ten mood colours. The bold moment is the colour flood after a drop. */

@font-face {
  font-family: 'Bricolage';
  src: url('/assets/fonts/bricolage-regular.woff') format('woff');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Bricolage';
  src: url('/assets/fonts/bricolage-bold.woff') format('woff');
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --bg: #F6F0FF;
  --surface: #FFFFFF;
  --ink: #1E0B33;
  --muted: #5B4A73;
  --line: #E2D6F5;
  --on-mood: #1E0B33;   /* text on every mood colour, light or dark theme */
  --focus: #6A2BD9;
  --mood: #A08CFF;      /* set by the app to the latest mood */
  --radius-l: 26px;
  --radius-m: 16px;
  --page-max: 90rem;                         /* widest the page gets (1440px at default text size) */
  --gutter: clamp(1rem, 4vw, 3.5rem);        /* side space: grows with the screen */
  --gap: clamp(.625rem, 1.2vw, 1rem);        /* space between cards and buttons */
  --font: 'Bricolage', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --emoji: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  --aurora:
    radial-gradient(55rem 38rem at 0% -10%, rgba(166, 137, 255, .32), transparent 60%),
    radial-gradient(48rem 34rem at 100% 0%, rgba(255, 154, 209, .30), transparent 62%),
    radial-gradient(50rem 36rem at 60% 105%, rgba(255, 214, 65, .18), transparent 60%),
    radial-gradient(42rem 30rem at 0% 90%, rgba(42, 197, 182, .14), transparent 60%);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --aurora:
      radial-gradient(55rem 38rem at 0% -10%, rgba(124, 77, 255, .34), transparent 60%),
      radial-gradient(48rem 34rem at 100% 0%, rgba(255, 105, 180, .20), transparent 62%),
      radial-gradient(50rem 36rem at 60% 105%, rgba(90, 164, 255, .18), transparent 60%),
      radial-gradient(42rem 30rem at 0% 90%, rgba(42, 197, 182, .14), transparent 60%);
    --bg: #160A26;
    --surface: #26163D;
    --ink: #F6F0FF;
    --muted: #C3B4DA;
    --line: #3A2858;
    --focus: #C9B6FF;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--aurora), var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.5;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 10px; z-index: 50; }
.skip:focus { left: 16px; }

/* Header */
.top {
  display: flex; align-items: center; gap: 1rem;
  box-sizing: content-box; min-height: 2.5rem; /* same height with or without the language picker, so the logo never moves */
  max-width: var(--page-max); margin: 0 auto; padding: clamp(.75rem, 2vw, 1.25rem) var(--gutter) .4rem;
}
.wordmark {
  font-weight: 700; font-size: 1.35rem; letter-spacing: -0.03em;
  text-decoration: none; display: inline-flex; align-items: center; gap: 2px;
  margin-right: auto;
}
/* The favicon's rainbow drop (drawn in templates/layout.php). */
.wm-drop { width: .52em; height: .68em; margin: 0 .16em 0 .12em; flex: none; transform: translateY(-.02em); }
.lang select {
  appearance: none; background: var(--surface); color: var(--ink); border: 1.5px solid var(--line);
  border-radius: 999px; padding: .4rem .9rem; font-size: .95rem; cursor: pointer;
}
/* The open list draws its own background: give options readable colours in both themes. */
.lang select option { background: var(--surface); color: var(--ink); }

/* Tabs: bottom bar on phones, inline on wide screens */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around;
  background: var(--surface); border-top: 1.5px solid var(--line);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
}
.tabs a {
  flex: 1; text-align: center; text-decoration: none; font-weight: 700;
  padding: 10px 6px; border-radius: 14px; font-size: .98rem; color: var(--muted);
}
.tabs a[aria-current="page"] { color: var(--ink); background: var(--bg); }
@media (min-width: 760px) {
  body { padding-bottom: 0; }
  .tabs { position: static; background: none; border: 0; padding: 0; gap: 4px; }
  .tabs a { flex: none; padding: 8px 16px; }
}

/* Main */
main { max-width: var(--page-max); margin: 0 auto; padding: .5rem var(--gutter) 2.5rem; outline: none; }
h1 {
  font-size: clamp(2.5rem, 9vw, 4.75rem);
  line-height: .98; letter-spacing: -0.04em; font-weight: 700;
  margin: 28px 0 12px; max-width: 14ch;
}
h2 { font-size: 1.5rem; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 8px; }
.lede { color: var(--muted); font-size: 1.15rem; margin: 0 0 24px; max-width: 46ch; }
.hint { color: var(--muted); font-size: .92rem; margin: 4px 0 0; max-width: 60ch; }
.status { min-height: 1.5em; font-weight: 700; margin: 10px 0 0; }

/* Mood buttons: the heart of the page */
/* Cards per row grows with the screen (2 on phones, so long words like
   "Nimechangamka" fit, up to 7 on wide screens); a shorter last row stretches to
   fill the width, so there are never gaps. */
.moods { --per-row: 2; display: flex; flex-wrap: wrap; gap: var(--gap); container-type: inline-size; }
.moods > .mood { flex: 1 1 calc((100% - (var(--per-row) - 1) * var(--gap)) / var(--per-row)); min-width: 0; }
@media (min-width: 30em) { .moods { --per-row: 3; } }
@media (min-width: 46em) { .moods { --per-row: 4; } }
@media (min-width: 56em) { .moods { --per-row: 5; } }
@media (min-width: 72em) { .moods { --per-row: 7; } }
.mood {
  position: relative; border: 0; cursor: pointer; text-align: center;
  background: var(--c); color: var(--on-mood);
  border-radius: var(--radius-l); padding: .9rem 1rem .75rem; min-height: clamp(6rem, 9vw, 8.5rem);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .55rem;
  transition: transform .12s ease;
}
.mood:active { transform: scale(.96); }
.mood .e { font-family: var(--emoji); font-size: clamp(2rem, 3.2vw, 2.6rem); line-height: 1; }
/* Names shrink a little on narrow cards and break between words (hyphenating long
   single words where the browser can), never in the middle of a short word. */
.mood .w {
  font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; overflow-wrap: break-word; hyphens: auto;
  font-size: clamp(.9rem, 3.4vw, 1.2rem); /* older browsers */
  /* Sized from the card's own width (container units), so the longest names fit. */
  font-size: clamp(.85rem, calc((100cqi - (var(--per-row) - 1) * var(--gap)) / var(--per-row) * .095), 1.2rem);
}
.mood[aria-busy="true"] { opacity: .6; }

/* The drop page's opening (title, intro, area line) is centred above the cards. */
[data-view="drop"] > :is(h1, .lede, .hint, .status) { text-align: center; margin-inline: auto; }
[data-view="drop"] > .area { justify-content: center; }
.area { margin: 20px 0 0; font-weight: 700; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.link {
  background: none; border: 0; padding: 0; cursor: pointer; font-weight: 700;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px;
}

/* World */
.world-peek { margin-top: 48px; padding-top: 28px; border-top: 1.5px solid var(--line); }
.world-total { font-weight: 700; font-size: 1.15rem; margin: 0 0 12px; }
.ribbon {
  display: flex; height: 34px; border-radius: 999px; overflow: hidden;
  background: var(--line); margin: 0 0 14px;
}
.ribbon span { background: var(--c); min-width: 3px; }
.ribbon.thin { height: 8px; margin: 8px 0 0; }
.legend { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .95rem; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 50%; background: var(--c); display: inline-block; }
.places { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); }
.place {
  background: var(--surface); border-radius: var(--radius-m); padding: 14px 16px;
  display: grid; grid-template-columns: 48px 1fr auto; gap: 2px 12px; align-items: center;
}
.place .badge {
  grid-row: span 2; width: 48px; height: 48px; border-radius: 50%; background: var(--c);
  display: grid; place-items: center; font-family: var(--emoji); font-size: 1.5rem;
}
.place .name { font-weight: 700; line-height: 1.2; }
.place .country { color: var(--muted); font-weight: 400; }
.place .n { color: var(--muted); font-size: .92rem; text-align: right; }
.place .mostly { font-size: .95rem; color: var(--muted); }
.place .ribbon { grid-column: 1 / -1; }
.empty { background: var(--surface); border-radius: var(--radius-m); padding: 20px; color: var(--muted); }
.more { display: inline-block; margin-top: 16px; font-weight: 700; text-underline-offset: 3px; }

/* Your feels */
.mine-top { font-weight: 700; font-size: 1.2rem; margin: 0 0 16px; }
.history { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 8px; }
.history li {
  display: flex; align-items: center; gap: 12px; background: var(--surface);
  border-radius: var(--radius-m); padding: 10px 14px;
}
.history .dot { width: 36px; height: 36px; border-radius: 50%; background: var(--c); display: grid; place-items: center; font-family: var(--emoji); }
.history time { margin-left: auto; color: var(--muted); font-size: .9rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; padding: 12px 20px; font-weight: 700; cursor: pointer;
  text-decoration: none; border: 2px solid transparent; min-height: 48px;
}
.btn.ink { background: var(--on-mood); color: #FFFFFF; }
.btn.ghost { background: transparent; border-color: currentColor; }
.btn.big { width: 100%; margin-top: 36px; background: var(--on-mood); color: #FFFFFF; font-size: 1.15rem; min-height: 60px; }
main .btn.ghost { color: var(--ink); }

/* The flood */
.flood {
  position: fixed; inset: 0; z-index: 40; overflow-y: auto; overscroll-behavior: contain;
  background: var(--mood); color: var(--on-mood);
  clip-path: circle(0 at var(--x, 50%) var(--y, 50%));
  outline: none;
}
.flood.open { clip-path: circle(150% at var(--x, 50%) var(--y, 50%)); transition: clip-path .7s cubic-bezier(.6, 0, .2, 1); }
.flood.instant { transition: none; }
.flood-inner { max-width: 46rem; margin: 0 auto; padding: 2rem var(--gutter) calc(2.5rem + env(safe-area-inset-bottom)); }
.flood-kicker { font-weight: 700; font-size: 1.1rem; margin: 8px 0 0; }
.flood-mood {
  font-size: clamp(3.5rem, 17vw, 7.5rem); line-height: .92; letter-spacing: -0.05em;
  margin: 4px 0 18px; max-width: none; overflow-wrap: anywhere;
}
.flood-mood #flood-emoji { font-family: var(--emoji); display: block; font-size: .7em; line-height: 1.2; margin-bottom: .1em; }
.flood-count { font-size: 1.45rem; line-height: 1.25; font-weight: 700; margin: 0 0 4px; max-width: 26ch; }
.flood-country { margin: 0 0 32px; font-size: 1.1rem; }
.flood h2 { margin-top: 32px; }
.flood-help { margin: 0 0 12px; }
.music { display: flex; flex-wrap: wrap; gap: 8px; }
.music a { background: var(--on-mood); color: #FFFFFF; }

.support {
  background: rgba(255, 255, 255, .72); border-radius: var(--radius-l); padding: 20px;
  margin: 0 0 8px;
}
.support h2 { margin: 0 0 8px; font-size: 1.35rem; }
.support p { margin: 0 0 14px; }
.support .support-danger { font-size: .95rem; margin-top: 14px; }
.support .support-danger a { font-weight: 700; text-underline-offset: 3px; }
.breathe { text-align: center; padding: 16px 0 4px; }
.breathe-circle {
  width: 120px; height: 120px; margin: 0 auto; border-radius: 50%;
  background: var(--mood); transform: scale(.55); transition: transform 4s ease-in-out;
}
.breathe-circle.in { transform: scale(1); }
.breathe-word { font-weight: 700; font-size: 1.3rem; margin: 12px 0 6px; }

.share { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
#card {
  width: 200px; height: auto; aspect-ratio: 9 / 16; border-radius: 18px;
  box-shadow: 0 0 0 2px var(--on-mood);
}
.share-controls { flex: 1 1 240px; }
#note {
  width: 100%; border: 2px solid var(--on-mood); border-radius: 14px; background: rgba(255, 255, 255, .6);
  padding: 12px 14px; margin-bottom: 12px; color: var(--on-mood);
}
#note::placeholder { color: #4A3A60; }
.share-buttons { display: flex; flex-wrap: wrap; gap: 8px; }

/* Area dialog */
dialog {
  border: 0; border-radius: var(--radius-l); padding: 24px; width: min(480px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink);
}
dialog::backdrop { background: rgba(30, 11, 51, .55); }
#area-select {
  width: 100%; padding: 12px; border-radius: 14px; border: 2px solid var(--line); background: var(--bg);
  margin: 8px 0;
}
.area-form .share-buttons { margin-top: 16px; }
.area-form .btn.ink { background: var(--ink); color: var(--bg); }

/* Ads: clearly labelled, never inside the mood grid or support box. The slot is as
   wide as the page allows (up to a 970px leaderboard) so AdSense's responsive units
   can pick a size, and keeps space reserved so the page doesn't jump when an ad loads. */
.ad-slot { width: 100%; max-width: 60.625rem; margin: 2rem auto 0; min-height: 7.5rem; overflow: hidden; }
.ad-slot ins.adsbygoogle { display: block; width: 100%; min-height: 6.25rem; }
@media (min-width: 48em) { .ad-slot { min-height: 8.5rem; } }
.ad-slot::before { content: attr(data-label); display: block; font-size: .8rem; color: var(--muted); margin-bottom: 4px; }
.flood .ad-slot::before { color: var(--on-mood); }

.foot {
  width: calc(100% - 2 * var(--gutter)); max-width: calc(var(--page-max) - 2 * var(--gutter)); margin: 0 auto; padding: 1.5rem 0 2rem; color: var(--muted); font-size: .92rem;
  border-top: 1.5px solid var(--line); text-align: center;
}
.foot p { margin: 0 0 6px; }
.foot a { margin: 0 .5rem; font-weight: 700; }

/* Text pages (privacy, terms): same layout as the home page, so the logo stays in
   the same place; the text uses the full page width and grows with the screen.
   No bottom tab bar. */
.doc-page { padding-bottom: 0; }
.doc .lede { max-width: none; }
.doc h1 { max-width: none; font-size: clamp(2.2rem, 7vw, 3.5rem); }
.doc h2 { margin-top: 2.25rem; }
.doc ul { padding-left: 1.2em; }
.doc .fill { background: #FFE9A8; color: #1E0B33; padding: 0 4px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  .flood.open, .mood { transition: none; }
  .breathe-circle { transition: none; }
}

/* Mood Index */
.index .kicker { font-weight: 700; color: var(--muted); margin: 28px 0 0; }
.index .kicker + h1 { margin-top: 4px; }
.index section { margin-top: 40px; }
.index .note { background: var(--surface); border-left: 6px solid var(--mood); border-radius: var(--radius-m); padding: 12px 16px; max-width: 60ch; }
.top-moods { font-size: 1.05rem; }
.changes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.changes li {
  display: flex; align-items: center; gap: 12px; background: var(--surface);
  border-radius: var(--radius-m); padding: 10px 14px; font-weight: 700;
}
.changes .badge { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--c); display: grid; place-items: center; font-family: var(--emoji); }
.index-actions { margin-top: 40px; }
.index .btn.ink { background: var(--ink); color: var(--bg); }
.months { margin-top: 48px; padding-top: 28px; border-top: 1.5px solid var(--line); }
.months ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.months a {
  display: inline-block; padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--line);
  text-decoration: none; font-weight: 700;
}

/* World map (assets/world.js) */
.map-wrap { margin: 0 0 28px; }
.map { position: relative; }
.map svg {
  display: block; width: 100%; height: auto; background: var(--surface); border-radius: var(--radius-l);
  touch-action: pan-y; user-select: none; -webkit-user-select: none;
}
.map svg.zoomed { touch-action: none; cursor: grab; }
.land path {
  fill: var(--line); stroke: var(--surface); stroke-width: .7; stroke-linejoin: round;
  vector-effect: non-scaling-stroke; transition: fill .3s ease;
}
.land path[tabindex="0"] { cursor: pointer; }
.land path.sel { stroke: var(--ink); stroke-width: 2; }
.land path:focus { outline: none; }
.land path:focus-visible { stroke: var(--focus); stroke-width: 3; }
.dots circle { stroke: var(--ink); cursor: pointer; }
.dots circle:focus { outline: none; }
.dots circle:focus-visible { stroke: var(--focus); }
.map-controls { position: absolute; top: 10px; right: 10px; display: grid; gap: 6px; z-index: 1; }
.map-controls button {
  width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--bg);
  font-size: 1.25rem; font-weight: 700; line-height: 1; cursor: pointer;
}
.map-info { min-height: 3.2em; margin: 10px 0 0; color: var(--muted); }
.map-info strong { color: var(--ink); }
.map-info .ribbon { max-width: 420px; }
@media (prefers-reduced-motion: reduce) { .land path { transition: none; } }
@media (max-width: 620px) {
  .map-controls { top: 6px; right: 6px; grid-auto-flow: column; gap: 4px; }
  .map-controls button { width: 32px; height: 32px; font-size: 1.05rem; }
}
