/* Echo Six Renovation Tracker
   Palette drawn from the E-6 crow and the job site itself:
   navy ink, crow gold, desert khaki, steel white, signal red. */

:root {
  --ink:    #101d2e;   /* navy */
  --ink-2:  #1b2c42;
  --gold:   #c19a2e;   /* crow gold */
  --gold-2: #a07f1d;
  --sand:   #e9e3d5;   /* page background, desert gravel */
  --card:   #f9f7f1;   /* steel white */
  --line:   #cfc7b4;
  --slate:  #55677c;   /* secondary text */
  --red:    #a6301f;   /* signal / request flag */
  --green:  #3d6b45;   /* complete */
  --radius: 6px;
  --shadow: 0 1px 3px rgba(16, 29, 46, .12);
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--sand);
  color: var(--ink);
  font-family: 'Public Sans', system-ui, sans-serif;
  line-height: 1.55;
}

h1, h2, h3 {
  font-family: 'Saira Condensed', sans-serif;
  letter-spacing: .02em;
  margin: 0;
}

.mono { font-family: 'IBM Plex Mono', monospace; font-size: .8rem; }
.muted { color: var(--slate); }
.hidden { display: none !important; }

/* ---------- masthead ---------- */

.masthead {
  background: var(--ink);
  color: var(--card);
  border-bottom: 4px solid var(--gold);
}

.masthead-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.masthead-id { display: flex; gap: 1rem; align-items: center; }

.eyebrow {
  margin: 0;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--gold);
}

.masthead h1 {
  font-size: 2.6rem;
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1;
}

.subtitle { margin: .15rem 0 0; color: #b9c4d2; font-size: .95rem; }

/* the crow — three chevrons */
.crow { display: flex; flex-direction: column; gap: 4px; padding-top: .4rem; }
.crow .chev {
  width: 34px; height: 12px;
  clip-path: polygon(0 0, 50% 60%, 100% 0, 100% 40%, 50% 100%, 0 40%);
  background: var(--gold);
}

.masthead-status { display: flex; align-items: center; gap: 1rem; }

.stamp {
  border: 2px solid var(--gold);
  border-radius: 4px;
  padding: .4rem .9rem;
  text-align: center;
  transform: rotate(-2deg);
}
.stamp-label {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .6rem;
  text-transform: uppercase;
  letter-spacing: .15em;
  color: #b9c4d2;
}
.stamp-value {
  font-family: 'Saira Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  text-transform: uppercase;
  color: var(--gold);
}

.admin-toggle {
  background: transparent;
  color: #b9c4d2;
  border: 1px solid #3a4c63;
  border-radius: var(--radius);
  padding: .45rem .8rem;
  font: inherit;
  font-size: .85rem;
  cursor: pointer;
}
.admin-toggle:hover { color: var(--card); border-color: var(--gold); }

.progress-strip {
  position: relative;
  height: 26px;
  background: var(--ink-2);
  overflow: hidden;
}
.progress-fill {
  position: absolute; inset: 0 auto 0 0;
  width: 0%;
  background: repeating-linear-gradient(-45deg, var(--gold), var(--gold) 10px, var(--gold-2) 10px, var(--gold-2) 20px);
  transition: width .8s ease;
}
.progress-caption {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .7rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--card);
  text-shadow: 0 1px 2px rgba(0,0,0,.5);
}

/* ---------- layout ---------- */

.layout {
  max-width: 1200px;
  margin: 1.5rem auto;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.25rem;
  align-items: start;
}

.main-col { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 2px solid var(--ink);
  padding-bottom: .5rem;
  margin-bottom: 1rem;
}
.panel-head h2 {
  font-size: 1.35rem;
  text-transform: uppercase;
  font-weight: 600;
}

/* ---------- timeline (signature) ---------- */

.timeline { list-style: none; margin: 0; padding: 0; }

.milestone {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: .9rem;
  position: relative;
  padding-bottom: 1.4rem;
}
.milestone:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 21px; top: 34px; bottom: 4px;
  width: 2px;
  background: var(--line);
}
.milestone.complete:not(:last-child)::before { background: var(--gold); }

