/* ============================================================
   shell.css — ported header / footer / background shell
   Loaded AFTER style.css + responsive.css.
   All new tokens/classes are namespaced (--ph-*, .phnav-*, .phfoot-*)
   so nothing here overwrites or collides with the existing
   Transactions app design system in style.css.
   ============================================================ */

/* ---------- Namespaced tokens (no existing --var names reused) ---------- */
:root {
  --ph-blue-500: #3b82f6;
  --ph-blue-400: #60a5fa;
  --ph-purple: #a855f7;

  --ph-bg-glass: rgba(255, 255, 255, 0.72);
  --ph-border-glass: rgba(0, 0, 0, 0.08);

  --ph-text-bright: #0f172a;
  --ph-text-muted: #64748b;

  --ph-primary-gradient: linear-gradient(135deg, #3b82f6, #a855f7);

  --ph-radius-pill: 9999px;
  --ph-radius-card: 16px;

  --ph-nav-transition: 300ms ease;
}

[data-theme="dark"],
body.dark-mode {
  --ph-bg-glass: rgba(18, 18, 24, 0.62);
  --ph-border-glass: rgba(255, 255, 255, 0.1);
  --ph-text-bright: #ffffff;
  --ph-text-muted: #9ca3af;
}

/* ---------- Font: unify everything on Lexend Deca ---------- */
body {
  font-family: "Lexend Deca", "Outfit", system-ui, -apple-system, sans-serif;
}

/* Dark mode: override the app's solid --bg-color so the purple radial
   glow in body::before reads through evenly, exactly like the reference
   base.html look. Uses base.html's original --bg-dark (#0a0a0a) — a
   near-black that lets the low-alpha purples bleed inward instead of
   being drowned out by the app's harder #0f172a slate. Also cancels the
   inherited background-image / background-attachment so nothing from the
   old animated mesh gradient competes with body::before. */
[data-theme="dark"] body,
body.dark-mode {
  background-color: #0a0a0a;
  background-image: none;
  background-attachment: initial;
}

/* ---------- Background: replace the animated mesh with the
   ported purple radial glow. We fully reset every property the
   app's own body::before used (animation/transform/inset/top/left)
   so nothing from the old mesh leaks through. ---------- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  top: 0;
  left: 0;
  width: auto;
  height: auto;
  z-index: -1;
  pointer-events: none;
  animation: none;
  transform: none;
  background:
    radial-gradient(ellipse 80% 60% at 90% 10%, rgba(139, 92, 246, 0.28) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 100% 0%, rgba(168, 85, 247, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse 80% 60% at 10% 90%, rgba(139, 92, 246, 0.28) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 0% 100%, rgba(168, 85, 247, 0.15) 0%, transparent 50%);
}

/* ============================================================
   Header — .phnav (in-flow pill navbar, sits ABOVE the sticky
   .topbar; scrolls away naturally, no .topbar offset needed)
   ============================================================ */
.phnav {
  position: static;
  width: calc(100% - 2rem);
  max-width: 1100px;
  margin: 16px auto 20px;
  padding: 0px 20px;
  border-radius: var(--ph-radius-pill);
  border: 1px solid var(--ph-border-glass);
  background: var(--ph-bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  position: relative;
  z-index: 41; /* above topbar (40) while in flow, for its dropdown/mobile menu */
  transition: border-radius var(--ph-nav-transition);
}
.phnav.is-open { border-radius: var(--ph-radius-card); }

.phnav__inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.phnav__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
  position: relative;
}

/* Big character logo — pops out above/left of the pill, overlapping it,
   exactly like the original base.html .logo-main treatment. */
.phnav__logo-img {
  width: 220px;
  height: auto;
  object-fit: contain;
  position: absolute;
  left: -80px;
  top: -50px;
  z-index: 100;
  border-radius: 0;
  pointer-events: none;
}

/* Wordmark — pushed right to leave room for the big logo above it. */
.phnav__logo-text {
  width: 200px;
  height: 80px;
  object-fit: cover;
}

/* Tablet */
@media (min-width: 577px) and (max-width: 992px) {
  .phnav__logo-img { height: 100px; width: auto; top: -26px; }
  .phnav__logo-text { width: 160px; height: 64px; }
}

/* Mobile */
@media (min-width: 361px) and (max-width: 576px) {
  .phnav__logo-img { height: 62px; width: 63px; left: -19px; top: -13px; }
  .phnav__logo-text { width: 130px; height: 52px; }
}

/* Small mobile */
@media (max-width: 360px) {
  .phnav__logo-img { height: 53px; width: 46px; left: -5px; top: -5px; }
  .phnav__logo-text { width: 120px; height: 48px; }
}

.phnav__links {
  display: none;
  align-items: center;
  gap: 4px;
  position: relative;
}
@media (min-width: 768px) {
  .phnav__links { display: flex; }
}
.phnav__links:hover .phnav__pill { opacity: 1; }

.phnav__pill {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 36px;
  border-radius: var(--ph-radius-pill);
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.08);
  pointer-events: none;
  opacity: 0;
  transition:
    left 350ms cubic-bezier(0.23, 1, 0.32, 1),
    width 350ms cubic-bezier(0.23, 1, 0.32, 1),
    opacity 200ms ease;
  z-index: 0;
}
body.dark-mode .phnav__pill {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.phnav__link {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border-radius: var(--ph-radius-pill);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ph-text-muted);
  background: transparent;
  transition: color 250ms ease;
  white-space: nowrap;
  font-family: "Lexend Deca", sans-serif;
}
.phnav__link:hover { color: var(--ph-text-bright); }

