@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap');

:root {
  --paper: #f5f1e8;
  --paper-dark: #ebe5d8;
  --border: #d7cfbf;
  --text: #2c2c2c;
  --muted: #777;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(245,241,232,0.72), rgba(245,241,232,0.72)),
    url('erailinfo-pattern-bg-light.svg');
  background-repeat: repeat;
  background-size: 100% 100%, 680px 1000px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  line-height: 1.6;
}

header, footer {
  background: var(--paper);
  position: relative;
  z-index: 1;
}

.container { width: min(1100px, 90%); margin: auto; }

header { padding: 20px 0; border-bottom: 1px solid var(--border); }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 24px; }

/* ── LOGO BADGE — stacked navy/white/navy design, fixed colors, NOT affected by dark mode ── */
.logo-badge {
  display: flex;
  flex-direction: column;
  width: 62px;
  height: 62px;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid #000;
  text-decoration: none;
  flex-shrink: 0;
}
.logo-badge-band { background: #0a2647; flex: 1; }
.logo-badge-text {
  background: #fff;
  color: #0a2647;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  height: 20px;
  line-height: 20px;
  letter-spacing: -0.2px;
}

.header-right { display: flex; align-items: center; gap: 20px; }
.time-capsule {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  gap: 2px;
}

.early-access-banner {
  width: 100%;
  height: 28px;
  overflow: hidden;
  background: #0a2647;
  border-bottom: 2px solid #027B7B;
  position: relative;
}
body.dark .early-access-banner {
  background: #061420;
  border-bottom-color: #027B7B;
}
.early-access-banner-text {
  position: absolute;
  top: 0;
  white-space: nowrap;
  padding: 0 40px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
  line-height: 28px;
  will-change: transform;
}
.early-access-banner-text .highlight {
  color: #f5c65d;
}
.time-capsule-line1 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
}
.time-capsule-line1 .tz-tag {
  font-size: 12px;
  font-weight: 700;
  color: #8fa3c4;
}

