/* USDLKR — shared design tokens and components (public site + admin) */

:root {
  /* Colour: ocean teal ink on cool mist paper, with the gold and maroon of the Sri Lankan flag */
  --paper: #e8edee;
  --surface: #f3f6f7;
  --surface-hi: #fbfcfc;
  --ink: #10262e;
  --ink-soft: #46606a;
  --line: #d2dbdd;
  --teal: #0b5d66;
  --teal-deep: #073f47;
  --teal-tint: #d6e7e7;
  --gold: #e2a72e;
  --gold-deep: #8a5f00;
  --gold-tint: #f8ecd0;
  --up: #17754a;
  --down: #a3243b;
  --warn-bg: #fff3c4;

  /* Soft UI: every raised surface is lit from the top-left */
  --raise: 6px 6px 16px rgba(16, 38, 46, 0.1), -6px -6px 16px rgba(255, 255, 255, 0.85);
  --raise-sm: 3px 3px 8px rgba(16, 38, 46, 0.1), -3px -3px 8px rgba(255, 255, 255, 0.9);
  --press: inset 2px 2px 5px rgba(16, 38, 46, 0.12), inset -2px -2px 5px rgba(255, 255, 255, 0.95);

  --r-plate: 28px;
  --r-card: 18px;
  --r-field: 12px;
  --r-pill: 999px;

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Source Serif 4", Georgia, "Times New Roman", serif;

  --wrap: 1180px;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}
h1 { font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.6rem); }
h2 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem); }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }

p { margin: 0 0 1em; }
a { color: var(--teal); text-underline-offset: 0.18em; }
a:hover { color: var(--teal-deep); }
img { max-width: 100%; height: auto; display: block; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.6em 0; }

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

.ui, button, input, select, textarea, label, table, nav, .btn { font-family: var(--font-display); }

.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.9rem; }
.center { text-align: center; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.wrap { width: min(var(--wrap), 100% - 2rem); margin-inline: auto; }

/* --- Cards ---------------------------------------------------------------- */
.card {
  background: var(--surface);
  border-radius: var(--r-card);
  box-shadow: var(--raise);
  padding: 1.5rem;
}
.card > :last-child { margin-bottom: 0; }

/* --- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  border: 0; cursor: pointer; text-decoration: none;
  font-size: 0.98rem; font-weight: 600; line-height: 1.2;
  padding: 0.7rem 1.2rem; border-radius: var(--r-pill);
  background: var(--surface); color: var(--teal-deep);
  box-shadow: var(--raise-sm);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.btn:hover { color: var(--teal-deep); transform: translateY(-1px); }
.btn:active { box-shadow: var(--press); transform: none; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { color: #fff; background: var(--teal-deep); }
.btn-gold { background: var(--gold); color: #2a1d00; }
.btn-gold:hover { color: #2a1d00; }
.btn-danger { color: var(--down); }
.btn-sm { padding: 0.45rem 0.85rem; font-size: 0.88rem; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }

/* --- Forms ---------------------------------------------------------------- */
label { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 0.35rem; }
.field { margin-bottom: 1.15rem; }
.field .help { font-family: var(--font-body); font-size: 0.9rem; color: var(--ink-soft); margin: 0.35rem 0 0; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="url"], input[type="search"], input[type="date"], input[type="datetime-local"], select, textarea {
  width: 100%;
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid transparent;
  border-radius: var(--r-field);
  box-shadow: var(--press);
  padding: 0.7rem 0.9rem;
}
textarea { min-height: 7rem; resize: vertical; line-height: 1.5; }
textarea.code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.88rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); }
input::placeholder, textarea::placeholder { color: #7b9098; }

/* Toggle switch */
.switch { display: inline-flex; align-items: center; gap: 0.7rem; cursor: pointer; margin: 0; font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  position: relative; flex: none; width: 50px; height: 28px; border-radius: var(--r-pill);
  background: var(--paper); box-shadow: var(--press); transition: background 0.2s ease;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface-hi); box-shadow: 1px 1px 4px rgba(16, 38, 46, 0.3); transition: transform 0.2s ease;
}
.switch input:checked + .track { background: var(--teal); }
.switch input:checked + .track::after { transform: translateX(22px); }
.switch input:focus-visible + .track { outline: 3px solid var(--gold); outline-offset: 2px; }

/* --- Notices -------------------------------------------------------------- */
.notice {
  font-family: var(--font-display); font-size: 0.97rem;
  border-radius: var(--r-field); padding: 0.85rem 1.1rem; margin-bottom: 1.1rem;
  background: var(--teal-tint); color: var(--teal-deep); border-left: 5px solid var(--teal);
}
.notice.is-error { background: #f6dde1; color: #6f1526; border-left-color: var(--down); }
.notice.is-warn { background: var(--gold-tint); color: #5b3f00; border-left-color: var(--gold); }
.notice ul { margin: 0; padding-left: 1.1rem; }

/* --- Change indicators (always arrow + text, never colour alone) ----------- */
.chg { font-family: var(--font-display); font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.chg.is-up { color: var(--up); }
.chg.is-down { color: var(--down); }
.chg.is-flat { color: var(--ink-soft); }

/* --- Pagination ----------------------------------------------------------- */
.pagination { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; margin: 2rem 0 0; font-family: var(--font-display); }
.page-link {
  min-width: 2.5rem; text-align: center; padding: 0.5rem 0.85rem; border-radius: var(--r-field);
  background: var(--surface); box-shadow: var(--raise-sm); text-decoration: none; font-weight: 600; color: var(--teal-deep);
}
.page-link.is-current { background: var(--teal); color: #fff; box-shadow: none; }
.page-gap { align-self: center; color: var(--ink-soft); }

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