/* ============ Site Climate Study — studio standard (Ink / Bone / Olive) ============ */

:root {
  color-scheme: light;
  --ink:       #0A0A0A;
  --ink-2:     #1A1A1A;
  --bone:      #F5F2EE;
  --bone-2:    #FAF8F5;
  --line:      #DCD8D2;
  --gray:      #8A897F;
  --accent:    #5E6B4F;   /* RFNRX olive — one accent per surface */

  /* data palette (validated reference set) */
  --d-blue:    #2a78d6;
  --d-red:     #e34948;
  --d-aqua:    #1baf7a;
  --d-yellow:  #eda100;
  --seq-250:   #86b6ef;
  --seq-350:   #5598e7;
  --seq-450:   #2a78d6;
  --seq-550:   #1c5cab;
  --seq-650:   #104281;

  --sans: "Montserrat", system-ui, -apple-system, sans-serif;
  --serif: "Spectral", Georgia, serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bone);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 300;
  font-size: 15px;
  line-height: 1.6;
}

code { font-family: ui-monospace, monospace; font-size: 0.85em; background: var(--bone-2); padding: 1px 5px; border: 1px solid var(--line); }

/* ---------- toolbar ---------- */
.toolbar { border-bottom: 1px solid var(--line); background: var(--bone); position: sticky; top: 0; z-index: 20; }
.toolbar-inner {
  max-width: 1060px; margin: 0 auto; padding: 18px 24px;
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between;
}
.brand { display: flex; flex-direction: column; gap: 3px; }
.eyebrow {
  font-family: var(--sans); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .2em; color: var(--gray);
}

/* studio wordmarks — shared surface: ink marks, accent only beside each name */
.marks { display: flex; align-items: baseline; gap: 24px; }
.mark {
  font-family: var(--sans); font-weight: 700; font-size: 14px;
  letter-spacing: .015em; color: var(--ink);
  display: inline-flex; align-items: baseline; gap: 5px;
}
.dot { width: 5px; height: 5px; display: inline-block; }
.dot-nox { background: #E87461; }
.dot-rfnrx { background: #5E6B4F; }
.masthead { margin-bottom: 40px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.masthead .mark { font-size: 16px; }

.controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.controls input {
  font-family: var(--sans); font-size: 13px; padding: 8px 10px;
  border: 1px solid var(--line); background: var(--bone-2); color: var(--ink);
  outline: none; border-radius: 0;
}
.controls input:focus { border-color: var(--ink); }
.or { font-family: var(--sans); font-size: 11px; color: var(--gray); }
.btn {
  font-family: var(--sans); font-weight: 600; font-size: 12px; letter-spacing: .04em;
  padding: 9px 16px; border: 1px solid var(--ink); background: transparent; color: var(--ink);
  cursor: pointer; border-radius: 0;
}
.btn:hover { background: var(--ink); color: var(--bone); }
.btn-primary { background: var(--ink); color: var(--bone); }
.btn-primary:hover { background: var(--ink-2); }

.search-wrap { position: relative; }
.search-wrap input { width: 210px; }
.place-results {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 30;
  background: var(--bone-2); border: 1px solid var(--line); border-top: 0;
  max-height: 260px; overflow: auto;
}
.place-results button {
  display: block; width: 100%; text-align: left; padding: 8px 10px;
  font-family: var(--sans); font-size: 12px; color: var(--ink);
  background: none; border: 0; border-bottom: 1px solid var(--line); cursor: pointer;
}
.place-results button:hover { background: var(--bone); }
.place-results .sub { color: var(--gray); }

.status {
  max-width: 1060px; margin: 0 auto; padding: 10px 24px;
  font-family: var(--sans); font-size: 12px; color: var(--gray);
}
.status.error { color: #a33; }

/* ---------- report ---------- */
main { max-width: 1060px; margin: 0 auto; padding: 12px 24px 80px; }

.section { padding: 44px 0 36px; border-bottom: 1px solid var(--line); }
.section:last-child { border-bottom: 0; }

.sec-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 6px; }
.sec-num { font-family: var(--sans); font-weight: 400; font-size: 12px; color: var(--gray); }
h2 { font-family: var(--sans); font-weight: 600; font-size: 19px; letter-spacing: .01em; }
h3 { font-family: var(--sans); font-weight: 600; font-size: 13px; margin: 26px 0 8px; }
.sec-lede { color: var(--ink-2); max-width: 72ch; margin-bottom: 18px; }
.note { font-size: 13px; color: var(--gray); max-width: 72ch; }

/* cover */
.cover { padding-top: 56px; }
.cover .eyebrow { display: block; margin-bottom: 14px; }
.cover h1 { font-family: var(--sans); font-weight: 600; font-size: 34px; line-height: 1.15; letter-spacing: -.01em; }
.cover .site-line { font-family: var(--sans); font-size: 13px; color: var(--gray); margin-top: 10px; }
.cover .site-line b { color: var(--ink); font-weight: 600; }
[contenteditable] { outline: none; border-bottom: 1px dashed var(--line); min-width: 60px; display: inline-block; }
[contenteditable]:hover, [contenteditable]:focus { border-bottom-color: var(--gray); }
[contenteditable]:empty::before { content: attr(data-ph); color: var(--gray); font-style: italic; }

.koppen-block { margin-top: 26px; max-width: 76ch; }
.koppen-block .kcode { font-family: var(--sans); font-weight: 700; font-size: 15px; margin-right: 8px; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: 30px; }
.tile { background: var(--bone-2); padding: 16px 16px 14px; }
.tile .t-label { font-family: var(--sans); font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--gray); }
.tile .t-value { font-family: var(--sans); font-weight: 600; font-size: 25px; margin-top: 6px; }
.tile .t-unit { font-size: 13px; font-weight: 400; color: var(--gray); margin-left: 2px; }
.tile .t-sub { font-family: var(--sans); font-size: 11px; color: var(--gray); margin-top: 2px; }

/* charts */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 34px 40px; margin-top: 18px; }
.chart-grid .full { grid-column: 1 / -1; }
.chart-block figcaption, .fig-cap {
  font-family: var(--sans); font-size: 12px; font-weight: 600; margin-bottom: 8px;
}
.fig-sub { font-family: var(--sans); font-size: 11px; font-weight: 400; color: var(--gray); }
figure svg { width: 100%; height: auto; display: block; }

/* per-figure export controls (PowerPoint use) */
figure.chart-block { position: relative; }
.fig-tools { position: absolute; top: -2px; right: 0; display: flex; gap: 6px; opacity: 0; transition: opacity .15s; z-index: 5; }
figure.chart-block:hover .fig-tools, .fig-tools:focus-within { opacity: 1; }
.fig-tools button, .copy-btn {
  font-family: var(--sans); font-weight: 600; font-size: 10px; letter-spacing: .06em;
  padding: 3px 9px; border: 1px solid var(--line); background: var(--bone-2); color: var(--gray);
  cursor: pointer; border-radius: 0;
}
.fig-tools button:hover, .copy-btn:hover { border-color: var(--ink); color: var(--ink); }
.tbl-tools { margin-top: 10px; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 6px; font-family: var(--sans); font-size: 11px; color: var(--ink-2); }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 10px; height: 10px; display: inline-block; }
.legend .sw.line { height: 2px; width: 14px; }