.phnav__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.phnav-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--ph-border-glass);
  border-radius: 8px;
  background: transparent;
  color: var(--ph-text-muted);
  cursor: pointer;
  transition: background 200ms, color 200ms, border-color 200ms;
}
.phnav-theme-toggle:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--ph-text-bright);
  border-color: rgba(0, 0, 0, 0.2);
}
body.dark-mode .phnav-theme-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}
.phnav-hidden { display: none !important; }

.phnav__hamburger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.05);
  color: var(--ph-text-muted);
  cursor: pointer;
  transition: background 200ms, color 200ms;
}
.phnav__hamburger:hover { background: rgba(0, 0, 0, 0.1); color: var(--ph-text-bright); }
body.dark-mode .phnav__hamburger { background: rgba(255, 255, 255, 0.06); }
body.dark-mode .phnav__hamburger:hover { background: rgba(255, 255, 255, 0.12); }
@media (min-width: 768px) { .phnav__hamburger { display: none; } }
.phnav__hamburger svg { width: 20px; height: 20px; }

.phnav__mobile {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  transition:
    max-height var(--ph-nav-transition),
    opacity var(--ph-nav-transition),
    padding var(--ph-nav-transition);
}
.phnav__mobile.is-open {
  max-height: 500px;
  opacity: 1;
  pointer-events: auto;
  padding-top: 16px;
}
.phnav__mobile-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.phnav__mobile-link {
  font-size: 1rem;
  font-family: "Lexend Deca", sans-serif;
  color: var(--ph-text-muted);
  text-decoration: none;
  width: 100%;
  text-align: center;
  transition: color 200ms;
}
.phnav__mobile-link:hover { color: var(--ph-text-bright); }

/* ============================================================
   Footer — .phfoot
   ============================================================ */
.phfoot {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--ph-border-glass);
  padding: 3.5rem 2rem 0;
  margin-top: 80px;
  font-family: "Lexend Deca", sans-serif;
}

.phfoot__inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  padding-bottom: 2.5rem;
}
@media (min-width: 1024px) {
  .phfoot__inner { grid-template-columns: 2fr 1fr 1fr 1fr 1fr; gap: 2rem; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .phfoot__inner { grid-template-columns: 1fr 1fr 1fr; gap: 2rem; }
}
@media (min-width: 481px) and (max-width: 767px) {
  .phfoot__inner { grid-template-columns: 1fr 1fr; gap: 2rem; }
}

.phfoot__brand { max-width: 320px; }

.phfoot__logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  margin-bottom: 0.75rem;
}
.phfoot__logo-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}
.phfoot__logo-text {
  font-family: "Lexend Deca", sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ph-text-bright);
}

.phfoot__tagline {
  font-size: 0.85rem;
  color: var(--ph-text-muted);
  line-height: 1.7;
  margin-bottom: 1.25rem;
}

.phfoot__socials { display: flex; gap: 0.5rem; }
.phfoot__social {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--ph-border-glass);
  background: rgba(0, 0, 0, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ph-text-muted);
  text-decoration: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.15s;
}
.phfoot__social svg { width: 16px; height: 16px; }
.phfoot__social:hover {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.25);
  color: var(--ph-blue-500);
  transform: translateY(-2px);
}
body.dark-mode .phfoot__social { background: rgba(255, 255, 255, 0.04); }
body.dark-mode .phfoot__social:hover {
  background: rgba(96, 165, 250, 0.1);
  border-color: rgba(96, 165, 250, 0.3);
  color: var(--ph-blue-400);
}

.phfoot__links-col { display: flex; flex-direction: column; gap: 0.6rem; }
.phfoot__links-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ph-text-bright);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.25rem;
}
.phfoot__link {
  font-size: 0.84rem;
  color: var(--ph-text-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.phfoot__link:hover { color: var(--ph-blue-500); }
body.dark-mode .phfoot__link:hover { color: var(--ph-blue-400); }

.phfoot__bottom {
  border-top: 1px solid var(--ph-border-glass);
  padding: 1.5rem 0;
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.phfoot__copy {
  font-size: 0.78rem;
  color: var(--ph-text-muted);
}

/* ============================================================
   Dark-mode card & panel treatment
   Overrides only in dark mode. Light mode keeps style.css's solid
   white cards untouched. Turns the solid dark cards from style.css
   into translucent glass panels with a hairline border and, on
   hover, a bright top-edge line + soft purple bloom — matching the
   reference site's card treatment.

   Free slots verified: style.css defines .card.drop-ready::after
   but no .card::before or .card:hover, and no .history::before or
   .history:hover. Safe to add both without collisions.
   ============================================================ */
body.dark-mode .card,
body.dark-mode .history {
  background: var(--ph-bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--ph-border-glass);
  overflow: hidden;             /* clip the top-edge ::before line */
}

/* Top-edge highlight line — fades in on hover */
body.dark-mode .card::before,
body.dark-mode .history::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(139, 92, 246, 0.6),
    transparent
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 3;
}

/* .history is position: sticky, .card is position: relative — both
   are already positioning contexts, so the absolute ::before anchors
   correctly to each. No layout change needed. */

body.dark-mode .card:hover {
  border-color: rgba(139, 92, 246, 0.25);
  box-shadow: 0 10px 16px rgba(139, 92, 246, 0.18);
  transform: translateY(-4px);
}
body.dark-mode .card:hover::before,
body.dark-mode .history:hover::before {
  opacity: 1;
}

/* Keep drop-ready glow readable against the new glass background */
body.dark-mode .card.drop-ready {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.4);
}

@media (prefers-reduced-motion: reduce) {
  .phnav, .phnav__pill, .phnav__mobile, .phnav-theme-toggle, .phnav__hamburger {
    transition-duration: 0.001ms !important;
  }
}