/* Surkora base: tokens, reset, type, controls, provenance and status marks.
   Palette from the parcel-leaf mark: deep pine, emerald, green, mint and harvest gold on cream. */

:root {
  /* Brand */
  --pine: #10231a;
  --emerald: #0e4d2e;
  --leaf: #177245;
  --mint: #7fc79b;
  --mint-tint: #e5f2e9;
  --gold: #f3d36b;
  --gold-deep: #b58a00;
  --gold-tint: #fbf1cc;
  --gold-text: #6b5000;
  --cream: #f6f3ec;

  /* Surfaces and text */
  --paper: var(--cream);
  --surface: #fffdf8;
  --sunken: #efeadf;
  --ink: var(--pine);
  --muted: #55625a;
  --line: #e4ded1;
  --line-strong: #cdc5b3;
  --water: #2f6e9e;
  --water-tint: #e4eef6;
  --risk: #b3261e;
  --risk-tint: #fbe8e5;

  /* Older names, mapped onto the brand so generated markup keeps working. */
  --olive: var(--emerald);
  --olive-deep: var(--pine);
  --olive-tint: var(--mint-tint);
  --albero: var(--gold);
  --albero-text: var(--gold-text);
  --albero-tint: var(--gold-tint);
  --bg: var(--paper);
  --surface-2: var(--sunken);
  --border: var(--line);
  --green: var(--leaf);
  --green-soft: var(--mint-tint);
  --deep: var(--pine);
  --info: var(--water);
  --info-soft: var(--water-tint);
  --ok: var(--leaf);
  --err: var(--risk);
  --err-text: var(--risk);
  --err-soft: var(--risk-tint);
  --warn: var(--gold-deep);
  --warn-text: var(--gold-text);
  --warn-soft: var(--gold-tint);

  /* Shape: the mark is a square with two rounded and two sharp corners. */
  --radius: 14px;
  --radius-sm: 10px;
  --leaf-r: 28px 6px 28px 6px;
  --leaf-r-sm: 18px 4px 18px 4px;
  --shadow: 0 1px 2px rgba(16, 35, 26, 0.06), 0 10px 24px -16px rgba(16, 35, 26, 0.32);
  --inset: none;
  --spring: cubic-bezier(0.2, 0.8, 0.2, 1);
  --appbar-h: 60px;
  --tabbar-h: 68px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Saira", var(--font);
  --mono: var(--font);
  color-scheme: light;
}

/* Sun mode: pure black on white, thicker lines, no tints that wash out outdoors. */
html[data-contrast="sun"] {
  --paper: #ffffff;
  --surface: #ffffff;
  --sunken: #f2f2f2;
  --ink: #000000;
  --pine: #000000;
  --muted: #1c1c1c;
  --line: #000000;
  --line-strong: #000000;
  --emerald: #00461f;
  --leaf: #0b5a2a;
  --mint-tint: #dcefe0;
  --gold-text: #4d3900;
  --gold-deep: #8a6400;
  --water: #0b3f7a;
  --water-tint: #dde9f6;
  --risk: #8f1208;
  --shadow: none;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
html[data-contrast="sun"] body { font-size: 16px; }

h1,
h2,
h3 { margin: 0; line-height: 1.2; font-weight: 600; }
h1,
h2 { font-family: var(--display); font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 24px; }
h2 { font-size: 17px; }
h3 { font-size: 13.5px; color: var(--muted); }

p { margin: 0; }
a { color: var(--emerald); text-underline-offset: 2px; }
img,
svg { display: block; max-width: 100%; }

button,
input,
select,
textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

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

.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
/* Numbers line up in columns; same family as the text, no monospace. */
.mono { font-variant-numeric: tabular-nums; }
.small { font-size: 13px; }
.small-note { font-size: 13px; color: var(--muted); }
.muted { color: var(--muted); }
.neg { color: var(--risk); }
.empty {
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
}

.skip {
  position: absolute;
  top: -60px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--pine);
  color: var(--cream);
}
.skip:focus { top: 12px; }