.node {
  width: 44px; height: 30px;
  display: flex; align-items: center; justify-content: center;
}
.node .chev {
  width: 30px; height: 20px;
  clip-path: polygon(0 0, 50% 60%, 100% 0, 100% 40%, 50% 100%, 0 40%);
  background: transparent;
  border: none;
  box-shadow: inset 0 0 0 30px var(--line);
}
.milestone.complete .node .chev    { box-shadow: inset 0 0 0 30px var(--gold); }
.milestone.in_progress .node .chev {
  box-shadow: none;
  background: linear-gradient(90deg, var(--gold) 50%, var(--line) 50%);
}

.milestone-body h3 { font-size: 1.1rem; font-weight: 600; }
.milestone-meta {
  display: flex; gap: .75rem; align-items: center; flex-wrap: wrap;
  margin: .15rem 0 .25rem;
}
.badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: .15rem .5rem;
  border-radius: 3px;
  border: 1px solid currentColor;
}
.badge.planned     { color: var(--slate); }
.badge.in_progress { color: var(--gold-2); }
.badge.complete    { color: var(--green); }
.milestone-detail { margin: 0; color: var(--slate); font-size: .92rem; }

.milestone-admin { margin-top: .4rem; display: flex; gap: .4rem; flex-wrap: wrap; }

/* ---------- updates ---------- */

.updates { display: flex; flex-direction: column; gap: 1rem; }
.update {
  border-left: 3px solid var(--gold);
  padding: .1rem 0 .1rem .9rem;
}
.update h3 { font-size: 1.05rem; }
.update time { color: var(--slate); }
.update p { margin: .3rem 0 0; white-space: pre-wrap; }

/* ---------- photos ---------- */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .75rem;
}
.photo-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  cursor: zoom-in;
  padding: 0;
  text-align: left;
  font: inherit;
  color: inherit;
}
.photo-card img {
  width: 100%; aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}
.photo-card figcaption { padding: .5rem .6rem; font-size: .82rem; }
.photo-card .mono { display: block; color: var(--slate); margin-top: .15rem; }

.lightbox {
  border: none; border-radius: var(--radius);
  padding: 0; background: var(--ink);
  max-width: min(92vw, 1000px);
}
.lightbox::backdrop { background: rgba(16, 29, 46, .85); }
.lightbox img { display: block; max-width: 100%; max-height: 78vh; margin: 0 auto; }
.lightbox-caption { color: var(--card); padding: .6rem 1rem 1rem; margin: 0; }
.lightbox-close {
  position: absolute; top: .5rem; right: .5rem;
  background: rgba(0,0,0,.5); color: #fff;
  border: none; border-radius: 50%;
  width: 32px; height: 32px; cursor: pointer;
}

/* ---------- comments rail ---------- */

.rail { position: sticky; top: 1rem; }
.rail-panel { max-height: calc(100vh - 2rem); overflow-y: auto; }

