/* Phase B styles — Heyron mod site.
 * Intentionally minimal: layout + base typography only.
 * Per-page styling lands with each page migration in Phase C. */

:root {
  --bg: #0e1116;
  --surface: #161b22;
  --surface-2: #1c2230;
  --border: #2a313c;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --accent: #4f8cff;
  --accent-hover: #6aa1ff;
  --danger: #f85149;
  --success: #3fb950;
  --warning: #d29922;
  --radius: 6px;
  --max-w: 1200px;

  /* Aliases for the landing dashboard (Phase C.1). Mapped to
   * the existing dark palette so nothing changes for legacy
   * pages; landing.css + the light-theme block below use the
   * new names. */
  --bg-elev: var(--surface);
  --bg-elev-2: var(--surface-2);
  --fg: var(--text);
  --fg-muted: var(--text-dim);
  --accent-soft: rgba(79, 140, 255, 0.18);
  --good: var(--success);
  --warn: var(--warning);
}

/* Light theme — opt-in via the [data-theme="light"] attribute
 * on <html> (set by theme.js + the inline data-theme-init in
 * base.html). Overrides the dark defaults for both the legacy
 * --surface/--text names and the new --bg-elev/--fg aliases. */
:root[data-theme='light'] {
  --bg: #f6f8fa;
  --surface: #ffffff;
  --surface-2: #f0f3f6;
  --border: #d0d7de;
  --text: #1f2328;
  --text-dim: #57606a;
  --accent: #0969da;
  --accent-hover: #0550ae;
  --danger: #cf222e;
  --success: #1a7f37;
  --warning: #9a6700;
  --bg-elev: var(--surface);
  --bg-elev-2: var(--surface-2);
  --fg: var(--text);
  --fg-muted: var(--text-dim);
  --accent-soft: rgba(9, 105, 218, 0.14);
  --good: var(--success);
  --warn: var(--warning);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
    sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

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

.heyron-topnav {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap; /* mobile: row wraps onto a 2nd line */
  row-gap: 8px;
  /* D10 (Dale's universal rule): the topnav stays anchored to the
   * top of the viewport as the user scrolls. z-index 50 keeps it
   * above page content but below the nav-drawer (100), which is
   * fullscreen when open and intentionally covers the topbar. */
  position: sticky;
  top: 0;
  z-index: 50;
}
/* D10: the link for the current page gets a visual indicator.
 * We use a bottom border (no font-weight change) so the link's
 * hitbox and row height stay identical to the inactive links —
 * the layout doesn't shift when the user navigates between pages. */
.heyron-topnav__links a.heyron-topnav__link--active,
.heyron-topnav__links a[aria-current='page'] {
  color: var(--text);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 2px;
  margin-bottom: -2px; /* offset the border so layout doesn't shift */
}
.heyron-topnav__brand a {
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}
.heyron-topnav__links {
  display: flex;
  gap: 16px;
  flex: 1 1 auto;
  flex-wrap: wrap; /* links wrap if needed on tight screens */
}
.heyron-topnav__links a {
  color: var(--text-dim);
}
.heyron-topnav__links a:hover,
.heyron-topnav__links a[aria-disabled='true'] {
  color: var(--text);
  text-decoration: none;
}
.heyron-topnav__links a[aria-disabled='true'] {
  opacity: 0.5;
  cursor: not-allowed;
}
.heyron-topnav__user {
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--text-dim);
  font-size: 13px;
  margin-left: auto; /* push user to the right on wide screens */
}
.heyron-topnav__user small {
  color: var(--text-dim);
}

/* Sign-out is a POST form (Django 5 LogoutView requires POST), but
 * we want it to look like the rest of the topnav links. */
.heyron-logout-form {
  margin: 0;
  padding: 0;
  display: inline;
}
.heyron-link-button {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
}
.heyron-link-button:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* Mobile: stack the topnav vertically, no horizontal scroll.
   The previous flex-wrap fix still allowed long username + Sign
   out button rows to overflow on tight phones, so we go full
   vertical on small screens. */
@media (max-width: 600px) {
  .heyron-topnav {
    flex-direction: column;
    align-items: stretch;
    padding: 10px 14px;
    gap: 8px;
  }
  .heyron-topnav__brand {
    width: 100%;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
  }
  .heyron-topnav__links {
    width: 100%;
    flex-wrap: wrap;
    gap: 10px;
  }
  .heyron-topnav__links a[aria-disabled='true'] {
    display: none;
  }
  .heyron-topnav__user {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
    font-size: 12px;
  }
}

/* Hamburger + drawer (B-1.1, Phase B-2). */

/* Skip link: visible on focus only. */
.heyron-skip {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: #fff;
  padding: 8px 12px;
  z-index: 1000;
}
.heyron-skip:focus {
  top: 0;
}

