/* ——— The Key Peninsula Internet Map · broadsheet editorial theme ——— */

:root {
  --paper: #f6f2e8;
  --paper-deep: #efe9da;
  --ink: #1c1b17;
  --ink-soft: #55524a;
  --rule: #d9d2bf;
  --accent: #0e6b5c;        /* Puget teal */
  --accent-ink: #0a5548;
  --alert: #a33327;
  --shadow: 0 2px 14px rgba(28, 27, 23, .18);
  --serif: "Fraunces", Georgia, serif;
  --sans: "Libre Franklin", "Franklin Gothic Medium", Arial, sans-serif;
}

* { box-sizing: border-box; }

/* class display rules (flex) would otherwise beat the hidden attribute */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
}

body { display: flex; flex-direction: column; }

/* ——— masthead ——— */
.masthead {
  border-bottom: 3px double var(--ink);
  background:
    radial-gradient(ellipse at 20% 130%, rgba(14,107,92,.08), transparent 55%),
    var(--paper);
}
.masthead-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 20px 14px;
  text-align: center;
}
.masthead-kicker {
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  display: inline-block;
  padding: 3px 14px;
}
.masthead h1 {
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(28px, 5vw, 46px);
  margin: 10px 0 2px;
  letter-spacing: -.01em;
}
.masthead h1 em { color: var(--accent); font-style: italic; }
.masthead-dek {
  margin: 2px 0 12px;
  color: var(--ink-soft);
  font-size: 15px;
}
.masthead-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ——— buttons ——— */
.btn {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 14px;
  border-radius: 3px;
  border: 1.5px solid var(--ink);
  padding: 8px 18px;
  cursor: pointer;
  background: transparent;
  color: var(--ink);
  transition: transform .08s ease, box-shadow .12s ease, background .12s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 2px 0 var(--ink); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn-primary { background: var(--accent); border-color: var(--accent-ink); color: #fdfcf7; }
.btn-primary:hover { background: var(--accent-ink); box-shadow: 0 2px 0 var(--accent-ink); }
.btn-ghost { border-color: var(--rule); color: var(--ink-soft); }
.btn-outline { display: inline-block; text-decoration: none; text-align: center; }
.btn-small { padding: 7px 12px; font-size: 13px; }
.btn-block { width: 100%; padding: 12px; font-size: 15px; }
.btn[disabled] { opacity: .55; cursor: wait; transform: none; box-shadow: none; }

.linklike {
  background: none; border: none; cursor: pointer;
  color: var(--accent-ink); font: inherit; text-decoration: underline;
}

/* ——— stage / map ——— */
.stage { position: relative; flex: 1; min-height: 460px; }
#map { position: absolute; inset: 0; background: #dfe8dc; }
#map.placing { cursor: crosshair; }

.leaflet-container { font-family: var(--sans); }
.leaflet-popup-content-wrapper {
  background: var(--paper);
  color: var(--ink);
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  box-shadow: var(--shadow);
}
.leaflet-popup-tip { background: var(--paper); border: 1px solid var(--ink); }

.popup h4 { font-family: var(--serif); margin: 0 0 2px; font-size: 16px; }
.popup .pop-stars { color: #c99a17; letter-spacing: 2px; }
.popup .pop-metrics { margin: 6px 0; font-size: 13px; }
.popup .pop-metrics b { font-size: 15px; }
.popup .pop-notes { font-style: italic; color: var(--ink-soft); margin: 4px 0; }
.popup .pop-date { font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .08em; }
.popup .pop-ookla { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .06em; color: var(--accent-ink); border: 1px solid var(--accent); border-radius: 2px; padding: 0 4px; margin-left: 6px; vertical-align: 1px; }
.popup .pop-test { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .06em; color: var(--alert); border: 1px solid var(--alert); border-radius: 2px; padding: 0 4px; margin-left: 6px; vertical-align: 1px; }

/* draft pin — draggable preview of the published location */
.draft-pin {
  background: #c99a17;
  border: 2.5px dashed #1c1b17;
  border-radius: 50%;
  cursor: grab;
  box-shadow: 0 0 0 4px rgba(201, 154, 23, .25);
}
.draft-pin:active { cursor: grabbing; }

/* ——— coverage-layer toggles ——— */
.layer-toggles { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; }
.layer-toggles label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.layers-note { font-size: 10.5px; color: var(--ink-soft); margin: 6px 0 2px; max-width: 190px; }
.popup .pop-claim { font-size: 13px; margin: 2px 0; }

/* ——— staff test-mode banner ——— */
.test-banner {
  position: absolute;
  bottom: 14px; left: 50%; transform: translateX(-50%);
  z-index: 900;
  background: var(--alert); color: #fff;
  padding: 7px 16px;
  border-radius: 3px;
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 600;
  max-width: min(92vw, 560px);
}
.test-banner a { color: #ffd9d3; }

/* ——— post-success toast ——— */
.toast {
  position: absolute;
  top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 900;
  background: var(--accent-ink); color: var(--paper);
  padding: 9px 18px;
  border-radius: 3px;
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 600;
  max-width: min(92vw, 560px);
  animation: drop-in .25s ease;
}

/* ——— placing banner ——— */
.placing-banner {
  position: absolute;
  top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 800;
  background: var(--ink); color: var(--paper);
  padding: 9px 18px;
  border-radius: 3px;
  box-shadow: var(--shadow);
  font-size: 14px;
  max-width: min(92vw, 560px);
  animation: drop-in .25s ease;
}
.placing-banner .linklike { color: #9fd8cc; margin-left: 8px; }
@keyframes drop-in { from { opacity: 0; transform: translate(-50%, -8px); } }

/* ——— map controls ——— */
.map-controls {
  position: absolute;
  top: 14px; right: 14px;
  z-index: 700;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  box-shadow: var(--shadow);
  padding: 10px 12px;
  width: 215px;
}
.control-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.control-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .14em;
  color: var(--ink-soft); width: 52px; flex: none;
}
.seg { display: flex; border: 1px solid var(--ink); border-radius: 3px; overflow: hidden; flex: 1; }
.seg-btn {
  flex: 1; border: none; background: transparent; padding: 4px 0;
  font: 600 12px var(--sans); cursor: pointer; color: var(--ink-soft);
}
.seg-btn.active { background: var(--ink); color: var(--paper); }
.map-controls select {
  flex: 1; font: 500 13px var(--sans);
  border: 1px solid var(--rule); border-radius: 3px;
  background: #fff; padding: 4px 6px; min-width: 0;
}
.legend { border-top: 1px solid var(--rule); padding-top: 8px; font-size: 12px; }
.legend-item { display: flex; align-items: center; gap: 7px; margin: 3px 0; }
.legend-dot {
  width: 12px; height: 12px; border-radius: 50%;
  border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); flex: none;
}
.count-line { margin-top: 8px; font-size: 11px; color: var(--ink-soft); font-style: italic; }

/* ——— submission panel ——— */
.panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  z-index: 900;
  width: min(400px, 100%);
  background: var(--paper);
  border-left: 3px double var(--ink);
  box-shadow: -6px 0 24px rgba(28,27,23,.22);
  display: flex; flex-direction: column;
  animation: slide-in .22s ease;
}
@keyframes slide-in { from { transform: translateX(30px); opacity: 0; } }
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--rule);
}
.panel-head h2 { font-family: var(--serif); font-size: 21px; margin: 0; }
.panel-body { overflow-y: auto; padding: 14px 18px 22px; }

