/* ── Atlas — comparative genomics tool hub ─────────────────────
   EvoGenome Lab. Theme aligned with evogeno.me design tokens. */

:root {
  color-scheme: dark;
  --bg: #0a0a0a;
  --bg-deep: #060608;
  --surface: #111114;
  --surface-hover: #16161a;
  --text: #f2f2ea;
  --muted: #b8b8ae;
  --accent: #7fe0c8;
  --accent-dim: rgba(127, 224, 200, 0.35);
  --accent-bright: rgba(127, 224, 200, 0.8);
  --accent-glow: rgba(127, 224, 200, 0.12);
  --violet: #a78bfa;
  --violet-dim: rgba(167, 139, 250, 0.25);
  --violet-glow: rgba(167, 139, 250, 0.15);
  --rule: #1f2329;
  --max-width: 1040px;
  --nav-height: 56px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", "Helvetica Neue", sans-serif;
  font-weight: 300;
  line-height: 1.6;
  letter-spacing: 0.1px;
  overflow-x: hidden;
}

/* Subtle noise texture overlay for depth */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-dim);
  transition: border-color 0.3s, color 0.3s;
}
a:hover, a:focus { border-bottom-color: var(--accent-bright); }

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3 {
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-weight: 400;
  line-height: 1.25;
}
h1 {
  font-family: "Jost", "Futura", "IBM Plex Sans", sans-serif;
  font-size: clamp(2.2rem, 5.5vw, 3.4rem);
  font-weight: 500;
  letter-spacing: 0.5px;
  margin: 0 0 0.4em;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: var(--bg);
  padding: 0.5rem 1rem;
  z-index: 10000;
  border: none;
}
.skip-link:focus { left: 0; }

/* ── Top bar ─────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1rem, 4vw, 2.5rem);
  background: rgba(10, 10, 10, 0.72);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.brand {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.95rem;
  letter-spacing: 1.5px;
  text-transform: lowercase;
  color: var(--text);
  border: none;
  display: flex;
  align-items: baseline;
  gap: 0.5ch;
}
.brand .mark { color: var(--accent); }
.brand .sep { color: var(--rule); }
.topbar nav a {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  color: var(--muted);
  border: none;
  margin-left: 1.5rem;
}
.topbar nav a:hover { color: var(--accent); }

/* ── Layout shell ────────────────────────────────────────── */
.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2.5rem);
}

/* ── Hero ────────────────────────────────────────────────── */
.hero {
  padding: clamp(3.5rem, 9vw, 6.5rem) 0 clamp(2rem, 5vw, 3.5rem);
  border-bottom: 1px solid var(--rule);
  position: relative;
}
.hero .eyebrow {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1.2rem;
}
.hero p.lede {
  max-width: 60ch;
  font-size: clamp(1.05rem, 2.2vw, 1.25rem);
  color: var(--muted);
  margin: 0.4rem 0 0;
}

/* ── Section heading ─────────────────────────────────────── */
.section { padding: clamp(2.5rem, 6vw, 4rem) 0; }
.section > h2 {
  font-size: 1rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1.8rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.section > h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

/* ── Tool cards ──────────────────────────────────────────── */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}
.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 1.5rem 1.5rem 1.4rem;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease;
  overflow: hidden;
}
.tool-card:not(.disabled):hover {
  transform: translateY(-3px);
  background: var(--surface-hover);
  border-color: var(--accent-dim);
}
.tool-card .tag {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.9rem;
}
.tool-card h3 {
  font-size: 1.15rem;
  margin: 0 0 0.55rem;
  color: var(--text);
}
.tool-card p {
  font-size: 0.92rem;
  color: var(--muted);
  margin: 0;
  flex: 1;
}
.tool-card .go {
  margin-top: 1.2rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 0.4ch;
}
.tool-card.disabled {
  border-style: dashed;
  opacity: 0.6;
  cursor: default;
}
.tool-card.disabled .tag { color: var(--violet); }
.tool-card.disabled .go { color: var(--muted); }
.tool-card .thumb {
  margin: -1.5rem -1.5rem 1.3rem;
  height: 132px;
  background:
    radial-gradient(circle at 30% 35%, var(--accent-glow), transparent 55%),
    radial-gradient(circle at 72% 70%, var(--violet-glow), transparent 55%),
    var(--bg-deep);
  border-bottom: 1px solid var(--rule);
  position: relative;
  overflow: hidden;
}
.tool-card .thumb svg { width: 100%; height: 100%; display: block; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5ch;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.88rem;
  letter-spacing: 0.5px;
  padding: 0.7rem 1.3rem;
  border-radius: 8px;
  border: 1px solid var(--accent-dim);
  background: var(--accent-glow);
  color: var(--accent);
  cursor: pointer;
  transition: background 0.25s, border-color 0.25s, color 0.25s;
}
.btn:hover { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn.secondary {
  background: transparent;
  border-color: var(--rule);
  color: var(--muted);
}
.btn.secondary:hover { color: var(--text); border-color: var(--muted); background: var(--surface); }

/* ── Tool detail page ────────────────────────────────────── */
.breadcrumb {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin: 0;
}
.breadcrumb a { border: none; color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }

.detail-head { padding: clamp(2.5rem, 7vw, 4.5rem) 0 clamp(1.5rem, 4vw, 2.5rem); }
.detail-head .tag {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  margin: 1.4rem 0 0.8rem;
}
.detail-head h1 { font-size: clamp(1.8rem, 4.5vw, 2.7rem); }
.detail-head p.lede {
  max-width: 70ch;
  font-size: 1.08rem;
  color: var(--muted);
  margin: 0.6rem 0 0;
}
.actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin: 1.8rem 0 0; }