.time-capsule-line2 {
  font-size: 13px;
  font-weight: 600;
  color: #8fa3c4;
  white-space: nowrap;
}
.category-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #0a2647;
  color: #fff;
  border: 3px solid #000;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  text-decoration: none;
  transition: box-shadow 0.15s, transform 0.15s;
}
.category-pill:hover {
  box-shadow: 4px 4px 0 #000;
  transform: translate(-2px, -2px);
}
body.dark .category-pill { border-color: #fff; }
body.dark .category-pill:hover { box-shadow: 4px 4px 0 #fff; }
.nav-menu { display: flex; gap: 12px; list-style: none; }
.nav-menu li { position: relative; }
.nav-menu a.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  background: #0a2647;
  border: 2px solid #000;
  border-radius: 8px;
  padding: 10px 18px;
  transition: filter 0.15s;
}
.nav-menu a.nav-btn {
  transition: box-shadow 0.15s, transform 0.15s;
}
.nav-menu a.nav-btn:hover {
  filter: brightness(1.08);
  box-shadow: 4px 4px 0 #000;
  transform: translate(-2px, -2px);
}

.dropdown-menu { display: none; position: absolute; top: 100%; left: 0; margin-top: 6px; padding-top: 14px; min-width: 180px; background: #0a2647; border: 2px solid #000; padding-bottom: 8px; list-style: none; z-index: 1000; box-shadow: 5px 5px 0 rgba(0,0,0,.9); }
.dropdown-menu li a {
  display: block;
  margin: 4px 8px;
  padding: 8px 12px;
  background: #123a63;
  color: #fff;
  border: 2px solid #000;
  border-radius: 6px;
  font-weight: 700;
  text-decoration: none;
}
.dropdown-menu li a {
  transition: box-shadow 0.15s, transform 0.15s;
}
.dropdown-menu li a:hover {
  filter: brightness(1.1);
  box-shadow: 3px 3px 0 #000;
  transform: translate(-1px, -1px);
}
.dropdown-menu li a:hover { background: var(--paper-dark); }
.dropdown-menu.open { display: block; }
.dropdown-submenu { position: relative; }
.dropdown-submenu > a.submenu-trigger { font-weight: 700 !important; }
.submenu {
  display: none;
  position: absolute;
  top: -8px;
  left: 100%;
  min-width: 90px;
  max-height: 320px;
  overflow-y: auto;
  background: #0a2647;
  border: 2px solid #000;
  padding: 8px 0;
  list-style: none;
  z-index: 1001;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
.submenu::-webkit-scrollbar {
  width: 10px;
}
.submenu::-webkit-scrollbar-track {
  background: #0a2647;
}
.submenu::-webkit-scrollbar-thumb {
  background: #123a63;
  border: 2px solid #000;
  border-radius: 6px;
}
.submenu {
  scrollbar-width: thin;
  scrollbar-color: #123a63 #0a2647;
}
.submenu li a {
  display: block;
  margin: 4px 8px;
  padding: 8px 12px;
  background: #123a63;
  color: #fff;
  border: 2px solid #000;
  border-radius: 6px;
  font-weight: 700;
  text-decoration: none;
}
.submenu li a:hover { filter: brightness(1.1); }
.submenu.open { display: block; }


.browse-bar { background: var(--paper-dark); border-bottom: 1px solid var(--border); padding: 14px 0; }
.browse-bar-inner { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.browse-bar-label { font-size: 11px; font-weight: 700; letter-spacing: 1.5px; color: var(--muted); text-transform: uppercase; margin-right: 6px; white-space: nowrap; }
.capsule { display: inline-flex; align-items: center; padding: 6px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 12px; font-weight: 400; color: #333; text-decoration: none; background: white; cursor: pointer; transition: background 0.15s, border-color 0.15s; white-space: nowrap; }.capsule:hover { background: var(--paper); border-color: #b0a898; }
.capsule.active { background: #2c2c2c; color: white; border-color: #2c2c2c; }
.search-card-bg {
  background: #0a2647;
  border: 1px solid #000;
  border-radius: 14px !important;
  overflow: hidden;
  padding: 0 !important;
  color: #fff;
}
.search-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 24px;
  background: #571717;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  font-size: 15px;
  font-weight: 700;
}
.search-card-body { padding: 24px; }

.search-card-bg input[type="text"],
.search-card-bg .station-pill-box {
  border: 1px solid rgba(255,255,255,0.25) !important;
}

.search-card-bg .station-pill-box input[type="text"],
body.dark .search-card-bg .station-pill-box input[type="text"] {
  border: none !important;
  background: transparent !important;
}
.search-card-bg input[type="text"],
.search-card-bg .station-pill-box {
  transition: border-color 0.15s;
}
.search-card-bg input[type="text"]:focus,
.search-card-bg .station-pill-box:focus-within {
  border-color: #fff !important;
}
.search-card-bg button[onclick="swapStations()"] {
  background: rgba(2,123,123,0.25) !important;
  border: 2px solid #027B7B !important;
  color: #fff !important;
  border-radius: 8px !important;
}
.search-card-bg button[onclick]:hover {
  filter: brightness(1.1);
}
body.dark #trainSearchInput {
  border: 1px solid rgba(255,255,255,0.25) !important;
}
/* ── BROWSE BAR — equal-size navy cells, matches logo style, fixed across themes ── */
#capsuleBar {
  display: grid !important;
  grid-template-columns: repeat(11, 1fr);
  gap: 8px;
  width: 100%;
}
#capsuleBar .capsule {
  height: 42px;
  width: auto;
  padding: 0 6px;
  background: #0a2647;
  color: #fff;
  border: 2px solid #000;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  justify-content: center;
  transition: filter 0.15s, box-shadow 0.15s, transform 0.15s;
}
#capsuleBar .capsule:hover {
  filter: brightness(1.2);
  background: #0a2647;
  border-color: #000;
  box-shadow: 4px 4px 0 #000;
  transform: translate(-2px, -2px);
}
#capsuleBar .capsule-text { display: inline-block; }

#capsuleBar .capsule[data-cat="Vande Bharat Sleeper"] {
  overflow: hidden;
  white-space: nowrap;
}
#capsuleBar .capsule[data-cat="Vande Bharat Sleeper"] .capsule-text {
  display: inline-block;
  padding-left: 100%;
  animation: ticker-scroll 5s linear infinite;
}

@keyframes twwBandsFadeIn {
  0%{opacity:1} 14%{opacity:0} 86%{opacity:0} 100%{opacity:1}
}
@keyframes twwWordBus     {0%{opacity:0}4%{opacity:1}18%{opacity:1}22%{opacity:0}100%{opacity:0}}
@keyframes twwWordRail    {0%{opacity:0}22%{opacity:0}26%{opacity:1}40%{opacity:1}44%{opacity:0}100%{opacity:0}}
@keyframes twwWordTrain   {0%{opacity:0}44%{opacity:0}48%{opacity:1}62%{opacity:1}66%{opacity:0}100%{opacity:0}}
@keyframes twwWordFlights {0%{opacity:0}66%{opacity:0}70%{opacity:1}84%{opacity:1}88%{opacity:0}100%{opacity:0}}

