/* ================================
   Third Degree Media — Global CSS
   ================================ */

/* Cryptic/Dark Fonts */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,300;0,400;0,500;0,700;1,400&display=swap');

/* 1) Theme tokens */
:root {
  color-scheme: light dark;
  /* Light theme defaults */
  --bg: #f5f6fa;
  --fg: #18181b;
  --muted: #6b7280;
  --card: #ffffff;
  --border: #e0e0e0;
  --accent: #ff6600;
  --link: #0077cc;
  --link-hover: #ff6600;

  /* Extras used in components */
  --card-bg: var(--card);
  --card-border: var(--border);
}

/* Dark theme via media query */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --fg: #c9c9c9;
    --muted: #666666;
    --card: #111111;
    --border: #1a1a1a;
    --link: #ff6600;
    --link-hover: #ffaa00;
    --accent: #ff6600;
  }
}

/* Manual theme overrides (optional) */
[data-theme="light"] {
  --bg: #f5f6fa;
  --fg: #18181b;
  --muted: #6b7280;
  --card: #ffffff;
  --border: #e0e0e0;
  --accent: #ff6600;
  --link: #0077cc;
  --link-hover: #ff6600;
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --fg: #c9c9c9;
  --muted: #666666;
  --card: #111111;
  --border: #1a1a1a;
  --accent: #ff6600;
  --link: #ff6600;
  --link-hover: #ffaa00;
}

