/* ============================================================
   ODJ-K SOCIAL — css/shared.css
   The shell. One header. One footer. One border on the device edge.
   Systems mount inside #jod-shell .system-body.
   No system renders another system's chrome.

   Header : logo · [Discover icon · Notifications icon · Alarm]
   Footer : [Feedback icon · Messages icon · Post icon]  (no text)
   Profile / Geo prompts live in the Home three-dash menu (home.css).

   Perf rules:
     §4 animate transform/opacity only
     §5 no universal selector, no @import, classes over tags,
        custom properties instead of inline JS styles,
        contain on isolated widgets
     §7 no globals

   Every other CSS file (marketing.css, share.css, trace.css,
   system CSS) reads from these tokens.
   ============================================================ */

/* ============================================================
   1. DESIGN TOKENS
   ============================================================ */

:root {
  /* -------- Breakpoints (referenced by JS / media queries) -------- */
  --bp-tablet: 641px;
  --bp-desktop: 1025px;

  /* -------- Content widths -------- */
  --content-max-mobile: 480px;
  --content-max-tablet: 720px;
  --content-max-desktop: 1200px;

  /* -------- Palette — aligned with the ODJ-K logo -------- */
  /* Gold */
  --gold-1: #b8942f;
  --gold-2: #d4af37;
  --gold-3: #f1d27a;
  --gold-glow: rgba(212, 175, 55, 0.28);
  --gold-line: rgba(212, 175, 55, 0.35);
  --gold-line-strong: rgba(212, 175, 55, 0.6);

  /* Silver */
  --silver-1: #8f939c;
  --silver-2: #c9ccd2;
  --silver-3: #eef1f5;

  /* Ink (blacks) */
  --ink-900: #050506;
  --ink-800: #0a0a0c;
  --ink-700: #0e0e11;
  --ink-600: #14141a;

  /* Danger */
  --danger: #dc2626;
  --danger-text: #f87171;
  --danger-soft: rgba(220, 38, 38, 0.12);
  --danger-line: rgba(220, 38, 38, 0.5);

  /* -------- Legacy aliases (kept so existing system CSS keeps working) -------- */
  --color-navy:              var(--ink-800);
  --color-navy-soft:         var(--ink-700);
  --color-charcoal:          var(--ink-900);
  --color-slate:             var(--silver-1);
  --color-slate-light:       var(--silver-2);
  --color-soft-purple:       var(--gold-2);
  --color-soft-purple-light: var(--gold-3);
  --color-white:             var(--silver-3);
  --color-off-white:         var(--ink-700);
  --color-border:            var(--gold-line);

  /* -------- Gradients -------- */
  --gradient-premium: linear-gradient(
    135deg,
    var(--gold-2) 0%,
    var(--gold-3) 100%
  );

  --gradient-premium-soft: linear-gradient(
    135deg,
    rgba(212, 175, 55, 0.85) 0%,
    rgba(241, 210, 122, 0.85) 100%
  );

  --gradient-surface: linear-gradient(
    180deg,
    var(--ink-700),
    var(--ink-800)
  );

  /* -------- Chrome sizing -------- */
  --shell-border: 2px;
  --header-height: 56px;   /* written by js/shared/header.js */
  --footer-height: 52px;   /* three 44px icon buttons */

  /* -------- Motion -------- */
  --t-fast: 150ms;
  --t-med:  220ms;
  --ease-out: cubic-bezier(.2, .7, .2, 1);
}

/* ============================================================
   2. THE SHELL — one box, border on the device edge
   ============================================================ */

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--ink-900);
  color: var(--silver-2);
  font-family: 'Work Sans', system-ui, -apple-system, BlinkMacSystemFont,
               'Segoe UI', Roboto, sans-serif;
  overscroll-behavior: none;
}

#jod-shell {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  border: var(--shell-border) solid var(--gold-2);
  background: var(--ink-900);
  display: grid;
  grid-template-rows: auto 1fr auto;
  contain: layout paint size;
  isolation: isolate;
}

/* ============================================================
   3. SHELL HEADER (#app-header)
   Logo (left) · Discover · Notifications · Alarm (right)
   ============================================================ */

#app-header {
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--header-height);
  padding: 8px 14px;
  background: var(--gradient-surface);
  border-bottom: 1px solid var(--gold-line);
  contain: layout paint style;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: var(--content-max-desktop);
  margin: 0 auto;
  min-width: 0;
}

/* -------- Logo -------- */
.header-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  flex-shrink: 0;
}

.header-logo-img {
  height: 40px;
  width: auto;
  object-fit: contain;
  border-radius: 6px;
}

/* -------- Right side: Discover, Notifications, Alarm -------- */

.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;          /* pushes the icons to the right edge */
  flex-shrink: 0;
  font-size: 0.85rem;
  min-width: 0;
}

.header-icon-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--silver-3);
  text-decoration: none;
  padding: 0;
  transition: background-color var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out);
}

.header-icon-link:hover {
  background-color: rgba(212, 175, 55, 0.1);
  color: var(--gold-3);
}

.header-icon-link:focus-visible {
  outline: 2px solid var(--gold-3);
  outline-offset: 2px;
}

