/*
 * ZAPP Atlas — global styles for the server-rendered (htmx) surface.
 * Loaded by base.html, so rules here apply site-wide across both surfaces.
 */

/* Poppins, self-hosted. Weights: 400 regular, 600 semibold, 700 bold. */
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/poppins-v24-latin-regular.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/poppins-v24-latin-600.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/poppins-v24-latin-700.woff2") format("woff2");
}

:root {
  --teal: #357084;
  --ink: #1f2937;
  --muted: #6b7280;
  --bg: #ffffff;
  --white: #ffffff;
  --line: #e5e7eb;
  --line-strong: #d3d8de;
  --btn-bg: #eef3f1;
  --teal-tint: #eef4f5;   /* selected nav row, card header band */
  --teal-soft: #a3c4ce;   /* outline on the section being filled */
  --nav-row-hover: #f5f7f7;
  --card-dark: #16323b;
  --teal-dark: #2c6072;   /* teal button hover */
  --danger-tint: #fef2f2; /* danger button hover */
  --warn: #92400e;        /* 6.4:1 on --warn-tint */
  --warn-tint: #fef3c7;
  --warn-line: #fcd34d;

  /* Translucent white, for text and dividers on the teal header/footer.*/
  --on-teal-strong: rgba(255, 255, 255, 0.85);
  --on-teal-muted: rgba(255, 255, 255, 0.6);
  --on-teal-line: rgba(255, 255, 255, 0.12);
  --on-teal-fill: rgba(255, 255, 255, 0.16);
  --on-teal-active: rgba(255, 255, 255, 0.22);

  /* Raised surfaces: dropdowns, toasts, modals. */
  --surface-sunken: #f7f8f9;
  /* A card at rest, lifted off the page rather than floating above it. */
  --shadow-card: 0 1px 2px rgba(15, 76, 92, 0.06), 0 2px 8px rgba(15, 76, 92, 0.06);
  --shadow-panel: 0 8px 24px rgba(15, 76, 92, 0.15);
  --shadow-dropdown: 0 6px 20px rgba(16, 42, 51, 0.16);

  /* Header dropdown panels. */
  --panel-offset: 0.35rem;
  --panel-pad: 0.5rem 0;
  --radius-panel: 0.25rem;

  /* One width for a page's content, so the server-rendered pages and the React
     ones line up rather than reading as two sites. */
  --page-width: 82rem;
  /* Prose is capped shorter: a line much past this is hard to read back. */
  --prose-width: 46rem;
  --page-gutter: 2rem;
  --shadow-modal: 0 10px 40px rgba(15, 76, 92, 0.2);
  --radius: 0.5rem;
  --radius-lg: 0.75rem;

  /* Submission status colors. */
  --status-published: #15803d;
  --status-in-progress: #b45309;
  --status-on-hold: #a16207;
  --status-retracted: #b91c1c;

  --font: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Type scale — use these instead of ad-hoc font sizes. */
  --text-xs: 0.8125rem;  /* 13px */
  --text-sm: 0.875rem;   /* 14px */
  --text-base: 1rem;     /* 16px */
  --text-md: 1.15rem;
  --text-lg: 1.5rem;
  --text-2xl: 2rem;
  --text-xl: 2.5rem;
}

* {
  box-sizing: border-box;
}

/* Near-zero (not 0) keeps animationend/transitionend events firing for any
   JS that depends on them, while removing perceptible motion. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* Always show the vertical scrollbar so pages of different heights don't shift
   horizontally when the scrollbar appears or disappears between navigations. */
html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
}

/* Offset in-page anchor scrolls so sections clear the sticky header. */
:target {
  scroll-margin-top: 5rem;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--text-base);
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a {
  color: inherit;
}

/* Visible focus ring for keyboard users only (not on mouse click). */
:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: 0.25rem;
}

/* On the teal header/footer a teal ring would be invisible; use white there. */
.site-header :focus-visible,
.site-footer :focus-visible {
  outline-color: var(--white);
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  /* The gutter every page keeps between its content and the window. The React
     client lays out its own, so #root opts out below. */
  padding-inline: var(--page-gutter);
}

/* The React shell: its pages carry their own padding. */
main:has(> #root) { padding-inline: 0; }

@media (max-width: 560px) {
  :root { --page-gutter: 1.15rem; }
}


/* ---- Tooltip ------------------------------------------------------------ */

.tooltip {
  position: relative;
  display: inline-flex;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: var(--card-dark);
  color: var(--white);
  font-size: var(--text-xs);
  padding: 0.4rem 0.6rem;
  border-radius: 0.375rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 30;
}

.tooltip::before {
  content: "";
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: var(--card-dark);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 30;
}

.tooltip:hover::after,
.tooltip:hover::before,
.tooltip:focus-within::after,
.tooltip:focus-within::before {
  opacity: 1;
}


/* ---- Placeholder page (unbuilt sections) -------------------------------- */
.placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.5rem;
  padding: 4rem 1.5rem;
}
.placeholder .icon { width: 2.5rem; height: 2.5rem; color: var(--teal); opacity: 0.6; margin-bottom: 0.5rem; }
.placeholder__title { margin: 0; font-size: var(--text-lg); }
.placeholder__text { margin: 0; color: var(--muted); }
.placeholder__hint { margin: 0.5rem 0 0; font-size: var(--text-sm); color: var(--muted); }
.placeholder__hint a { color: var(--teal); font-weight: 600; }

/* Placeholder inside a dashboard main area (bordered panel). */
.placeholder--panel {
  border: 1px dashed var(--line);
  border-radius: 0.75rem;
  padding: 3rem 1.5rem;
}