/* 2) Base & layout */
*,
*::before,
*::after { box-sizing: border-box; }
html { 
  -webkit-text-size-adjust: 100%; 
  scroll-behavior: smooth;
}
html, body { margin:0; height:100%; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', 'SF Mono', 'Monaco', 'Inconsolata', 'Consolas', monospace;
  font-size: 1.05rem;
  line-height: 1.65;
  max-width: 70ch;
  margin: 0 auto;
  padding: 40px;
  min-height: 100vh;
  letter-spacing: 0.02em;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Optional subtle luxe background for non-reduced-motion users */
@media (prefers-reduced-motion: no-preference) {
  body {
    /* very soft gradient—less GPU heavy than before */
    background: radial-gradient(1200px 800px at 10% -10%, rgba(255,102,0,0.05), transparent 60%),
                radial-gradient(1200px 800px at 110% 10%, rgba(102,204,255,0.05), transparent 60%),
                var(--bg);
  }
}

/* 3) Shell */
header, footer {
  max-width: 900px;
  margin: 2rem auto 1rem;
  padding: 0 1.5rem;
}

header {
  text-align: center;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
  border-radius: 0 0 18px 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  position: relative;
  background: linear-gradient(90deg, rgba(0,0,0,.06), rgba(0,0,0,.12));
}

header::after {
  content: "";
  display: block;
  height: 4px;
  width: 100%;
  margin-top: 1.2rem;
  border-radius: 2px;
  background: linear-gradient(90deg, #ff6600, #ffcc00, #66ccff, #ff6600);
  background-size: 300% 100%;
  animation: gradientMove 6s linear infinite;
}
@keyframes gradientMove {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}
@media (prefers-reduced-motion: reduce) {
  header::after { animation: none; }
}

main {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 2rem;
  max-width: 1200px;
  margin: 2rem auto;
  padding: 2rem 1.5rem;
  background: color-mix(in srgb, var(--bg) 92%, #000 8%);
  border-radius: 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  position: relative;
  z-index: 1;
}

/* 4) Cards / sections */
section, .callout, .card, .panel {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 12px;
  padding: 1rem;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
section:hover, .callout:hover, .card:hover, .panel:hover {
  transform: translateY(-6px) scale(1.018);
  box-shadow: 0 12px 36px rgba(255,102,0,0.13);
  border-color: var(--accent);
}
@media (prefers-reduced-motion: reduce) {
  section:hover, .callout:hover, .card:hover, .panel:hover {
    transform: none;
    box-shadow: 0 8px 18px rgba(0,0,0,.12);
  }
}

/* 5) Type */
h1, h2 {
  color: var(--accent);
  line-height: 1.15;
  margin-top: 0;
  position: relative;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
h1 {
  font-size: 2.1rem;
  margin-bottom: 0.5em;
  text-shadow: 0 0 10px #ff6600aa, 0 0 20px #ff660044, 0 0 30px #ff660022;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.8));
}
h2 {
  font-size: 1.25rem;
  margin-bottom: 0.7rem;
  text-shadow: 0 0 8px #ff6600aa, 0 0 15px #ff660033;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.6));
}

/* 6) Buttons & links */
.donate-button{
  background: linear-gradient(90deg, #ff6600 60%, #ffcc00 100%);
  color: #222;
  padding: .7rem 1.2rem;
  border-radius: 10px;
  font-weight: bold;
  text-decoration: none;
  display: inline-block;
  margin-top: 0.5em;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  box-shadow: 0 2px 8px #ff660033;
  border: none;
  position: relative;
  overflow: hidden;
}
.donate-button:hover {
  background: linear-gradient(90deg, #ffcc00 60%, #ff6600 100%);
  color: #18181b;
  box-shadow: 0 4px 16px #ffcc0033;
}
.donate-button:active::after {
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 200%; height: 200%;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  animation: ripple 0.5s linear;
  pointer-events: none;
}
@keyframes ripple { to { transform: translate(-50%, -50%) scale(1); opacity: 0; } }

a {
  position: relative;
  color: var(--link);
  font-weight: 600;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
  transition: color 0.18s;
  z-index: 1;
}
a::after {
  content: "";
  position: absolute; left: 0; bottom: -2px;
  width: 100%; height: 2px;
  background: linear-gradient(90deg, #ff6600, #ffcc00, #66ccff);
  border-radius: 2px;
  transform: scaleX(0);
  transition: transform 0.25s cubic-bezier(.4,0,.2,1);
  z-index: -1;
}
a:hover { color: var(--link-hover); }
a:hover::after { transform: scaleX(1); }

/* 7) Utilities */
footer p{ font-size:.9em; color:var(--muted); text-align:center; margin:.2rem 0; }

.skip-link{ position:absolute; left:-9999px; }
.skip-link:focus{
  left:16px; top:16px; z-index:10000;
  background:var(--card); color:var(--fg);
  padding:.5rem .75rem; border:1px dashed var(--border); border-radius:8px;
}
.sr-only{
  position:absolute !important; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}

/* 8) Components (badge, brand, etc.) */
.lean-badge{ background:var(--bg); color:var(--fg); border:1px dashed var(--border);
  border-radius:14px; padding:1.25rem 1.25rem 1rem; max-width:680px;
  font:13.5px/1.45 ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,"Helvetica Neue",Arial;
  box-shadow:0 1px 0 rgba(255,255,255,.04) inset, 0 6px 18px rgba(0,0,0,.25);
}
.lean-badge .sub{ color:var(--muted); }
/* ...keep your existing badge KPI styles... */

.brand{display:flex;align-items:center;gap:.6rem}
.logo{width:48px;height:48px}
.logo {
      display: inline-flex;
      align-items: center;
      gap: 0.5rem;
      color: #ff6600;
      text-decoration: none;
      font-weight: bold;
      font-size: 1.2rem;
      margin-bottom: 1rem;
    }
    .logo:hover {
      color: #ffcc00;
    }
    .logo svg {
      flex-shrink: 0;
    }
@media (prefers-reduced-motion:no-preference){
  .brand:hover .logo{transform:rotate(-6deg) scale(1.04); transition:transform .2s ease}
}
.screenshot{max-width:100%; height:auto; display:block;}
.img-frame{background:#0f1115; border:1px solid #1b1f24; border-radius:8px; padding:6px;}
.kv{display:grid; grid-template-columns:180px 1fr; gap:.4rem .8rem}
.kv dt{color:var(--muted)} .kv dd{margin:0}
.mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}

.btn{display:inline-block;background:var(--accent);color:#111;border-radius:8px;padding:.5rem .8rem;font-weight:700;text-decoration:none}

/* 9) Mobile */
@media (max-width:600px){
  body{ padding:20px; font-size:1rem; line-height:1.7; }
  header, footer{ text-align:center; }
  h1,h2{ word-break: break-word; }
  a{ display:inline-block; padding:.2rem .25rem; }
  .donate-button{ display:block; text-align:center; margin:1rem auto; }
}

/* 10) Safety */
.bg-white, .white-bg, [style*="background:#fff"], [style*="background: #fff"]{
  background: var(--card) !important; color: var(--fg) !important;
}

p, ul, ol {
  margin-bottom: 1.1em;
  font-size: 1.05em;
}

ul, ol {
  padding-left: 1.4em;
}

.muted, .sub, .meta, .note {
  color: var(--muted);
  font-size: 0.97em;
  font-style: italic;
  letter-spacing: 0.01em;
}
#fake-tor-warning {
  border: 2px solid #f39c12;
  background: var(--card);
  color: var(--fg);
  padding: 1rem;
  border-radius: 12px;
  margin-block: 1.25rem;
}
#fake-tor-warning h2 {
  margin-top: 0;
  color: var(--accent);
  font-size: 1.2rem;
  text-shadow: 0 1px 6px #111, 0 0 1px #ff660033;
}
.feed-status { opacity: .85; font-size: .95rem; }
.feed-status.error { color: #b00020; }
.section-head { display: flex; align-items: center; gap: .5rem; }
.section-head button { padding: .35rem .6rem; border-radius: .5rem; border: 1px solid #ccc; background: #f6f6f6; cursor: pointer; }
.section-head button:hover { background: #eee; }
.feed-list { list-style: none; padding-left: 0; margin: .5rem 0 0; }
.feed-item { margin: .4rem 0; }
.feed-item a { font-weight: 600; }
.feed-item .meta { font-size: .9rem; }

/* Masonry gallery layout */
.masonry{column-width: 260px; column-gap: 12px}
.masonry a{break-inside: avoid; display:block; margin:0 0 12px}
.masonry img{width:100%; height:auto; border-radius:10px; display:block}

/* Hex mark icon */
.hex-mark{
  width:52px;height:52px; display:inline-block;
  background: linear-gradient(135deg,#7b61ff,#00e1ff);
  -webkit-mask: url('/unicursal-hexagram.svg') center/85% no-repeat;
  mask: url('/unicursal-hexagram.svg') center/85% no-repeat;
}