/* Notification badge */
.header-notif-badge {
  position: absolute;
  top: -2px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.header-alarm-link {
  padding: 5px 12px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff !important;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: transform var(--t-fast) var(--ease-out),
              filter var(--t-fast) var(--ease-out);
}

.header-alarm-link:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

/* display rules above would otherwise beat the hidden attribute */
.header-icon-link[hidden],
.header-alarm-link[hidden],
.header-notif-badge[hidden] {
  display: none;
}

/* Generic header link / CTA styles. Kept because other pages may still use
   them; the shell header itself no longer renders them. */
.header-text-link {
  color: var(--silver-3);
  font-weight: 600;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
  transition: transform var(--t-fast) var(--ease-out),
              background-color var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out);
}

.header-text-link:hover {
  transform: translateY(-1px);
  background-color: rgba(212, 175, 55, 0.1);
  color: var(--gold-3);
}

.header-cta {
  background: var(--gradient-premium);
  color: var(--ink-900) !important;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  transition: transform var(--t-fast) var(--ease-out);
}

.header-cta:hover {
  transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
  .header-text-link,
  .header-cta,
  .header-alarm-link,
  .header-icon-link,
  .footer-icon-btn {
    transition: none;
  }
}

/* ============================================================
   4. SHELL FOOTER (#app-footer) — icons only
   [Feedback]        [Messages]        [Post]
   Hidden entirely when logged out (see js/shared/footer.js).
   ============================================================ */

#app-footer {
  grid-row: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--footer-height);
  padding: 0 14px;
  background: var(--gradient-surface);
  border-top: 1px solid var(--gold-line);
  contain: layout paint style;
}

/* display:flex above would beat the hidden attribute (base.css is not
   loaded on every page), so say it here too. */
#app-footer[hidden] {
  display: none;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: var(--content-max-desktop);
  margin: 0 auto;
}

.footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  max-width: 420px;
}

.footer-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 40px;
  padding: 0;
  background: none;
  color: var(--silver-3);
  border: none;
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out),
              transform var(--t-fast) var(--ease-out);
}

.footer-icon-btn:hover {
  background-color: rgba(212, 175, 55, 0.1);
  color: var(--gold-3);
  opacity: 1;
}

.footer-icon-btn:focus-visible {
  outline: 2px solid var(--gold-3);
  outline-offset: 2px;
}

.footer-glyph {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

/* Post: the one gold button */
.footer-post-btn {
  width: 52px;
  background: var(--gradient-premium);
  color: var(--ink-900);
  border-radius: 12px;
}

.footer-post-btn:hover {
  background: var(--gradient-premium);
  color: var(--ink-900);
  transform: translateY(-1px);
}

/* Message bell mounted by js/modules/message/message.js (shown as an icon) */
.footer-messages-slot {
  display: inline-flex;
  align-items: center;
}

/* The Message module styles its own bell in a dim colour. Force it to match
   the other footer icons. */
.footer-messages-slot .footer-icon-btn {
  color: var(--silver-3) !important;
  opacity: 1 !important;
  background: none;
}

.footer-messages-slot .footer-icon-btn:hover {
  color: var(--gold-3) !important;
  background-color: rgba(212, 175, 55, 0.1);
}

/* If the Message module puts its label inside a child element instead of a
   plain text node, hide that label but keep the icon and the unread badge. */
.footer-messages-slot .footer-icon-btn > span:not(.footer-glyph):not([class*="badge"]):not([class*="count"]):not([class*="unread"]) {
  display: none;
}

/* ============================================================
   5. SYSTEM BODY — the mount point for every system
   ============================================================ */

.system-body {
  grid-row: 2;
  overflow: auto;
  contain: content;
  padding: 14px;
  background: radial-gradient(
    1000px 500px at 50% 0%,
    var(--ink-700) 0%,
    var(--ink-900) 60%
  );
}

/* The standard "box" every system block uses. Consistent with the
   shell border. */
.box {
  border: 1px solid var(--gold-line);
  border-radius: 12px;
  padding: 14px;
  margin: 0 0 12px;
  background: var(--gradient-surface);
}

/* Lock gate overlay — displayed inside the shell, never as a page. */
.lock-gate {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 5, 6, 0.86);
  backdrop-filter: blur(2px);
  z-index: 5;
}

.lock-gate .box {
  max-width: 360px;
  width: calc(100% - 40px);
}

/* ============================================================
   6. RESPONSIVE — tablet / desktop
   ============================================================ */

@media (min-width: 641px) {
  .header-inner,
  .footer-inner {
    padding-left: 20px;
    padding-right: 20px;
  }
  .header-nav { gap: 10px; }
}

@media (min-width: 1025px) {
  .header-inner,
  .footer-inner {
    padding-left: 28px;
    padding-right: 28px;
  }
  .header-logo-img { height: 48px; }
  .header-nav { gap: 12px; }
}

/* ============================================================
   7. ROUTER MESSAGES (loading, error, not found)
   ============================================================ */

.router-message {
  color: var(--silver-1);
  text-align: center;
  padding: 40px 20px;
  font-size: 0.95rem;
}

.router-message-loading {
  color: var(--silver-2);
}

.router-message-error {
  color: var(--danger-text);
}

.router-message-notfound {
  color: var(--silver-1);
  font-style: italic;
}

/* ============================================================
   8. UTILITY CLASSES
   ============================================================ */

.text-gold      { color: var(--gold-3); }
.text-silver    { color: var(--silver-2); }
.text-muted     { color: var(--silver-1); }
.text-danger    { color: var(--danger-text); }

.bg-box         { background: var(--gradient-surface); }
.border-gold    { border: 1px solid var(--gold-line); }
.rounded        { border-radius: 10px; }

.no-motion,
.no-motion * {
  transition: none !important;
  animation: none !important;
}