/*
 * Design tokens. Warm paper neutrals let the brochures carry the colour; a five-colour palette
 * (coral, saffron, teal, indigo, plum) marks what can be tapped, one colour per kind of thing.
 */
:root {
  color-scheme: light;
  --bg: #f7f4ef;
  --stage: #ebe6de;
  --surface: #ffffff;
  --surface-2: #f5f1eb;
  --text: #1c1a17;
  --muted: #7a736b;
  --line: #e8e2d9;
  --hover: #f3eee7;

  --coral: #e8553a;
  --coral-soft: #fdebe6;
  --saffron: #d98f00;
  --saffron-bright: #f2a900;
  --saffron-soft: #fdf1d8;
  --teal: #0f857c;
  --teal-soft: #dff2ef;
  --indigo: #4d57d1;
  --indigo-soft: #e9eafb;
  --plum: #983c88;
  --plum-soft: #f5e6f1;

  --accent: var(--coral);
  --accent-hover: #d4452b;
  --accent-soft: var(--coral-soft);
  --accent-text: #ffffff;
  --danger: #c73a2c;

  --shadow-sm: 0 1px 2px rgb(40 30 20 / 6%), 0 1px 3px rgb(40 30 20 / 5%);
  --shadow: 0 14px 34px rgb(40 30 20 / 12%), 0 3px 8px rgb(40 30 20 / 5%);
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121110;
  --stage: #0c0b0a;
  --surface: #1b1a18;
  --surface-2: #23211f;
  --text: #f1ede7;
  --muted: #a39c93;
  --line: #2f2c29;
  --hover: #2a2725;

  --coral: #ff7a5e;
  --coral-soft: #3a211b;
  --saffron: #f5b93a;
  --saffron-bright: #f5b93a;
  --saffron-soft: #372a12;
  --teal: #3cc4b8;
  --teal-soft: #12302d;
  --indigo: #8d95ff;
  --indigo-soft: #23254a;
  --plum: #e07ccd;
  --plum-soft: #371f33;

  --accent-hover: #ff9077;
  --accent-text: #1c0f0b;
  --danger: #ff8a7a;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 40%);
  --shadow: 0 16px 40px rgb(0 0 0 / 55%);
}

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

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

h1,
h2 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.025em;
}

p {
  margin: 0;
}

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

[hidden] {
  display: none !important;
}

.small {
  font-size: 13px;
  color: var(--muted);
}

.ico {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Palette helpers: a foreground and a soft background per colour */

.t-coral { --c: var(--coral); --c-soft: var(--coral-soft); }
.t-saffron { --c: var(--saffron); --c-soft: var(--saffron-soft); }
.t-teal { --c: var(--teal); --c-soft: var(--teal-soft); }
.t-indigo { --c: var(--indigo); --c-soft: var(--indigo-soft); }
.t-plum { --c: var(--plum); --c-soft: var(--plum-soft); }

.tile {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--c-soft, var(--surface-2));
  color: var(--c, var(--text));
}

.tile .ico {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.tile-lg {
  width: 46px;
  height: 46px;
  border-radius: 14px;
}

.tile-lg .ico {
  width: 22px;
  height: 22px;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 550;
  letter-spacing: -0.005em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

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

.btn .ico {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 1px 0 rgb(255 255 255 / 20%) inset, 0 4px 14px color-mix(in srgb, var(--accent) 30%, transparent);
}

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

.btn-soft {
  background: var(--surface-2);
  color: var(--text);
}

.btn-ghost {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.btn-ghost:hover,
.btn-soft:hover {
  background: var(--hover);
}

.btn-lg {
  min-height: 52px;
  padding: 0 26px;
  font-size: 16px;
  border-radius: 14px;
}

.btn-sm {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 10px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
}

.icon-btn:hover {
  color: var(--text);
}

.icon-btn .ico {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.link-btn {
  margin-left: auto;
  color: var(--accent);
  font-size: 13px;
  font-weight: 550;
  min-height: 32px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

.chip .ico {
  width: 16px;
  height: 16px;
}

/* Fields */

.field,
.select {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field:focus,
.select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.label {
  font-size: 13px;
  font-weight: 550;
  color: var(--muted);
}

/* Segmented choice */

.segmented {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 12px;
  background: var(--surface-2);
}

.segmented button {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 8px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  transition: background-color 0.15s, color 0.15s;
}

.segmented button .ico {
  width: 16px;
  height: 16px;
}

.segmented button:hover {
  color: var(--text);
}

.segmented button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* Switch */

.switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 46px;
  height: 28px;
  margin: 0;
  border-radius: 999px;
  background: var(--line);
  cursor: pointer;
  transition: background-color 0.2s;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 25%);
  transition: transform 0.2s;
}

.switch:checked {
  background: var(--teal);
}

.switch:checked::after {
  transform: translateX(18px);
}

.meter {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--coral), var(--saffron-bright));
  transition: width 0.2s ease;
}

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

/* ============================================================================================
 * Custom controls: nothing is left in the default browser look
 * ========================================================================================== */

/* Dropdown */

.dropdown {
  position: relative;
}

.dropdown-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 0 12px 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-weight: 500;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.dropdown-button .ico {
  width: 18px;
  height: 18px;
  color: var(--muted);
  transition: transform 0.2s;
}

.dropdown-button:hover {
  border-color: color-mix(in srgb, var(--muted) 45%, var(--line));
}

.dropdown.open .dropdown-button,
.dropdown-button:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.dropdown.open .dropdown-button .ico {
  transform: rotate(180deg);
}

.dropdown-button:disabled {
  opacity: 0.55;
  cursor: default;
}

.dropdown-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 50;
  margin: 0;
  padding: 5px;
  list-style: none;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: pop 0.14s ease-out;
}

.dropdown-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  padding: 0 10px 0 12px;
  border-radius: 9px;
  font-size: 14.5px;
  cursor: pointer;
}

.dropdown-list li.active {
  background: var(--hover);
}

.dropdown-list li .ico {
  width: 17px;
  height: 17px;
  stroke-width: 2.2;
  color: var(--accent);
  visibility: hidden;
}

.dropdown-list li[aria-selected="true"] {
  font-weight: 600;
}

.dropdown-list li[aria-selected="true"] .ico {
  visibility: visible;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
}

/* Slider */

input[type="range"] {
  --fill: 0%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 26px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--text) var(--fill), var(--surface-2) var(--fill));
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -8px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 2px 6px rgb(40 30 20 / 22%);
  transition: transform 0.12s;
}

input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.12);
}

input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
}

input[type="range"]::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--text);
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 2px 6px rgb(40 30 20 / 22%);
}

input[type="range"]:focus-visible {
  outline: none;
}

input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px var(--accent-soft), 0 2px 6px rgb(40 30 20 / 22%);
}

/* Checkbox */

input[type="checkbox"]:not(.switch) {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 1.5px solid color-mix(in srgb, var(--muted) 55%, var(--line));
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

input[type="checkbox"]:not(.switch)::after {
  content: "";
  width: 5px;
  height: 10px;
  margin-top: -2px;
  border: solid var(--accent-text);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.15s;
}

input[type="checkbox"]:not(.switch):checked {
  background: var(--accent);
  border-color: var(--accent);
}

input[type="checkbox"]:not(.switch):checked::after {
  transform: rotate(45deg) scale(1);
}

/* Search fields use a clear button of their own */

input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

/* Scrollbars */

* {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--muted) 35%, transparent) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 35%, transparent) padding-box;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::selection {
  background: color-mix(in srgb, var(--saffron-bright) 35%, transparent);
}