/* svg text defaults are set inline in JS */

.tooltip {
  position: fixed; z-index: 50; pointer-events: none;
  background: var(--ink); color: var(--bone); padding: 8px 10px;
  font-family: var(--sans); font-size: 11px; line-height: 1.5; max-width: 240px;
}
.tooltip b { color: #fff; }

/* tables */
.tbl-wrap { overflow-x: auto; margin-top: 14px; }
table.data {
  border-collapse: collapse; width: 100%;
  font-family: var(--sans); font-size: 11px;
}
table.data th, table.data td { padding: 5px 7px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
table.data th { font-weight: 600; }
table.data thead th { border-bottom: 1px solid var(--ink); }
table.data th:first-child, table.data td:first-child { text-align: left; font-weight: 500; }
table.data td.hi { font-weight: 700; }
table.data tr.group td { border-bottom: 0; }

/* recommendations */
.recs { margin-top: 12px; display: grid; gap: 0; max-width: 82ch; }
.rec { padding: 14px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 200px 1fr; gap: 18px; }
.rec:last-child { border-bottom: 0; }
.rec h4 { font-family: var(--sans); font-weight: 600; font-size: 12.5px; }
.rec p { font-size: 13.5px; }

.sources { margin-top: 30px; font-size: 12px; color: var(--gray); max-width: 82ch; }
.sources b { color: var(--ink-2); font-weight: 500; }

.app-foot { max-width: 1060px; margin: 0 auto; padding: 40px 24px 80px; color: var(--gray); font-size: 13px; }
.app-foot code { font-size: 12px; }

@media (max-width: 780px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .chart-grid { grid-template-columns: 1fr; }
  .rec { grid-template-columns: 1fr; gap: 4px; }
}

/* ---------- print (A4 design-book insert) ---------- */
@page { size: A4; margin: 15mm 16mm; }

@media print {
  body { background: #fff; font-size: 11.5pt; }
  .toolbar, .status, .app-foot, #tooltip, .fig-tools, .copy-btn, .tbl-tools { display: none !important; }
  main { max-width: none; padding: 0; }
  .section { padding: 18pt 0 14pt; break-inside: auto; }
  .section.brk { break-before: page; }
  .cover { padding-top: 10pt; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .chart-grid { grid-template-columns: 1fr 1fr; gap: 16pt 20pt; }
  figure, .tile, .rec, .chart-block { break-inside: avoid; }
  .tbl-wrap { overflow: visible; }
  table.data { font-size: 7.5pt; }
  table.data th, table.data td { padding: 3pt 4pt; }
  [contenteditable] { border-bottom: 0; }
  [contenteditable]:empty { display: none; }
  a { color: inherit; text-decoration: none; }
}