/* Icons */
.ic {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Buttons */
.btn,
.btn-photo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
}
.btn-primary { background: var(--emerald); color: var(--cream); }
.btn-primary:hover { background: var(--pine); }
.btn-ghost,
.btn-outline { border-color: var(--line-strong); background: var(--surface); color: var(--ink); }
.btn-ghost:hover,
.btn-outline:hover { border-color: var(--emerald); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-block { display: flex; width: 100%; }
.btn-sm,
.small-btn { min-height: 38px; padding: 0 14px; border-radius: 10px; font-size: 14px; }
.btn-sm .ic,
.small-btn .ic { width: 16px; height: 16px; }
/* Text-weight action for "open" links inside a detail. */
.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--emerald);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--mint);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
.btn-link:hover { text-decoration-color: currentColor; }

.chip-btn {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  font-size: 14px;
  transition: border-color 0.15s, background 0.15s;
}
.chip-btn:hover { border-color: var(--emerald); background: var(--mint-tint); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
}
.icon-btn:hover { background: var(--sunken); }
.icon-btn.solid { background: var(--emerald); color: var(--cream); }
.icon-btn.sm { width: 44px; height: 44px; color: var(--muted); }
.icon-btn.sm:hover { color: var(--risk); }

/* Form controls */
input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 15px;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--emerald);
  box-shadow: 0 0 0 3px rgba(23, 114, 69, 0.2);
}
input[type="radio"],
input[type="checkbox"] { width: auto; min-height: 0; accent-color: var(--emerald); }
label > span:first-child {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
}
@media (max-width: 899px) {
  input,
  select,
  textarea { font-size: 16px; }
}

/* Tags: small soft labels for status and source. */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 1px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  white-space: nowrap;
}
.tag .ic { width: 14px; height: 14px; }
.tag.green { border-color: #bfe0cb; background: var(--mint-tint); color: var(--emerald); }
.tag.blue { border-color: #c4d8ea; background: var(--water-tint); color: var(--water); }
.tag.amber { border-color: #ebd27a; background: var(--gold-tint); color: var(--gold-text); }
.tag.red { border-color: #f1c0ba; background: var(--risk-tint); color: var(--risk); }

/* Provenance: a small glyph says how sure a number is.
   Medición = solid dot, Estimación = half dot, Modelo = ring, Supuesto = dashed ring. */
.prov {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 400;
  white-space: nowrap;
}
.prov[data-i18n]::before,
.prov[data-p]::before {
  width: 9px;
  height: 9px;
  flex: none;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  content: "";
}
.prov[data-i18n="prov_med"]::before,
.prov[data-p="med"]::before { background: currentColor; }
.prov[data-i18n="prov_est"]::before,
.prov[data-p="est"]::before { background: linear-gradient(90deg, currentColor 50%, transparent 50%); }
.prov[data-i18n="prov_sup"]::before,
.prov[data-p="sup"]::before { border-style: dashed; }

/* Status marks: shape and colour both carry the meaning (colour-blind safe). */
.mark {
  position: relative;
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: none;
}
.mark::before,
.mark::after { position: absolute; inset: 0; content: ""; }
.mark-act::before { background: var(--emerald); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.mark-ok::before {
  inset: 1px 5px 3px 5px;
  border: solid var(--leaf);
  border-width: 0 3px 3px 0;
  transform: rotate(40deg);
}
/* Gold alone is too light on cream, so the triangle gets a dark rim. */
.mark-warn::before { background: var(--gold-text); clip-path: polygon(50% 0, 100% 96%, 0 96%); }
.mark-warn::after { inset: 4px 3px 2px; background: var(--gold); clip-path: polygon(50% 0, 100% 96%, 0 96%); }
.mark-risk::before { inset: 1px; border-radius: 3px; background: var(--risk); }
.mark-neutral::before { inset: 7px 2px; border-radius: 2px; background: var(--muted); }

html[data-contrast="sun"] .tag,
html[data-contrast="sun"] .card { border-width: 2px; }

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