/* EchoWire Style: namespaced with ew- */
:root{
  --ew-primary: #b8b9bd;
  --ew-ink: #e9edf1;
  --ew-paper: #0f1114;
  --ew-muted: #98a0a6;
  --ew-surface: #151a1f;
  --ew-hair: rgba(200,205,210,0.28);
  --ew-shadow: rgba(0,0,0,0.35);
  --ew-radius-xs: 6px;
  --ew-radius-sm: 10px;
  --ew-radius-md: 14px;
  --ew-radius-lg: 18px;
  --ew-space-1: 10px;
  --ew-space-2: 16px;
  --ew-space-3: 22px;
  --ew-space-4: 28px;
  --ew-space-5: 36px;
  --ew-space-6: 48px;
  --ew-maxw: 1120px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--ew-paper); color: var(--ew-ink); }
body { font: 16px/1.7 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; }

header.ew-site-head {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(180deg, rgba(10,12,15,0.92), rgba(10,12,15,0.72));
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--ew-hair);
}
.ew-bg {
  background-image:
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255,255,255,0.03) 1px, transparent 1px),
    radial-gradient(1200px 1200px at 100% -20%, rgba(255,255,255,0.05), transparent 45%);
  background-size: 24px 24px, 24px 24px, auto;
}

.ew-bar {
  max-width: var(--ew-maxw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--ew-space-3);
  padding: var(--ew-space-2) var(--ew-space-3);
}

.ew-brand { display: flex; align-items: center; gap: var(--ew-space-2); text-decoration: none; color: var(--ew-ink); }
.ew-brand img { width: 160px; height: auto; }

/* NAV: anchors as flex items with explicit order */
nav.ew-nav ul{
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  gap: var(--ew-space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}
nav.ew-nav ul > li{ display: contents; }
nav.ew-nav a{
  position: relative;
  display: inline-block;
  padding: 8px 6px;
  text-decoration: none;
  color: var(--ew-ink);
}
nav.ew-nav a::after{
  content: "";
  position: absolute; left: 0; bottom: 2px; height: 2px; width: 0;
  background: var(--ew-primary); transition: width .25s ease;
}
nav.ew-nav a:hover::after{ width: 100%; }

/* Enforce exact left-to-right order */
nav.ew-nav a[href="index.html"]                 { order: 1; }
nav.ew-nav a[href="cosmic-origins.html"]        { order: 2; }
nav.ew-nav a[href="astronomy-toolkit.html"]     { order: 3; }
nav.ew-nav a[href="astrophysics-insights.html"] { order: 4; }
nav.ew-nav a[href="observation-journal.html"]   { order: 5; }
nav.ew-nav a[href="about.html"]                 { order: 6; }
nav.ew-nav a[href="contact.html"]               { order: 7; }

/* Main layout */
main.ew-main {
  width: 100%;
  max-width: var(--ew-maxw);
  margin: 0 auto;
  padding: var(--ew-space-5) var(--ew-space-3);
  display: block;
}
.ew-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--ew-space-5);
  align-items: start;
}
.ew-article {
  background: var(--ew-surface);
  border: 1px solid var(--ew-hair);
  border-radius: var(--ew-radius-lg);
  box-shadow: 0 10px 30px var(--ew-shadow);
  padding: var(--ew-space-5);
  width: 100%;
  min-width: 0;
}
.ew-aside {
  position: sticky; top: 80px;
  border: 1px solid var(--ew-hair);
  border-radius: var(--ew-radius-md);
  padding: var(--ew-space-4);
  background: linear-gradient(180deg, rgba(32,36,40,0.9), rgba(26,30,34,0.9));
  box-shadow: 0 8px 24px var(--ew-shadow);
  min-width: 0;
}

.ew-lede { color: var(--ew-muted); margin-top: 6px; }

/* Typography */
h1.ew-h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 var(--ew-space-2); }
h2.ew-h2 { margin-top: var(--ew-space-5); border-top: 1px solid var(--ew-hair); padding-top: var(--ew-space-3); }
h3.ew-h3 { margin-top: var(--ew-space-3); color: var(--ew-muted); }
p.ew-meta { color: var(--ew-muted); font-size: 0.95rem; }

figure.ew-hero { margin: var(--ew-space-4) 0; }
figure.ew-hero img {
  width: 100%; height: auto; max-height: 460px; object-fit: cover;
  border-radius: var(--ew-radius-md);
  border: 1px solid var(--ew-primary);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05), 0 12px 28px var(--ew-shadow);
}
figure.ew-hero figcaption { color: var(--ew-muted); font-size: 0.9rem; margin-top: 6px; }