.form-step { margin-bottom: 18px; }
.step-label {
  font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
  color: var(--accent-ink);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 4px; margin-bottom: 8px;
}
.hint { font-size: 13px; color: var(--ink-soft); margin: 0 0 10px; }
.hint-tight { margin: 4px 0 0 24px; }

.update-choice {
  margin: 8px 0 2px;
  padding: 8px 10px;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  border-radius: 6px;
}
.check-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; margin: 0;
  cursor: pointer;
}
.check-row input[type="checkbox"] { width: auto; margin: 0; accent-color: var(--accent); }

label { display: block; font-size: 12px; font-weight: 600; margin: 10px 0 3px; }
.muted { font-weight: 400; color: var(--ink-soft); }

input[type="text"], input[type="url"], input[type="number"], select, textarea {
  width: 100%;
  font: 500 14px var(--sans);
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 8px 9px;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}
textarea { resize: vertical; }

.ookla-row { display: flex; gap: 7px; margin-top: 8px; }
.ookla-row input { flex: 1; }

.triple { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

.stars { display: flex; gap: 4px; margin: 4px 0 6px; }
.stars button {
  font-size: 27px; line-height: 1;
  background: none; border: none; cursor: pointer;
  color: #cfc8b4;
  transition: transform .08s ease, color .1s ease;
  padding: 2px;
}
.stars button:hover { transform: scale(1.18); }
.stars button.lit { color: #c99a17; }

/* honeypot — visually removed, still in DOM for bots */
#f-website { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.field-status { font-size: 13px; min-height: 18px; margin: 6px 0; }
.field-status.ok { color: var(--accent-ink); }
.field-status.err { color: var(--alert); }

.fine-print {
  font-size: 11.5px; color: var(--ink-soft);
  border-top: 1px solid var(--rule);
  margin-top: 12px; padding-top: 8px;
}

/* ——— about modal ——— */
.modal-scrim {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(28,27,23,.5);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 5px;
  box-shadow: var(--shadow);
  max-width: 620px; width: 100%;
  max-height: 86vh;
  display: flex; flex-direction: column;
  animation: drop-in-modal .2s ease;
}
@keyframes drop-in-modal { from { opacity: 0; transform: translateY(10px); } }
.modal-body { overflow-y: auto; padding: 6px 22px 22px; }
.modal-body h3 {
  font-family: var(--serif); font-size: 17px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 3px; margin: 18px 0 6px;
}
.modal-body a { color: var(--accent-ink); }

/* ——— footer ——— */
.colophon {
  border-top: 3px double var(--ink);
  text-align: center;
  font-size: 12px;
  color: var(--ink-soft);
  padding: 10px 16px;
  background: var(--paper-deep);
}
.colophon a { color: var(--ink-soft); }

/* ——— mobile ——— */
@media (max-width: 640px) {
  .stage { min-height: 68vh; }
  .map-controls { width: 172px; padding: 8px 10px; }
  .panel { width: 100%; border-left: none; }
  .masthead-inner { padding: 12px 14px 12px; }
}
