/*
 * opendns.fi — style.css
 * A free Finnish DNS resolver page.
 * NOT a copy of any design system. This is its own thing.
 *
 * Aesthetic: dark terminal + aurora borealis + orbiting DNS packets
 */

/* ═══════════════════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* palette */
  --bg:       #060e14;
  --surface:  #0c1a24;
  --ink:      #d8eaf2;
  --muted:    #5e8a9c;
  --line:     #152a38;
  --teal:     #3ec5de;
  --teal-dim: rgba(62,197,222,0.12);
  --orange:   #e87a50;
  --green:    #4caf52;
  --red:      #ef5350;

  /* type */
  --mono:  'Space Mono', 'Cascadia Mono', 'Consolas', monospace;
  --sans:  'Space Grotesk', system-ui, sans-serif;

  /* spacing */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px;
  --s6: 24px; --s8: 32px; --s12: 48px; --s16: 64px; --s20: 80px;

  /* misc */
  --radius: 8px;
  --radius-lg: 14px;
  --glow: 0 0 30px rgba(62,197,222,0.15);
}

/* light mode (rarely used, but supported) */
html[data-theme="light"] {
  --bg:      #f0f5f8;
  --surface: #ffffff;
  --ink:     #142630;
  --muted:   #506770;
  --line:    #d6e2e8;
  --teal:    #146b80;
  --teal-dim: rgba(20,107,128,0.08);
  --orange:  #cf5b2f;
  --green:   #0e7715;
  --red:     #9c0f0f;
}
html[data-theme="light"] .aurora { display: none; }
html[data-theme="light"] #dot-grid { opacity: 0.4; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════════════
   ANIMATED BACKGROUND LAYER
   ═══════════════════════════════════════════════════════════════════ */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

#dot-grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* aurora borealis sweep */
.aurora {
  position: absolute;
  top: -40%;
  left: -20%;
  width: 140%;
  height: 90%;
  background:
    radial-gradient(ellipse 80% 50% at 30% 20%, rgba(62,197,222,0.06) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 70% 30%, rgba(232,122,80,0.04) 0%, transparent 60%),
    radial-gradient(ellipse 90% 60% at 50% 10%, rgba(62,197,222,0.04) 0%, transparent 70%);
  animation: aurora-drift 20s ease-in-out infinite alternate;
  filter: blur(60px);
}

@keyframes aurora-drift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(5%, 3%) scale(1.05); }
  100% { transform: translate(-3%, -2%) scale(0.97); }
}

/* ═══════════════════════════════════════════════════════════════════
   PAGE CONTAINER
   ═══════════════════════════════════════════════════════════════════ */
.page {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: var(--s8) var(--s6);
}

/* ═══════════════════════════════════════════════════════════════════
   HERO
   ═══════════════════════════════════════════════════════════════════ */
.hero {
  text-align: center;
  padding: var(--s16) 0 var(--s12);
  position: relative;
}

/* resolver orbit visualisation */
.resolver-viz {
  width: 220px;
  height: 220px;
  margin: 0 auto var(--s8);
  position: relative;
}

.resolver-svg {
  width: 100%;
  height: 100%;
}

.core-dot {
  filter: drop-shadow(0 0 8px var(--teal));
  animation: core-pulse 2s ease-in-out infinite;
}

@keyframes core-pulse {
  0%, 100% { r: 6; opacity: 1; }
  50%      { r: 8; opacity: 0.7; }
}

.orbit-pkt {
  filter: drop-shadow(0 0 4px var(--teal));
}

.orbit-pkt--2 {
  filter: drop-shadow(0 0 4px var(--orange));
}

/* ── glitch title ── */
.logo {
  font-family: var(--mono);
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
  position: relative;
  display: inline-block;
}

/* glitch pseudo-layers */
.logo::before,
.logo::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.logo::before {
  color: var(--teal);
  clip-path: inset(0 0 60% 0);
  animation: glitch-top 4s steps(1) infinite;
}
.logo::after {
  color: var(--orange);
  clip-path: inset(60% 0 0 0);
  animation: glitch-bot 4s steps(1) infinite;
}

@keyframes glitch-top {
  0%,92%,100% { transform: translate(0); }
  93%         { transform: translate(-3px, 1px); }
  95%         { transform: translate(2px, -1px); }
  97%         { transform: translate(-1px, 0); }
}
@keyframes glitch-bot {
  0%,90%,100% { transform: translate(0); }
  91%         { transform: translate(2px, 1px); }
  94%         { transform: translate(-2px, 0); }
  96%         { transform: translate(1px, -1px); }
}

/* hero text */
.hero-lead {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--muted);
  margin: var(--s6) auto var(--s12);
  max-width: 44ch;
  line-height: 1.7;
}

/* ═══════════════════════════════════════════════════════════════════
   ADDRESS BLOCK (terminal-style)
   ═══════════════════════════════════════════════════════════════════ */
.addr-block {
  max-width: 520px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--glow);
  text-align: left;
}

.addr-row {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s6);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.9rem;
}

.addr-row:last-child { border-bottom: none; }