.comment-form { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.kind-row { display: flex; gap: .75rem; font-size: .85rem; flex-wrap: wrap; }
.kind-row label { display: flex; align-items: center; gap: .3rem; cursor: pointer; }

.comments { display: flex; flex-direction: column; gap: .9rem; }
.comment {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .7rem .8rem;
  background: #fff;
}
.comment-head {
  display: flex; justify-content: space-between; gap: .5rem;
  align-items: baseline; margin-bottom: .25rem;
}
.comment-author { font-weight: 600; font-size: .9rem; }
.comment-kind.question { color: var(--gold-2); }
.comment-kind.request  { color: var(--red); }
.comment-kind.comment  { color: var(--slate); }
.comment-body { margin: 0; font-size: .9rem; white-space: pre-wrap; }
.comment-reply {
  margin-top: .5rem;
  border-left: 3px solid var(--ink);
  padding-left: .6rem;
  font-size: .87rem;
}
.comment-reply strong {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .65rem; text-transform: uppercase; letter-spacing: .1em;
}
.comment-admin { margin-top: .5rem; display: flex; gap: .4rem; flex-wrap: wrap; }

/* ---------- forms & buttons ---------- */

input, textarea, select {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .5rem .65rem;
  background: #fff;
  color: var(--ink);
  width: 100%;
}
input:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.field-label { font-size: .8rem; color: var(--slate); display: block; }
.field-label input { margin-top: .2rem; }

.btn {
  background: var(--ink);
  color: var(--card);
  border: none;
  border-radius: var(--radius);
  padding: .55rem .9rem;
  font: inherit;
  font-weight: 600;
  font-size: .88rem;
  cursor: pointer;
  width: fit-content;
}
.btn:hover { background: var(--ink-2); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: rgba(16,29,46,.05); }
.btn-small { padding: .3rem .6rem; font-size: .75rem; }
.btn-danger { color: var(--red); border-color: var(--red); }

/* ---------- admin panel ---------- */

.admin-panel { border: 2px dashed var(--gold); }
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.admin-card {
  display: flex; flex-direction: column; gap: .5rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .9rem;
}
.admin-card h3 { font-size: 1rem; text-transform: uppercase; }

.login-dialog {
  border: none; border-radius: var(--radius);
  padding: 1.5rem; max-width: 320px; width: 90vw;
  box-shadow: 0 10px 40px rgba(0,0,0,.3);
}
.login-dialog::backdrop { background: rgba(16, 29, 46, .6); }
.login-dialog form { display: flex; flex-direction: column; gap: .75rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; }
.form-error { color: var(--red); font-size: .85rem; margin: 0; }

.empty { color: var(--slate); font-style: italic; font-size: .9rem; }

.footer {
  max-width: 1200px;
  margin: 2rem auto 1.5rem;
  padding: 0 1.25rem;
  color: var(--slate);
  font-size: .85rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .rail { position: static; }
  .rail-panel { max-height: none; }
  .masthead h1 { font-size: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .progress-fill { transition: none; }
}

/* ================= v2 additions ================= */

/* ---------- tabs ---------- */

.tabs {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  gap: .25rem;
  background: var(--ink);
}
.tab {
  background: transparent;
  border: none;
  color: #b9c4d2;
  font-family: 'Saira Condensed', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .65rem 1.1rem .55rem;
  cursor: pointer;
  border-bottom: 3px solid transparent;
}
.tab:hover { color: var(--card); }
.tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* ---------- horizontal timeline ---------- */

.timeline-scroller { overflow-x: auto; padding-bottom: .5rem; }

.timeline {
  display: flex;
  align-items: stretch;
  min-width: max-content;
  padding: .25rem 0 0;
}

.milestone {
  display: flex;
  flex-direction: column;
  flex: 0 0 250px;
  width: 250px;
  padding: 0 .6rem 0 0;
  grid-template-columns: unset;
  gap: 0;
}

/* connector runs through the node row */
.milestone .node-row {
  position: relative;
  height: 34px;
  display: flex;
  align-items: center;
  margin-bottom: .6rem;
}
.milestone .node-row::before,
.milestone .node-row::after {
  content: '';
  position: absolute;
  top: 50%;
  height: 3px;
  transform: translateY(-50%);
  background: var(--line);
}
.milestone .node-row::before { left: 0; width: 8px; }
.milestone .node-row::after  { left: 52px; right: 0; }
.milestone:first-child .node-row::before { display: none; }
.milestone:last-child .node-row::after   { display: none; }
.milestone.complete .node-row::after { background: var(--gold); }
.milestone.complete .node-row::before,
.milestone.in_progress .node-row::before { background: var(--gold); }
.milestone:first-child.complete .node-row::before,
.milestone:first-child.in_progress .node-row::before { display: none; }

.milestone .node {
  position: relative;
  z-index: 1;
  margin-left: 12px;
  background: var(--card);
  padding: 0 4px;
  width: auto; height: auto;
}
.milestone:not(:last-child)::before { display: none; } /* retire vertical connector */

.milestone-body {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: .75rem .85rem;
  flex: 1;
}
.milestone.in_progress .milestone-body { border-color: var(--gold); border-width: 2px; }
.milestone-body h3 { font-size: 1.05rem; }

/* ---------- admin form extras ---------- */

.field-hint { margin: 0; font-size: .75rem; color: var(--slate); }
.field-row { display: flex; gap: .5rem; }
.field-row .field-label { flex: 1; }

.cabinet-list { display: flex; flex-direction: column; gap: .35rem; }
.cabinet-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .85rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: .35rem .55rem;
  background: var(--card);
}
.cabinet-row .mono { font-size: .65rem; }
.cabinet-configured { color: var(--green); }
.cabinet-missing { color: var(--slate); font-style: italic; }
.cabinet-form { display: flex; flex-direction: column; gap: .5rem; margin-top: .6rem; }

/* ---------- volunteer honor roll ---------- */

.volunteer-page {
  max-width: 1200px;
  margin: 1.5rem auto;
  padding: 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.honor-hero {
  background: linear-gradient(135deg, var(--ink) 0%, var(--ink-2) 60%, #24405f 100%);
  border: 1px solid var(--ink);
  border-bottom: 4px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--card);
  padding: 2rem 1.75rem 1.75rem;
  text-align: center;
}
.honor-hero h2 {
  font-size: 2.4rem;
  text-transform: uppercase;
  color: var(--gold);
  letter-spacing: .04em;
}
.honor-lede {
  max-width: 560px;
  margin: .5rem auto 1.5rem;
  color: #cdd7e2;
}
.honor-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  flex-wrap: wrap;
}
.stat { display: flex; flex-direction: column; }
.stat-num {
  font-family: 'Saira Condensed', sans-serif;
  font-size: 3rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}
.stat-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .15em;
  color: #b9c4d2;
  margin-top: .3rem;
}