.content { display: grid; grid-template-columns: 1fr; gap: 2.5rem; padding-bottom: 4rem; }
@media (min-width: 820px) {
  .content { grid-template-columns: 1.6fr 1fr; }
}
.prose h2 {
  font-size: 0.95rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 2rem 0 0.8rem;
}
.prose h2:first-child { margin-top: 0; }
.prose p { color: var(--text); margin: 0 0 1rem; }
.prose ul { color: var(--text); padding-left: 1.2rem; margin: 0 0 1rem; }
.prose li { margin: 0.4rem 0; }
.prose strong { color: var(--text); font-weight: 500; }

.aside {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 1.5rem;
  align-self: start;
}
.aside h3 {
  font-size: 0.8rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.9rem;
}
.aside .cite {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 1rem;
}
.aside .cite .title { color: var(--text); font-style: italic; }
.aside dl { margin: 0; font-size: 0.88rem; }
.aside dt {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.9rem;
}
.aside dd { margin: 0.15rem 0 0; color: var(--text); }
.aside code {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  color: var(--accent);
  background: var(--bg-deep);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

/* Embedded viewer */
.viewer-frame {
  width: 100%;
  height: min(78vh, 820px);
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--bg-deep);
  margin: 1.5rem 0 0;
}
.viewer-note {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0.7rem 0 0;
}

/* ── Full-bleed app layout: the viewer IS the page ───────────
   Thin sticky top bar, the iframe fills the rest of the viewport
   edge-to-edge (no card, no border) so it reads as integrated. */
html, body { height: 100%; }
body.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}
body.app .topbar { flex: 0 0 var(--nav-height); }
.topbar-left {
  display: flex;
  align-items: baseline;
  gap: 1.1rem;
  min-width: 0;
}
/* Lab brand — matches the .nav-brand styling on evogeno.me for
   consistent branding across the lab site. */
.lab-brand {
  font-family: "Jost", "Futura", sans-serif;
  font-size: 0.95rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: var(--text);
  border-bottom: none;
  white-space: nowrap;
}
.lab-brand:hover { color: var(--accent); border-bottom: none; }
.topbar-sep { color: var(--rule); }
.topbar-title {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.viewer-full {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  border: 0;
  display: block;
  background: var(--bg-deep);
}

/* Prominent "Light mode" CTA in the top bar (high specificity to beat the
   muted .topbar nav a default). */
.topbar nav a.topbar-cta {
  color: var(--bg);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 7px;
  padding: 6px 14px;
  margin-left: 1.5rem;
  font-weight: 500;
  box-shadow: 0 0 0 0 var(--accent-glow);
  transition: background 0.2s, box-shadow 0.2s, color 0.2s;
}
.topbar nav a.topbar-cta:hover,
.topbar nav a.topbar-cta:focus {
  color: var(--bg);
  background: var(--accent-bright);
  box-shadow: 0 0 16px var(--accent-glow);
}

/* Secondary "How to use" toggle */
.topbar-help {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 5px 10px;
  margin-left: 1.5rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.topbar-help:hover { color: var(--accent); border-color: var(--accent-dim); }

/* How-to guide strip below the top bar */
.guide {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 9px clamp(1rem, 4vw, 2.5rem);
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
}
.guide.hidden { display: none; }
.guide-icon { flex: 0 0 auto; color: var(--accent); line-height: 0; }
.guide-icon svg { width: 30px; height: 30px; display: block; }
.guide-text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 3px 18px;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.45;
}
.guide-text strong {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
}
.guide-text b { color: var(--text); font-weight: 500; }
.guide-close {
  flex: 0 0 auto;
  margin-left: auto;
  align-self: flex-start;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--muted);
  border-radius: 6px;
  width: 26px;
  height: 26px;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.guide-close:hover { color: var(--accent); border-color: var(--accent-dim); }

@media (max-width: 680px) {
  .topbar-title { display: none; }
  .topbar-help { display: none; }
  .guide { gap: 10px; padding: 8px 1rem; }
  .guide-text { font-size: 0.78rem; gap: 2px 12px; }
}

/* ── Footer ──────────────────────────────────────────────── */
.foot {
  border-top: 1px solid var(--rule);
  padding: 2.5rem 0 3.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.foot .wrap { display: flex; flex-wrap: wrap; gap: 0.6rem 1.5rem; align-items: center; justify-content: space-between; }
.foot a { color: var(--muted); border: none; }
.foot a:hover { color: var(--accent); }
.foot .mono { font-family: "IBM Plex Mono", monospace; font-size: 0.78rem; letter-spacing: 0.5px; }
