/* Desal Defense — long-form "Learn" articles. Shares tokens with the game (style.css). */
:root {
  --bg: #1a2838;
  --bg-2: #1f2f42;
  --surface: #253850;
  --surface-2: #2b405a;
  --line: rgba(175, 205, 235, 0.16);
  --line-2: rgba(175, 205, 235, 0.3);
  --text: #f0f5f9;
  --body: #d3dfe9;
  --muted: #a7bacb;
  --accent: #35bfe3;
  --accent-ink: #04161f;
  --accent-soft: rgba(53, 191, 227, 0.14);
  --teal: #4fcfa3;
  --gold: #e8c26a;
  --salt: #b98cf0;
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--body);
  font: 17px/1.7 var(--font); -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: #6fd6f0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* top bar */
.topnav {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: rgba(26, 40, 56, 0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.topnav .brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 800; font-size: 15px; }
.topnav .brand img { border-radius: 7px; }
.topnav nav { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.topnav nav a { font-size: 14px; font-weight: 600; text-decoration: none; color: var(--muted); padding: 7px 10px; border-radius: 8px; }
.topnav nav a:hover { color: var(--text); background: rgba(255,255,255,.05); }
.topnav nav a.cta { background: var(--accent); color: var(--accent-ink); padding: 7px 14px; }
.topnav nav a.cta:hover { background: #5ccdec; }
/* link to the same guide in the other language (EN / ES) */
.topnav nav a.lang { font-family: var(--mono, monospace); font-size: 12.5px; border: 1px solid rgba(255,255,255,.18); padding: 5px 9px; }

/* article */
.wrap { max-width: 760px; margin: 0 auto; padding: 40px max(20px, env(safe-area-inset-right)) 80px max(20px, env(safe-area-inset-left)); }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.crumbs a { color: var(--muted); }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--teal); margin: 0 0 10px; }
h1 { margin: 0 0 14px; color: var(--text); font-size: clamp(32px, 5vw, 48px); line-height: 1.1; letter-spacing: -0.03em; font-weight: 800; text-wrap: balance; }
.meta { font-size: 13px; color: var(--muted); margin-bottom: 28px; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.summary {
  margin: 0 0 36px; padding: 18px 20px; border-radius: 12px;
  background: var(--accent-soft); border: 1px solid rgba(53,191,227,.3);
  color: var(--text); font-size: 18px; line-height: 1.65;
}
h2 { margin: 52px 0 12px; color: var(--text); font-size: clamp(23px, 3.2vw, 28px); line-height: 1.25; letter-spacing: -0.02em; font-weight: 800; text-wrap: balance; scroll-margin-top: 80px; }
h3 { margin: 28px 0 8px; color: var(--text); font-size: 19px; font-weight: 700; }
p { margin: 0 0 16px; }
.answer { font-size: 18px; color: var(--text); }
strong { color: var(--text); }
ul, ol { padding-left: 22px; margin: 0 0 18px; }
li { margin-bottom: 8px; }

.analogy {
  display: flex; gap: 14px; align-items: flex-start;
  margin: 22px 0; padding: 16px 18px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line);
}
.analogy .tag { flex: none; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); padding-top: 4px; }
.analogy p { margin: 0; }

figure { margin: 26px 0; }
figure svg { display: block; width: 100%; height: auto; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
figcaption { font-size: 14px; color: var(--muted); margin-top: 8px; }

.table-wrap { overflow-x: auto; margin: 20px 0 24px; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 460px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--bg-2); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }

/* calculator */
.calc { margin: 26px 0; padding: 20px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line-2); }
.calc h3 { margin-top: 0; }
.calc .field { margin-bottom: 16px; }
.calc label { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.calc label output { font-family: var(--mono); color: var(--accent); white-space: nowrap; }
.calc .hint { display: block; font-size: 13px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.calc input[type=range] { width: 100%; accent-color: var(--accent); }
.results { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 10px; margin-top: 18px; }
.res { padding: 12px 14px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.res span { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.res b { display: block; font: 700 22px/1.3 var(--mono); color: var(--text); margin-top: 4px; }
.res small { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.res.hl { border-color: rgba(53,191,227,.5); }
.calc .note { font-size: 13px; color: var(--muted); margin: 14px 0 0; }

.keypoints { margin: 48px 0 0; padding: 20px 22px; border-radius: 12px; background: var(--surface); border-left: 4px solid var(--teal); }
.keypoints h2 { margin-top: 0; font-size: 22px; }
.keypoints ul { margin: 0; }

.faq details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.faq summary { cursor: pointer; color: var(--text); font-weight: 700; font-size: 17px; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::after { content: '+'; color: var(--accent); font-weight: 800; }
.faq details[open] summary::after { content: '−'; }
.faq details p { margin: 10px 0 0; }

.play {
  margin: 48px 0; padding: 22px; border-radius: 14px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center;
  background: linear-gradient(135deg, rgba(53,191,227,.18), rgba(79,207,163,.1)); border: 1px solid rgba(53,191,227,.35);
}
.play h3 { margin: 0 0 4px; }
.play p { margin: 0; font-size: 15px; }
.btn { display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 20px; border-radius: 9px; font-weight: 700; font-size: 15px; text-decoration: none; background: var(--accent); color: var(--accent-ink); white-space: nowrap; }
.btn:hover { background: #5ccdec; color: var(--accent-ink); }

.sources { font-size: 14px; color: var(--muted); }
.sources li { margin-bottom: 6px; }
.footer { text-align: center; font-size: 13px; color: var(--muted); padding: 24px 16px 40px; border-top: 1px solid var(--line); }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .topnav nav a:not(.cta):not(.lang) { display: none; }
  .play { grid-template-columns: 1fr; }
  .analogy { flex-direction: column; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* at-a-glance numbers */
.glance { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: 10px; margin: 0 0 32px; }
.glance div { padding: 12px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.glance b { display: block; font: 700 20px/1.25 var(--mono); color: var(--text); }
.glance span { display: block; font-size: 13px; color: var(--muted); line-height: 1.4; margin-top: 2px; }

/* keep reading: four related guides as a plain list */
.related { margin: 48px 0 0; }
.related ul { list-style: none; padding: 0; margin: 0 0 14px; border-top: 1px solid var(--line); }
.related li { margin: 0; border-bottom: 1px solid var(--line); }
.related li a { display: flex; align-items: baseline; gap: 12px; padding: 13px 4px; text-decoration: none; }
.related li a b { color: var(--text); font-weight: 700; white-space: nowrap; }
.related li a span { color: var(--muted); font-size: 15px; flex: 1; min-width: 0; }
.related li a::after { content: '→'; color: var(--accent); margin-left: auto; transition: transform .15s; }
.related li a:hover b { color: var(--accent); }
.related li a:hover::after { transform: translateX(3px); }
.related .all-guides { font-size: 14px; font-weight: 600; text-decoration: none; }
@media (max-width: 560px) {
  .related li a { flex-wrap: wrap; gap: 2px 12px; }
  .related li a b { white-space: normal; flex: 1 1 auto; }
  .related li a span { flex-basis: 100%; order: 3; font-size: 14px; }
}