.tww-badge {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  background: #0f1520;
  flex-shrink: 0;
  text-decoration: none;
  display: block;
}
.tww-band {
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.3px;
  animation: twwBandsFadeIn 9s ease-in-out infinite;
}
.tww-word {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  font-size: 13px;
  letter-spacing: 1px;
  opacity: 0;
}
@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}
.station-card-bg {
  background-color: #0a2647 !important;
  border: 3px solid #000 !important;
  color: #fff !important;
  transition: box-shadow 0.15s, transform 0.15s;
}
.station-card-bg:hover {
  box-shadow: 4px 4px 0 #000;
  transform: translate(-2px, -2px);
}

.page-hero { text-align: center; padding: 60px 0 40px; }
.page-hero h1 { font-family: 'Inter', sans-serif; font-size: 64px; font-weight: 700; }
.page-hero p { color: #666; margin-top: 10px; font-size: 14px; }

.section-title { border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-bottom: 15px; font-size: 12px; font-weight: 700; letter-spacing: 1px; }
.train-row { display: flex; gap: 15px; padding: 15px 0; border-bottom: 1px solid #e5dfd2; }
.train-number { font-weight: 700; font-size: 36px; font-family: 'Inter', sans-serif; min-width: 80px; }
.train-details { font-size: 14px; line-height: 1.5; }

.bottom-capsules { padding: 40px 0 60px; }
.bottom-capsules-label { font-size: 11px; font-weight: 700; letter-spacing: 1.5px; color: var(--muted); text-transform: uppercase; margin-bottom: 14px; }
.bottom-capsules-row { display: flex; flex-wrap: wrap; gap: 10px; }

footer { padding: 30px 0; border-top: 1px solid var(--border); text-align: center; color: #888; font-size: 13px; }

@media (max-width: 768px) {

  /* HEADER */
.topbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.logo-badge { flex-shrink: 0; }

.time-capsule.time-capsule {
  flex: 1;
  min-width: 0;
  width: auto;
  height: 48px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.time-capsule::-webkit-scrollbar { display: none; }

.time-cell {
  flex: 0 0 auto;
  font-size: 8px !important;
  padding: 4px 6px !important;
}

.header-right { display: contents; }

.theme-toggle {
  flex-shrink: 0;
  margin-left: 0;
}

.nav-menu {
  grid-area: nav;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  width: 100%;
}
.nav-menu a.nav-btn {
  font-size: 13px;
  padding: 12px 16px;
  width: 100%;
  justify-content: flex-start;
}
.logo-badge { width: 48px; height: 48px; border-radius: 10px; }
  .logo-badge-text { font-size: 7px; height: 16px; line-height: 16px; padding: 0; }
.theme-toggle {
    width: 48px !important;
    height: 48px !important;
    border-radius: 10px !important;
    margin-left: 0 !important;
  }
  .theme-toggle svg { width: 22px !important; height: 22px !important; }

  /* BROWSE BAR */
  .browse-bar { padding: 10px 0; }
  .browse-bar-inner { gap: 6px; }
  .capsule { font-size: 11px; padding: 5px 10px; }
  #capsuleBar { grid-template-columns: repeat(3, 1fr) !important; }
  #capsuleBar .capsule { height: 38px; font-size: 10px; }

  /* PAGE HERO */
  .page-hero h1 { font-size: 40px; }

  /* BOTTOM CAPSULES */
  .bottom-capsules { padding: 24px 0 40px; }

}

/* ── DARK THEME ── */
body.dark {
  --paper: #1a1a1a;
  --paper-dark: #242424;
  --border: #383838;
  --text: #e8e8e8;
  --muted: #999;
  background: #1a1a1a url('erailinfo-pattern-bg.svg') repeat;
  background-size: 680px 1000px;
  color: #e8e8e8;
}

/* Note: .logo-badge, .logo-badge-icon, .logo-badge-text are deliberately
   NOT overridden here — the logo stays visually identical in both themes. */

body.dark header { border-bottom-color: #383838; background: #1a1a1a; }
body.dark footer { background: #1a1a1a; }
body.dark .browse-bar { background: #242424; border-bottom-color: #383838; }
body.dark .capsule { background: #2a2a2a; color: #ccc; border-color: #444; }
body.dark .capsule:hover { background: #333; border-color: #555; }
body.dark #capsuleBar .capsule:not(.active) {
  background: #0a2647 !important;
  color: #fff !important;
}
body.dark #capsuleBar .capsule {
  border-color: #000 !important;
}
body.dark .tagline { color: #777; }

/* Dark — search cards */
body.dark .search-card-bg {
  background: #0a2647 !important;
  border-color: #000 !important;
  color: #e8e8e8 !important;
}

body.dark .search-card-bg div,
body.dark .search-card-bg button {
  color: inherit;
}

body.dark .search-card-bg button[onclick] {
  background: #027B7B !important;
  color: white !important;
}

/* Dark — station cards */
body.dark .station-card-bg {
  background-color: #0a2647 !important;
  border-color: #fff !important;
  color: #fff !important;
}
body.dark .station-card-bg:hover { box-shadow: 4px 4px 0 #fff; }

/* Dark — features row */
body.dark .feature-item-bg { border-color: #fff !important; }
body.dark .feature-item-bg:hover { box-shadow: 4px 4px 0 #fff; }
body.dark .feature-title-text { color: #fff !important; }
body.dark .feature-desc-text { color: #cfd8e6 !important; }

.features-bg {
  background: transparent !important;
  border: none !important;
  overflow: visible !important;
  gap: 12px;
}
.feature-item-bg {
  background: #0a2647 !important;
  border: 3px solid #000 !important;
  border-radius: 8px;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  transition: box-shadow 0.15s, transform 0.15s;
}
.feature-item-bg:hover {
  box-shadow: 4px 4px 0 #000;
  transform: translate(-2px, -2px);
}
.feature-title-text { color: #fff !important; }
.feature-desc-text { color: #cfd8e6 !important; }

/* Dark — inputs */
body.dark input[type="text"] {
  background: #2a2a2a !important;
  border-color: #444 !important;
  color: #e8e8e8 !important;
}
body.dark input[type="text"]::placeholder { color: #666 !important; }
body.dark input[type="text"]:focus { border-color: #666 !important; background: #333 !important; }

/* Dark — search results */
body.dark .result-card-bg {
  background: #242424 !important;
  border-color: #383838 !important;
}
body.dark .result-card-bg:hover { background: #2e2e2e !important; }

/* Dark — bottom capsules */
body.dark .bottom-capsules-row .capsule { background: #2a2a2a; color: #ccc; border-color: #444; }

/* Dark — footer */
body.dark footer { border-top-color: #383838; color: #666; }
body.dark .footer-links a { color: #666; }

/* Dark — no results */
body.dark .no-results-bg { background: #242424 !important; border-color: #383838 !important; }

/* Dark — dropdown suggestions */
body.dark .station-suggestion { background: #0a2647 !important; border-color: #fff !important; }
body.dark .suggestion-item { border-bottom-color: rgba(255,255,255,0.2) !important; color: #fff !important; }
body.dark .suggestion-item:hover { background: rgba(255,255,255,0.12) !important; }
body.dark .suggestion-code { color: #b8c4d6 !important; }

/* Dark — station input pill */
body.dark .station-pill {
  background: #2a2a2a !important;
  border-color: #555 !important;
  color: #e8e8e8 !important;
}
body.dark #capsuleBar .capsule:not(.active) {
  background: #0a2647 !important;
  color: #fff !important;
}
body.dark #capsuleBar .capsule {
  border-color: #000 !important;
}

body.dark .logo-badge,
body.dark .nav-menu a.nav-btn,
body.dark .dropdown-menu li a,
body.dark .submenu li a,
body.dark #capsuleBar .capsule {
  border-color: #fff !important;
}
/* ── THEME TOGGLE BUTTON (rounded square, Android style) ── */
.theme-toggle {
  width: 62px;
  height: 62px;
  border-radius: 10px;
  border: 3px solid #000;
  background: #0a2647;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 24px;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.theme-toggle:hover {
  box-shadow: 4px 4px 0 #000;
  transform: translate(-2px, -2px);
}

.theme-toggle:hover {
  background: var(--border);
}

.theme-toggle svg {
  width: 28px;
  height: 28px;
  color: #fff;
}

body.dark .theme-toggle {
  background: #0a2647;
  border-color: #fff;
}
body.dark .theme-toggle:hover {
  box-shadow: 4px 4px 0 #fff;
}

body.dark .theme-toggle svg { color: #e8e8e8; }
@keyframes pageSnowFall{

0%{
transform:translateY(-30px) translateX(0) rotate(0deg);
opacity:0;
}

10%{
opacity:1;
}

100%{
transform:
translateY(110vh)
translateX(var(--drift))
rotate(360deg);

opacity:0;
}

}
.page-raindrop{
    position:fixed;
    top:-20px;
    left:0;
    width:8px;
    height:8px;
    background:white;
    border-radius:50%;
    pointer-events:none;
    z-index:9999;

    opacity:.8;

    animation:pageSnowFall var(--fall-dur,8s) linear infinite;
    animation-delay:var(--fall-delay,0s);

    box-shadow:
        0 0 6px rgba(255,255,255,.8),
        0 0 12px rgba(255,255,255,.35);
}
header, footer, .hero-scene, .search-card-bg, .feature-item-bg, .station-card-bg {
  position: relative;
  z-index: 1;
}