.addr-prompt {
  color: var(--teal);
  min-width: 3.5ch;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.addr-val {
  flex: 1;
  color: var(--ink);
  word-break: break-all;
}

.copy-btn {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.copy-btn:hover {
  color: var(--teal);
  border-color: var(--teal);
  background: var(--teal-dim);
}

.copy-btn.copied {
  color: var(--green);
  border-color: var(--green);
}

.copy-btn.error {
  color: var(--red);
  border-color: var(--red);
}

.addr-row--status { background: rgba(62,197,222,0.03); }

.status-pill {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 1px 10px;
  border-radius: 20px;
  letter-spacing: 0.02em;
}

.status-pill.green {
  color: var(--green);
  background: rgba(76,175,82,0.12);
}

.status-pill.red {
  color: var(--red);
  background: rgba(239,83,80,0.10);
}

/* ═══════════════════════════════════════════════════════════════════
   SECTION HEADINGS
   ═══════════════════════════════════════════════════════════════════ */
.sec-head {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: var(--s8);
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: var(--s3);
}

.sec-head__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.green-dot {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}

/* ═══════════════════════════════════════════════════════════════════
   SYSTEM STATUS TABLE
   ═══════════════════════════════════════════════════════════════════ */
.sys-status {
  margin: var(--s16) 0;
  padding: var(--s8) 0;
  border-top: 1px solid var(--line);
}

.stat-table {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-row {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: var(--s4);
  align-items: center;
  padding: var(--s3) var(--s4);
  background: var(--surface);
  border-radius: 6px;
  transition: background 0.15s;
}

.stat-row:hover {
  background: rgba(62,197,222,0.04);
}

.stat-key {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-val {
  font-size: 0.92rem;
  color: var(--ink);
}

.stat-val.mono {
  font-family: var(--mono);
  font-size: 0.85rem;
}

.stat-badge {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.stat-badge.green {
  color: var(--green);
  background: rgba(76,175,82,0.12);
}

.stat-badge.red {
  color: var(--red);
  background: rgba(239,83,80,0.10);
}

/* mobile: stack status rows */
@media (max-width: 600px) {
  .stat-row {
    grid-template-columns: 1fr auto;
    gap: var(--s2);
  }
  .stat-key {
    grid-column: 1 / -1;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   TERMINAL WINDOWS (config section)
   ═══════════════════════════════════════════════════════════════════ */
.config {
  margin: var(--s16) 0;
  padding: var(--s8) 0;
  border-top: 1px solid var(--line);
}

.term-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--s6);
}

.term-window {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}

.term-window:hover {
  box-shadow: var(--glow);
  transform: translateY(-2px);
}

.term-bar {
  background: var(--line);
  padding: var(--s2) var(--s4);
  display: flex;
  align-items: center;
  gap: var(--s2);
}

/* fake traffic light dots */
.term-bar::before {
  content: '● ● ●';
  font-size: 0.55rem;
  letter-spacing: 3px;
  color: var(--muted);
  opacity: 0.5;
  margin-right: var(--s3);
}

.term-bar__title {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.term-pre {
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.7;
  padding: var(--s4) var(--s6);
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-all;
}

.c-green { color: var(--green); }
.c-cyan  { color: var(--teal); }
.c-muted { color: var(--muted); }

/* ═══════════════════════════════════════════════════════════════════
   ABOUT SECTION
   ═══════════════════════════════════════════════════════════════════ */
.about {
  margin: var(--s16) 0;
  padding: var(--s8) 0;
  border-top: 1px solid var(--line);
}

.about-inner {
  max-width: 620px;
}

.about p {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.75;
  margin-bottom: var(--s4);
}

.quirk-list {
  list-style: none;
  padding: 0;
  margin: var(--s6) 0;
}

.quirk-list li {
  position: relative;
  padding-left: 1.5em;
  margin-bottom: var(--s3);
  font-size: 0.95rem;
  line-height: 1.6;
}

.quirk-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--teal);
  font-weight: 700;
}

.about-fine {
  font-size: 0.88rem;
  color: var(--muted);
  border-left: 2px solid var(--line);
  padding-left: var(--s4);
  margin-top: var(--s8);
}

/* ═══════════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════════ */
.foot {
  margin-top: var(--s20);
  padding: var(--s8) 0 var(--s12);
  border-top: 1px solid var(--line);
  text-align: center;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--muted);
}

.foot p { margin-bottom: var(--s2); }

.foot-sub {
  font-size: 0.75rem;
  opacity: 0.7;
}

.foot-sub a { color: var(--muted); text-decoration: underline; }
.foot-sub a:hover { color: var(--teal); }

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0 2px;
  line-height: 1;
  vertical-align: middle;
  transition: color 0.15s;
}
.theme-toggle:hover { color: var(--teal); }

/* ═══════════════════════════════════════════════════════════════════
   SCANLINE OVERLAY (subtle retro feel)
   ═══════════════════════════════════════════════════════════════════ */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.015) 2px,
    rgba(0,0,0,0.015) 4px
  );
}

html[data-theme="light"] body::after {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  .page {
    padding: var(--s4) var(--s4);
  }

  .hero {
    padding-top: var(--s12);
  }

  .resolver-viz {
    width: 160px;
    height: 160px;
  }

  .addr-row {
    flex-wrap: wrap;
    padding: var(--s2) var(--s4);
  }

  .addr-prompt {
    min-width: 100%;
    margin-bottom: -4px;
  }

  .term-grid {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .aurora,
  .core-dot,
  .orbit-pkt,
  .logo::before,
  .logo::after {
    animation: none !important;
  }

  #dot-grid {
    display: none;
  }

  .term-window {
    transition: none;
  }
}