.honor-roll { display: flex; flex-direction: column; gap: .8rem; }
.roll-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: .8rem;
  align-items: center;
}
.roll-medal {
  display: flex; flex-direction: column; gap: 3px;
  align-items: center; justify-content: center;
}
.roll-medal .chev {
  width: 26px; height: 9px;
  clip-path: polygon(0 0, 50% 60%, 100% 0, 100% 40%, 50% 100%, 0 40%);
  background: var(--line);
}
.roll-row.rank-1 .roll-medal .chev { background: var(--gold); }
.roll-row.rank-2 .roll-medal .chev { background: #9aa7b5; }
.roll-row.rank-3 .roll-medal .chev { background: #a8763e; }
.roll-name { font-weight: 600; }
.roll-days { color: var(--slate); font-size: .8rem; font-weight: 400; margin-left: .4rem; }
.roll-bar-track {
  height: 14px;
  background: var(--sand);
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  margin-top: .25rem;
}
.roll-bar {
  height: 100%;
  background: repeating-linear-gradient(-45deg, var(--gold), var(--gold) 8px, var(--gold-2) 8px, var(--gold-2) 16px);
  border-radius: 7px;
  transition: width .8s ease;
}
.roll-hours {
  font-family: 'Saira Condensed', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  text-align: right;
  white-space: nowrap;
}
.roll-hours small {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .6rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--slate);
  display: block;
}

.volunteer-log { display: flex; flex-direction: column; gap: .5rem; }
.vlog-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  border-bottom: 1px dashed var(--line);
  padding: .45rem 0;
  font-size: .9rem;
  flex-wrap: wrap;
}
.vlog-row:last-child { border-bottom: none; }
.vlog-main { display: flex; gap: .7rem; align-items: baseline; flex-wrap: wrap; }
.vlog-hours { color: var(--gold-2); font-weight: 700; }
.vlog-note { color: var(--slate); }

@media (prefers-reduced-motion: reduce) {
  .roll-bar { transition: none; }
}

@media (max-width: 600px) {
  .honor-stats { gap: 1.5rem; }
  .stat-num { font-size: 2.2rem; }
  .milestone { flex-basis: 220px; width: 220px; }
}

/* ================= v3: site editor ================= */

.site-editor {
  margin-top: 1.25rem;
  border-top: 2px solid var(--gold);
  padding-top: 1rem;
}
.editor-head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.editor-head h3 {
  font-size: 1.1rem;
  text-transform: uppercase;
}
.editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.editor-actions {
  margin-top: .9rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}

.color-rows { display: flex; flex-direction: column; gap: .4rem; }
.color-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .6rem;
  font-size: .85rem;
  cursor: pointer;
}
.color-row input[type="color"] {
  width: 52px;
  height: 30px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}

.section-rows { display: flex; flex-direction: column; gap: .4rem; }
.section-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .4rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: .35rem .45rem;
  background: var(--card);
}
.section-row input[type="text"] { padding: .3rem .5rem; font-size: .85rem; }
.section-row-controls { display: flex; gap: .25rem; align-items: center; }
.section-row-controls .btn-small { padding: .2rem .45rem; line-height: 1; }
.section-row label.vis-toggle {
  display: flex; align-items: center; gap: .25rem;
  font-size: .7rem; text-transform: uppercase;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--slate);
  cursor: pointer;
}
.section-row.hidden-sec { opacity: .55; }
