/*
 * hdct_app.css
 * Shared styles for the HDCT application layer.
 * Loaded on all pages alongside hdct.css.
 * hdct.css remains the original main feed stylesheet — do not modify it.
 */

/* ── CSS variables not in hdct.css ───────────────────────────────────── */
:root {
  --royalBlue: #5878bb; /* already in hdct.css but repeated here for pages
                           that don't load hdct.css first */
}

/* ── Standard page content wrapper ──────────────────────────────────── */
/* Used on all public pages. JS sets padding-top to match header height. */
div.page-wrap, main.page-wrap {
  width: 90%;
  margin: 0 auto;
  box-sizing: border-box;
  padding-top: 60px; /* fallback — overridden by setHeaderHeightVar() JS */
}

/* ── Global link styles ──────────────────────────────────────────────── */
a {
  text-decoration: none;
  color: var(--darkBlue);
  font-weight: bold;
}

a:hover {
  color: var(--lightBlue);
  text-decoration: none;
}

/* ── Fixed header ────────────────────────────────────────────────────── */
#header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 200;
  box-shadow: 0 1px 4px rgba(36,69,118,.10);
}

/* ── callDate sticky position — tucks under fixed header ─────────────── */
/* Shadow uses a negative spread with clip so only the bottom edge shows.
   This prevents multiple stacked date bars from compounding shadows. */
.callDate {
  top: calc(var(--header-h, 0px) - 6px) !important;
  box-shadow: 0 4px 4px -3px rgb(0 0 0 / 0.18) !important;
}

/* ── Last update timestamp ───────────────────────────────────────────── */
.updateTime {
  color: var(--darkBlue);
  font-size: 70%;
  font-style: italic;
  padding: 0 0 0 1em;
  cursor: pointer;
  white-space: nowrap;
  align-self: flex-end;
}

.updateTime:hover {
  color: var(--lightBlue);
}

/* ── Page eyebrow label ──────────────────────────────────────────────── */
.page-eyebrow-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5em 6px 0;
}

.page-eyebrow-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--royalBlue);
}

/* ── Sticky page title bar (callDate style for non-feed pages) ───────── */
.page-title-bar {
  width: 100%;
  background-color: var(--darkBlue);
  font-weight: 600;
  font-size: 14px;
  color: #ffffff;
  text-align: center;
  padding: .5em 0;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgb(0 0 0 / 0.2);
  position: sticky;
  top: calc(var(--header-h, 0px) - 6px);
  z-index: 20;
  margin: .5em 0;
  box-sizing: border-box;
}

/* ── Standard content card ───────────────────────────────────────────── */
.app-card {
  background: var(--white);
  border-radius: 10px;
  padding: 1.4em 1.4em 1.2em;
  margin-bottom: 1em;
  box-shadow: 0 3px 10px rgb(0 0 0 / 0.07);
  font-size: 14px;
  line-height: 1.7em;
  color: var(--darkBlue);
}

.app-card p { margin: 0 0 .9em; }
.app-card p:last-child { margin-bottom: 0; }

/* ── Section subheading — small caps with extending rule ─────────────── */
.app-subhead {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--royalBlue);
  margin: 1.2em 0 .5em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-subhead:first-child { margin-top: 0; }

.app-subhead::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--lightBlue);
}

/* ── Footer ──────────────────────────────────────────────────────────── */
#footer {
  width: 100%;
  text-align: center;
  font-size: 70%;
  min-height: 100px;
}

@media (max-width: 991px) {
  #footer {
    padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  }
}

/* ── Spinner ─────────────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--lightBlue);
  border-top-color: var(--darkBlue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

/* ── Header height JS helper ─────────────────────────────────────────── */
/*
   Include this on every page that uses the fixed #header:

   function setHeaderHeight() {
     const h = document.getElementById('header');
     if (!h) return;
     const height = h.offsetHeight;
     document.documentElement.style.setProperty('--header-h', height + 'px');
     const wrap = document.querySelector('.page-wrap');
     if (wrap) wrap.style.paddingTop = height + 'px';
   }
   setHeaderHeight();
   window.addEventListener('resize', setHeaderHeight);
*/

/* ── Unified modal system (hdct_modal.js) ────────────────────────────── */

#hdctModalOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

#hdctModalOverlay.active {
  display: flex;
}

#hdctModalBox {
  position: relative;
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgb(0 0 0 / 0.22);
  width: 90%;
  max-width: 360px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 1.4em 1.4em 1em;
  box-sizing: border-box;
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  color: var(--darkBlue);
  line-height: 1.6em;
  animation: hdctModalIn .18s ease-out;
}

@keyframes hdctModalIn {
  from { transform: scale(.95); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* Close button (×) */
#hdctModalClose {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--lightBlue);
  cursor: pointer;
  padding: 0 4px;
  font-family: inherit;
  transition: color .15s;
}

#hdctModalClose:hover { color: var(--darkBlue); }

/* Body */
#hdctModalBody { }

#hdctModalBody strong { color: var(--darkBlue); }

/* Footer buttons */
#hdctModalFooter {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 1.2em;
}

#hdctModalFooter:not(:empty) {
  padding-top: .8em;
  border-top: 1px solid var(--lightBlue);
}

/* Override hdct.css hr width inside modal */
#hdctModalBox hr {
  width: 100%;
}

.hdct-modal-btn {
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 18px;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  transition: background-color .15s;
}

.hdct-modal-btn-ok {
  background: var(--darkBlue);
  color: #ffffff;
}

.hdct-modal-btn-ok:hover { background: var(--royalBlue); }

.hdct-modal-btn-cancel {
  background: var(--offWhite);
  color: var(--darkBlue);
  border: 1px solid var(--lightBlue);
}

.hdct-modal-btn-cancel:hover { background: var(--lightBlue); }

/* Prevent body scroll when modal is open */
body.hdct-modal-open { overflow: hidden; }
