/* Flora Insights prototypes — shared OBG brand layer.
   Self-contained: it does not load or change the site's style.css / _Layout.cshtml.
   Tokens are the site's own (--color-100/200/300 in style.css) under readable names. */

/* ---- OBG typefaces (same files the site serves from /fonts) ---- */
@font-face { font-family: "Oman Botanic Garden"; src: url("../../../fonts/OmanBotanicGarden-Lt.woff") format("woff"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Oman Botanic Garden"; src: url("../../../fonts/OmanBotanicGarden.woff2") format("woff2"), url("../../../fonts/OmanBotanicGarden.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Oman Botanic Garden"; src: url("../../../fonts/OmanBotanicGarden-Md.woff2") format("woff2"), url("../../../fonts/OmanBotanicGarden-Md.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Oman Botanic Garden"; src: url("../../../fonts/OmanBotanicGarden-Bd.woff") format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Oman Botanic Garden"; src: url("../../../fonts/OmanBotanicGarden-It.woff") format("woff"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Oman Botanic Garden AR"; src: url("../../../fonts/OmanBotanicGardenAR-Lt.woff2") format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Oman Botanic Garden AR"; src: url("../../../fonts/OmanBotanicGardenAR.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Oman Botanic Garden AR"; src: url("../../../fonts/OmanBotanicGardenAR-Md.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Oman Botanic Garden AR"; src: url("../../../fonts/OmanBotanicGardenAR-Bd.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  /* brand */
  --navy: #002C5C;          /* --color-100 */
  --navy-900: #001A38;
  --navy-600: #173F6E;
  --sand: #B9AE99;          /* --color-200 */
  --copper: #BD774E;        /* --color-300 */
  --copper-700: #8A4A24;    /* text-safe copper */
  --olive: #5C680F;         /* brand line-shape stroke */
  --earth: #5E4839;         /* logo */

  /* surfaces */
  --paper: #F7F4EF;
  --paper-2: #EFE9DF;
  --paper-3: #E2D9C9;
  --white: #FFFFFF;
  --hairline: #E4DED3;

  /* ink */
  --ink: #1E1E1E;
  --ink-2: #474747;
  --ink-3: #6B6B6B;

  --font: "Oman Botanic Garden", "Oman Botanic Garden AR", system-ui, sans-serif;
  --font-ar: "Oman Botanic Garden AR", "Oman Botanic Garden", system-ui, sans-serif;

  --radius: 6px;
  --radius-lg: 12px;
  --shadow: 0 2px 12px rgba(0, 0, 0, .08);
  --shadow-lg: 0 18px 48px rgba(0, 26, 56, .18);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-weight: 400;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-weight: 500; line-height: 1.15; margin: 0; color: var(--navy); }
p { margin: 0; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 32px; }
.ar { font-family: var(--font-ar); direction: rtl; unicode-bidi: isolate; }
.sci { font-style: italic; }
.eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--copper-700);
}
.muted { color: var(--ink-3); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

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

/* ---- Header: matches the site's sticky white inner-page bar ---- */
.site-header { position: sticky; top: 0; z-index: 60; background: var(--white); box-shadow: var(--shadow); }
.site-header .bar { display: flex; align-items: center; gap: 28px; height: 76px; }
.site-header .logo img { height: 44px; width: auto; }
.site-nav { display: flex; gap: 26px; margin-left: auto; }
.site-nav a {
  text-decoration: none; color: var(--navy); font-size: 15px; font-weight: 500;
  padding: 6px 0; border-bottom: 2px solid transparent; transition: border-color .2s;
}
.site-nav a:hover, .site-nav a.is-active { border-color: var(--copper); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 999px;
  font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: background-color .2s, color .2s, border-color .2s;
}
.btn svg { width: 16px; height: 16px; }
.btn-navy { background: var(--navy); color: var(--white); }
.btn-navy:hover { background: var(--navy-600); }
.btn-outline { border-color: var(--navy); color: var(--navy); background: transparent; }
.btn-outline:hover { background: var(--navy); color: var(--white); }
.btn-light { background: var(--white); color: var(--navy); }
.btn-light:hover { background: var(--paper-2); }

/* ---- Footer: same navy band as the site ---- */
.site-footer { background: var(--navy); color: var(--white); padding: 28px 0; font-size: 14px; }
.site-footer .bar { display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: center; justify-content: space-between; }
.site-footer ul { display: flex; flex-wrap: wrap; gap: 6px 0; list-style: none; margin: 0; padding: 0; }
.site-footer li + li::before { content: ""; display: inline-block; width: 1px; height: 12px; background: rgba(255,255,255,.6); margin: 0 14px; vertical-align: -1px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--sand); }
.site-footer .source { color: rgba(255,255,255,.7); font-size: 13px; }

/* ---- Badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500; letter-spacing: .02em;
  background: var(--paper-2); color: var(--ink-2); white-space: nowrap;
}
.badge .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.badge-endemic { background: #E8EEF5; color: var(--navy); }

/* ---- Tooltip (shared by every chart) ---- */
.fi-tip {
  position: fixed; z-index: 200; pointer-events: none;
  background: var(--white); color: var(--ink); border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,.16); padding: 8px 12px; font-size: 13px;
  opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s; max-width: 260px;
}
.fi-tip.on { opacity: 1; transform: none; }
.fi-tip strong { display: block; font-size: 16px; font-weight: 500; color: var(--ink); }
.fi-tip span { color: var(--ink-3); }

/* ---- Chart primitives ---- */
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: var(--label-w, 180px) 1fr; align-items: center; gap: 14px; }
.bar-label { font-size: 14px; color: var(--ink); line-height: 1.25; }
.bar-label small { display: block; font-size: 12px; color: var(--ink-3); }
.bar-track { position: relative; display: flex; align-items: center; gap: 8px; min-height: 28px; }
.bar-fill {
  height: 16px; border-radius: 0 4px 4px 0; background: var(--navy);
  min-width: 2px; transition: width .45s cubic-bezier(.2,.7,.2,1), opacity .2s;
}
.bar-value { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-row[data-tip] { cursor: default; }
.bar-row:hover .bar-fill, .bar-row:focus-visible .bar-fill { opacity: .82; }

.seg { display: flex; gap: 2px; height: 28px; }
.seg > div {
  height: 100%; border-radius: 4px; display: flex; align-items: center; padding: 0 8px;
  font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: visible; min-width: 2px;
}
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

.table-view { margin-top: 14px; font-size: 13px; }
.table-view summary { cursor: pointer; color: var(--navy); font-weight: 500; list-style: none; display: inline-flex; gap: 6px; align-items: center; }
.table-view summary::-webkit-details-marker { display: none; }
.table-view summary::before { content: "▸"; font-size: 10px; transition: transform .2s; }
.table-view[open] summary::before { transform: rotate(90deg); }
.table-view table { border-collapse: collapse; width: 100%; margin-top: 10px; }
.table-view th, .table-view td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--hairline); }
.table-view td.n, .table-view th.n { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- Oman map ---- */
.oman-map { width: 100%; height: auto; display: block; }
.oman-map .zone { cursor: pointer; transition: fill .35s, opacity .2s; stroke: var(--paper); stroke-width: 6; stroke-linejoin: round; }
.oman-map .zone:hover { opacity: .86; }
.oman-map .zone:focus { outline: none; }
.oman-map .zone:focus-visible { stroke: var(--copper); stroke-width: 10; }
.oman-map .zone.is-selected { stroke: var(--copper); stroke-width: 12; }
.oman-map .z-label { font-family: var(--font); font-weight: 500; pointer-events: none; }
.oman-map .z-num { font-family: var(--font); font-weight: 400; pointer-events: none; }
.oman-map .sea { font-family: var(--font); font-style: italic; fill: #9A8F7C; letter-spacing: 2px; }
.oman-map .leader { stroke: var(--ink-3); stroke-width: 3; fill: none; }

/* ---- Prototype marker (remove for production) ---- */
.proto-flag {
  position: fixed; right: 16px; bottom: 16px; z-index: 300;
  background: var(--navy-900); color: var(--white); border-radius: 999px;
  font-size: 12px; padding: 6px 12px 6px 10px; display: flex; gap: 8px; align-items: center;
  box-shadow: var(--shadow-lg); text-decoration: none; opacity: .92;
}
.proto-flag b { background: var(--copper); border-radius: 999px; padding: 1px 8px; font-weight: 500; }
@media (max-width: 700px) { .proto-flag { padding: 4px; font-size: 0; } .proto-flag b { font-size: 12px; } }

@media (max-width: 900px) {
  .wrap { padding: 0 20px; }
  .site-nav { display: none; }
  .site-header .bar { height: 64px; }
  .site-header .logo img { height: 36px; }
}

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

/* Colour swatches always carry a faint edge, so the light IUCN fills (VU, NT, DD, white NE) stay visible. */
.badge .dot, .legend i, .opt .sw, .fopt .sw, .pill .dot { box-shadow: inset 0 0 0 1px rgba(0,0,0,.22); }

/* ---- Outlined use icons (FI.useIcon) ---- */
.use-icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; overflow: visible; }
.use-icon > * { stroke-dasharray: 1; stroke-dashoffset: 0; }
@keyframes fi-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.use-ic-inline { display: inline-flex; align-items: center; gap: 8px; }
.use-ic-inline .use-icon { width: 18px; height: 18px; color: var(--copper-700); stroke-width: 1.7; }
.badge .use-icon { width: 15px; height: 15px; color: var(--copper-700); stroke-width: 1.8; }
@media (prefers-reduced-motion: reduce) { .use-icon > * { animation: none !important; } }
