/* =================================================================
   layout.css — Page grid, Header, Nav, Footer
================================================================= */

/* ── App Grid Shell ── */
#app {
  max-width: 1160px;
  margin: 0 auto;
  padding: 8px;
  display: grid;
  grid-template-columns: 1fr var(--sidebar-w);
  grid-template-rows: auto auto 1fr auto;
  grid-template-areas:
    "header  header"
    "nav     nav"
    "main    side"
    "footer  footer";
  gap: var(--gap);
  min-height: 100vh;
  position: relative;
  z-index: 2;
}

/* ── Rain canvas behind everything — only visible in side gutters ── */
#rain-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.18;
  -webkit-mask-image: linear-gradient(
    to right,
    black 0px,
    black calc(50% - 590px),
    transparent calc(50% - 490px),
    transparent calc(50% + 490px),
    black calc(50% + 590px),
    black 100%
  );
  mask-image: linear-gradient(
    to right,
    black 0px,
    black calc(50% - 590px),
    transparent calc(50% - 490px),
    transparent calc(50% + 490px),
    black calc(50% + 590px),
    black 100%
  );
}

/* ── Header ── */
#header {
  grid-area: header;
  background: var(--bg-panel);
  border: 1px solid var(--teal-dim);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

/* animated bottom glow line */
#header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--teal), var(--pink), var(--amber), transparent);
  animation: header-line 4s ease-in-out infinite;
}
@keyframes header-line {
  0%, 100% { opacity: 0.3; }
  50%       { opacity: 0.9; }
}

.logo-area {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}

.site-name {
  font-family: var(--font-vt);
  font-size: 54px;
  color: var(--teal);
  letter-spacing: 8px;
  line-height: 1;
  text-shadow:
    0 0 6px rgba(0,229,255,0.9),
    0 0 20px rgba(0,229,255,0.4),
    0 0 50px rgba(0,229,255,0.15);
  animation: flicker 9s ease-in-out infinite;
}
@keyframes flicker {
  0%,10%,12%,20%,22%,30%,60%,100% { opacity: 1; text-shadow: 0 0 6px rgba(0,229,255,0.9), 0 0 20px rgba(0,229,255,0.4), 0 0 50px rgba(0,229,255,0.15); }
  11% { opacity: 0.15; text-shadow: none; }
  21% { opacity: 0.4; text-shadow: 0 0 3px rgba(0,229,255,0.3); }
  31%,59% { opacity: 1; }
  40% { opacity: 0.8; text-shadow: 0 0 4px rgba(0,229,255,0.5); }
  41% { opacity: 0.1; text-shadow: none; }
  42% { opacity: 0.9; }
  43% { opacity: 0.2; text-shadow: none; }
  44% { opacity: 1; }
}

.site-tagline {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 2px;
  align-self: center;
}
.site-tagline .hl { color: var(--amber); }

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.online-badge {
  font-family: var(--font-pixel);
  font-size: 9px;
  background: var(--green);
  color: #000;
  padding: 3px 10px;
  letter-spacing: 2px;
  animation: pulse-badge 2s ease-in-out infinite;
}
@keyframes pulse-badge {
  0%,100% { box-shadow: 0 0 0 0 rgba(57,255,20,0.6); }
  50%      { box-shadow: 0 0 0 5px rgba(57,255,20,0); }
}

.header-clock {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 1px;
}
.header-clock #clock { color: var(--teal); }

/* ── Nav ── */
#nav {
  grid-area: nav;
  display: flex;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  overflow-x: auto;
}

.nav-btn {
  font-family: var(--font-pixel);
  font-size: 9px;
  padding: 10px 18px;
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  letter-spacing: 2px;
  transition: color 0.15s, background 0.15s;
  position: relative;
  outline: none;
  white-space: nowrap;
}
.nav-btn:last-child { border-right: none; }

.nav-btn::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--teal);
  transform: scaleX(0);
  transition: transform 0.2s ease;
}
.nav-btn:hover { color: var(--text); background: rgba(0,229,255,0.04); }
.nav-btn:hover::after { transform: scaleX(0.6); }
.nav-btn.active { color: var(--teal); background: rgba(0,229,255,0.06); }
.nav-btn.active::after { transform: scaleX(1); }

/* ── Main ── */
#main {
  grid-area: main;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-width: 0;
}

/* ── Sidebar ── */
#sidebar {
  grid-area: side;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-width: 0;
}

/* ── Footer ── */
#footer {
  grid-area: footer;
  text-align: center;
  font-size: 10px;
  color: var(--text-muted);
  padding: 8px;
  border-top: 1px solid var(--border);
  letter-spacing: 1px;
}
#footer a { color: var(--teal-dim); }
#footer a:hover { color: var(--teal); }

/* ── Section visibility ── */
.section { display: none; flex-direction: column; gap: var(--gap); }
.section.active { display: flex; }

/* ── Responsive ── */
@media (max-width: 820px) {
  #app {
    grid-template-columns: 1fr;
    grid-template-areas: "header" "nav" "main" "side" "footer";
  }
  :root { --sidebar-w: 100%; }
  .site-name { font-size: 38px; letter-spacing: 4px; }
  #header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .header-right { align-items: flex-start; }
}

@media (max-width: 480px) {
  .nav-btn { font-size: 7px; padding: 8px 10px; letter-spacing: 0; }
  .site-name { font-size: 28px; }
}