/* Buttons */
a.ew-btn {
  display: inline-block;
  padding: 10px 14px;
  border-radius: var(--ew-radius-sm);
  background: var(--ew-primary);
  color: #101215;
  text-decoration: none;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 4px 10px var(--ew-shadow);
}
a.ew-btn:hover { filter: brightness(1.05); }

/* Footer */
footer.ew-foot {
  border-top: 1px solid var(--ew-hair);
  padding: var(--ew-space-4) var(--ew-space-3);
  color: var(--ew-muted);
  text-align: center;
}

/* Paragraph justification — enforced */
article p,
section p,
main p,
p {
  text-align: justify !important;
  text-justify: inter-word !important;
  -webkit-hyphens: auto !important;
  -ms-hyphens: auto !important;
  hyphens: auto !important;
}

/* Back to Top */
.ew-to-top{
  position: fixed;
  right: 18px; bottom: 18px;
  width: 42px; height: 42px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.25);
  background: var(--ew-primary);
  color: #111;
  font: 600 18px/42px system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  text-align: center;
  cursor: pointer;
  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity .25s ease, transform .25s ease, background .2s ease;
  z-index: 60;
}
.ew-to-top:hover{ background: #fff; }
.ew-to-top.ew-show{ opacity: 1; transform: translateY(0); pointer-events: auto; }
@media (prefers-reduced-motion: reduce){ .ew-to-top{ transition: none; } }

/* Responsive */
@media (max-width: 980px){
  .ew-grid { grid-template-columns: 1fr; }
  nav.ew-nav ul { flex-wrap: wrap; gap: var(--ew-space-2); }
  .ew-bar { grid-template-columns: 1fr; }
}

/* Safety */
img { max-width: 100%; height: auto; }

/* Visually hide logo text but keep it accessible */
.ew-brand span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- Final Footer Refinement (EchoWire / CosmosScope Harmonization) --- */

/* Override global justification */
footer.ew-foot,
footer.ew-foot * {
  text-align: center !important;
}

/* Footer layout: columnar structure and balanced spacing */
footer.ew-foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: var(--ew-space-5);
  padding-bottom: var(--ew-space-5);
  background: var(--ew-surface);
  border-top: 1px solid var(--ew-hair);
  color: var(--ew-muted);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.35) inset;
}

/* Metrolagu Network (EchoWire / CosmosScope palette) */
.metrolagu-network {
  background: none;
  color: var(--ew-ink);
  padding: var(--ew-space-4) 0;
}

.network-container {
  max-width: var(--ew-maxw);
  margin: 0 auto;
  padding: 0 var(--ew-space-3);
}

.metrolagu-network h3 {
  font-size: 1.15em;
  margin-bottom: var(--ew-space-1);
  color: #9BCB97; /* cosmic mint accent */
  font-weight: 600;
  text-align: center;
  text-shadow: 0 0 4px rgba(155,203,151,0.25);
}

.metrolagu-network p {
  color: var(--ew-muted);
  margin-bottom: 10px;
  line-height: 1.7;
  text-align: center;
}

/* Network links */
.network-links {
  text-align: center;
}

.network-links a {
  color: var(--ew-ink);
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  transition: color 0.3s ease, border-color 0.3s ease, opacity 0.3s ease;
}

.network-links a:hover {
  color: #9BCB97;
  border-bottom-color: #9BCB97;
  opacity: 0.85;
}

/* Copyright pill refinement */
footer.ew-foot .copyright,
.site-footer .copyright {
  display: inline-block;
  margin: 18px auto 6px auto;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.4px;
  color: var(--ew-ink);
  background: rgba(15,17,20,0.85);
  padding: 8px 22px;
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.45);
  transition: all 0.3s ease;
}

/* Hover tone: subtle metallic blue shimmer */
footer.ew-foot .copyright:hover {
  background: rgba(184,185,189,0.2);
  color: var(--ew-ink);
  border-color: rgba(184,185,189,0.4);
  box-shadow: 0 3px 16px rgba(184,185,189,0.25);
  transform: translateY(-1px);
}

/* Embedded link inherits the same tone */
footer.ew-foot .copyright a {
  color: inherit !important;
  text-decoration: none !important;
  transition: opacity 0.3s ease;
}