/* Toggle button: hidden on desktop, 44x44 on mobile. */
.heyron-nav-toggle {
  display: none;
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  font-size: 22px;
  line-height: 1;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.heyron-nav-toggle:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Phase C.1: dark/light theme toggle. Sits next to the
 * hamburger in the topbar; mirrors the hamburger's 44x44
 * treatment and picks up the data-theme icon swap from
 * theme.js. */
.heyron-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  font-size: 18px;
  line-height: 1;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.heyron-theme-toggle:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
/* On wide screens the toggle sits in the topbar, after the
 * user block. The topbar is flex-direction: row on desktop
 * so the margin-left:auto on .heyron-topnav__user already
 * pushes the user to the right; this one just follows. */
.heyron-theme-toggle {
  margin-left: 4px;
}

@media (max-width: 768px) {
  .heyron-topnav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .heyron-topnav__links {
    display: none;
  }
  .heyron-topnav__user {
    display: none;
  }
  .heyron-nav-toggle {
    display: inline-flex;
    margin-left: auto;
  }
}

/* Drawer: hidden by default, slides in from the right. */
.heyron-nav-drawer {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
}
.heyron-nav-drawer[hidden] {
  display: none;
}
.heyron-nav-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 200ms ease;
}
.heyron-nav-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(80vw, 320px);
  background: var(--surface);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform 200ms ease;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.4);
}
.heyron-nav-drawer--open {
  pointer-events: auto;
}
.heyron-nav-drawer--open .heyron-nav-drawer__backdrop {
  opacity: 1;
}
.heyron-nav-drawer--open .heyron-nav-drawer__panel {
  transform: translateX(0);
}
.heyron-nav-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.heyron-nav-drawer__links {
  display: flex;
  flex-direction: column;
  padding: 8px 0;
  overflow-y: auto;
}
.heyron-nav-drawer__links a,
.heyron-nav-drawer__links button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  min-height: 44px;
  background: transparent;
  border: 0;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}
.heyron-nav-drawer__links a:hover,
.heyron-nav-drawer__links button:hover {
  background: var(--surface-2);
  text-decoration: none;
}
.heyron-nav-drawer__links a[aria-disabled='true'] {
  display: none;
}
.heyron-nav-drawer__links hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 8px 0;
}
.heyron-nav-drawer__user {
  display: block;
  padding: 12px 16px;
  color: var(--text-dim);
  font-size: 13px;
}
.heyron-nav-drawer__btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--accent);
  font: inherit;
  padding: 12px 16px;
  min-height: 44px;
  cursor: pointer;
}
.heyron-nav-drawer__btn:hover {
  background: var(--surface-2);
}

/* Django admin touch targets (Phase B-2 follow-up). The default
 * admin styles make .deletelink, .button, and the .object-tools
 * links ~28px tall — fine for mouse, too small for thumbs. Bump
 * to ≥44px per the mobile-ready standing rule. */
.deletelink,
.button,
input[type='submit'].deletelink,
a.button,
.module .object-tools a {
  min-height: 44px;
  min-width: 44px;
  padding: 10px 16px;
  font-size: 14px;
  line-height: 1.4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
/* The admin's "Save" / "Save and continue" / "Save and add another"
 * button row in the change form. */
.submit-row .button,
.submit-row input[type='submit'] {
  min-height: 44px;
  padding: 10px 16px;
  font-size: 14px;
}
.heyron-nav-close {
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: 22px;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  line-height: 1;
}

.heyron-no-scroll {
  overflow: hidden;
}

/* Password reveal toggle. The base.html JS adds .heyron-pw-wrap
   around every <input type="password"> and injects a button. The
   button flips type between "password" and "text". */
.heyron-pw-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
}
.heyron-pw-wrap input[type='password'],
.heyron-pw-wrap input[type='text'] {
  width: 100%;
  padding-right: 56px; /* leave room for the button */
  box-sizing: border-box;
}
.heyron-pw-reveal {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
  line-height: 1.4;
}
.heyron-pw-reveal:hover {
  color: var(--text);
}
.heyron-pw-reveal[aria-pressed='true'] {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.heyron-main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 32px 24px;
}

.heyron-hero h1 {
  font-size: 28px;
  margin: 0 0 8px;
}
.heyron-hero__lede {
  font-size: 17px;
  color: var(--text-dim);
  margin: 0 0 8px;
}
.heyron-hero__status {
  color: var(--text-dim);
  font-size: 13px;
  margin: 0;
}

.heyron-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-top: 24px;
}
.heyron-card h2 {
  font-size: 18px;
  margin: 0 0 12px;
}
.heyron-card ul {
  margin: 0;
  padding-left: 18px;
}
.heyron-card li {
  margin: 4px 0;
}

.heyron-messages {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.heyron-message {
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.heyron-message--success {
  border-color: var(--success);
}
.heyron-message--warning {
  border-color: var(--warning);
}
.heyron-message--error {
  border-color: var(--danger);
}

.heyron-footer {
  max-width: var(--max-w);
  margin: 48px auto 24px;
  padding: 0 24px;
  color: var(--text-dim);
  text-align: center;
}
