/* benchkit landing page.
   All brand colors live in :root so the palette can be retuned in one place
   once the logo (drafts by Mats, tmp/logos-in-the-making/) is finalized. */

:root {
  /* Navy field, from the logo badge background */
  --bg: #131d33;
  --bg-deep: #0e1626;
  --surface: #1a2946;
  --surface-raised: #213456;
  --line: #2c4066;

  /* Text */
  --text: #f2f5fa;
  --muted: #a4b1c9;

  /* Primary accent: the bright "kit" blue */
  --accent: #2f6fe4;
  --accent-hover: #4a86f0;
  --link: #8db4f8;

  /* Brick accents, used sparingly (studs, chips) */
  --brick-green: #2ca458;
  --brick-red: #de4a2e;
  --brick-yellow: #f2c118;
  --brick-dark: #10131a;

  /* Code sample tokens */
  --code-bg: #101a30;
  --tok-kw: #8db4f8;
  --tok-cls: #f2c118;
  --tok-str: #64c98c;
  --tok-num: #f0975e;
  --tok-arg: #9fb3d4;
  --tok-fn: #7fd4e8;

  --radius: 8px;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, "DejaVu Sans Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

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

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  border-radius: 0 0 var(--radius) var(--radius);
  transition: top 120ms ease;
}

.skip-link:focus {
  top: 0;
}

/* Small monochrome link icons */

.ico {
  width: 1em;
  height: 1em;
  fill: currentColor;
  vertical-align: -0.14em;
  margin-right: 0.45em;
  flex: none;
}

.btn .ico {
  margin-right: 0.5em;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--line);
}

.nav {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.6rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  flex: none;
}

.brand-word {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-kit {
  color: var(--accent-hover);
}

.nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.4rem;
}

.nav-links a {
  color: var(--muted);
  font-weight: 500;
}

.nav-links a:hover {
  color: var(--text);
  text-decoration: none;
}

/* ---------- Layout ---------- */

.section {
  padding: 4.5rem 0;
}

.section-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.section-narrow {
  max-width: 52rem;
}

h1, h2, h3 {
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
}

h2 {
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  font-weight: 800;
}

h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

p {
  margin: 0 0 1rem;
}

.section p:last-child {
  margin-bottom: 0;
}

.section-lead {
  color: var(--muted);
  max-width: 42rem;
  margin-bottom: 2rem;
}

/* Eyebrow with the four logo studs */

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.9rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.studs {
  display: inline-flex;
  gap: 0.3rem;
}

.studs i {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
}

.stud-green  { background: var(--brick-green); }
.stud-red    { background: var(--brick-red); }
.stud-yellow { background: var(--brick-yellow); }
.stud-blue   { background: var(--accent); }
.stud-dark   { background: var(--brick-dark); box-shadow: inset 0 0 0 1px var(--line); }

/* ---------- Hero ---------- */

.hero {
  padding: 4.5rem 0 5rem;
  border-bottom: 1px solid var(--line);
}

.hero-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  align-items: center;
}

.hero h1 {
  font-size: clamp(1.75rem, 4.5vw, 2.7rem);
  font-weight: 800;
  margin-bottom: 1rem;
}

.hl {
  color: var(--accent-hover);
}

.hero-sub {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 34rem;
  margin-bottom: 1.75rem;
}

.install-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  max-width: 100%;
  padding: 0.5rem 0.5rem 0.5rem 1rem;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.install-pill .prompt {
  color: var(--brick-green);
}

.install-pill code {
  white-space: nowrap;
}

.hero-actions,
.cite-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  padding: 0.55rem 1.3rem;
  border-radius: var(--radius);
  font-weight: 600;
  border: 1px solid transparent;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  border-color: var(--line);
  color: var(--text);
  background: transparent;
}

.btn-ghost:hover {
  border-color: var(--accent-hover);
  color: var(--accent-hover);
}

.copy-btn {
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.copy-btn:hover {
  border-color: var(--accent-hover);
  color: var(--accent-hover);
}

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

/* ---------- Code brick (hero signature) ---------- */

.codecard {
  margin: 0.9rem 0 0;
  min-width: 0;
}

.codecard-box {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
}

/* Tabs shaped as small bricks snapped onto the code card, studs molded on top */
.codecard-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 8px;
  padding-left: 14px;
  padding-top: 8px; /* room for the studs above each tab */
}

.codecard-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.9rem;
  background: var(--bg-deep);
  color: var(--muted);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  cursor: pointer;
  margin-bottom: -1px;
}

/* The two studs on top of each tab brick; they inherit the tab's fill */
.codecard-tab::before,
.codecard-tab::after {
  content: "";
  position: absolute;
  top: -8px;
  width: 16px;
  height: 8px;
  background: inherit;
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 5px 5px 0 0;
}

.codecard-tab::before {
  left: 14px;
}

.codecard-tab::after {
  left: 44px;
}

.codecard-tab:hover {
  color: var(--text);
}

/* Narrow screens: the tabs wrap, so stack them like snapped bricks:
   no gap, top brick offset right, the lower brick's studs tucking
   underneath it with one stud left peeking out. The breakpoint sits
   above the widest possible wrap point of the two tabs. */
@media (max-width: 34rem) {
  .codecard-tabs {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }

  .codecard-tab {
    margin-bottom: 0;
  }

  .codecard-tab:last-child {
    margin-bottom: -1px;
  }

  .codecard-tab:first-child {
    margin-left: 32px;
  }

  .codecard-tab:nth-child(2) {
    margin-left: 16px;
  }

  .codecard-tab::before,
  .codecard-tab::after {
    z-index: -1;
  }
}

.codecard-tab[aria-selected="true"] {
  background: var(--surface-raised);
  color: var(--text);
  position: relative;
  z-index: 1;
}

.tab-stud {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  flex: none;
}

.codecard-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 1rem;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--line);
  border-radius: 0 var(--radius) 0 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
}

.codecard pre {
  margin: 0;
  padding: 1.1rem 1.2rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.55;
}

.kw  { color: var(--tok-kw); }
.cls { color: var(--tok-cls); }
.str { color: var(--tok-str); }
.num { color: var(--tok-num); }
.arg { color: var(--tok-arg); }
.fn  { color: var(--tok-fn); }
.cmt { color: var(--muted); font-style: italic; }

/* ---------- Features ---------- */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.1rem;
  margin-top: 1.8rem;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem 1.4rem 1.2rem;
  transition: border-color 140ms ease;
}

.feature-card:hover {
  border-color: var(--accent);
}

.feature-card p {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
}

.feature-stud {
  display: block;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  margin-bottom: 0.9rem;
}

/* ---------- Case studies ---------- */

.case-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

.case-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 140ms ease;
}

.case-card:hover {
  border-color: var(--accent);
}

/* Figures keep their white matplotlib background: present them as framed panels */
.figure-panel {
  background: #fff;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.figure-panel img {
  width: 100%;
  height: auto;
}

.figure-panel-tall {
  flex: 1;
}

.figure-panel-tall img {
  width: auto;
  max-width: 100%;
  max-height: 24rem;
}

.case-body {
  padding: 1.2rem 1.4rem 1.3rem;
}

.case-body p {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 0.9rem;
}

.chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.15rem 0.65rem;
  border-radius: 999px;
  border: 1px solid;
}

.chip-api {
  color: var(--link);
  border-color: var(--accent);
}

.chip-eco {
  color: #74d69c;
  border-color: var(--brick-green);
}

.chip-platform {
  color: var(--muted);
  border-color: var(--line);
}

/* Link to the AE campaign script that produced the figure */
.case-campaign {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  margin: 0.9rem 0 0;
}

.case-link {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

/* ---------- Cite ---------- */

.bibtex-card {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 1.5rem 0;
}

.bibtex-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 1rem;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
}

.bibtex-card pre {
  margin: 0;
  padding: 1.1rem 1.2rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--tok-arg);
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--bg-deep);
  border-top: 1px solid var(--line);
  padding: 3.5rem 0 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

.footer-brand p {
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 20rem;
  margin: 0.6rem 0 0;
}

.footer-col h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 0.7rem;
}

.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-col li {
  margin-bottom: 0.45rem;
  font-size: 0.92rem;
}

/* Keep wrapped link text aligned after the icon */
.footer-col li a {
  display: flex;
}

.footer-col li a .ico {
  margin-top: 0.22em;
}

.footer-bottom {
  margin: 2.5rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Wider screens ---------- */

@media (min-width: 50rem) {
  .case-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .case-wide {
    grid-column: 1 / -1;
  }

  .footer-grid {
    grid-template-columns: 1.4fr 1fr 1.4fr 1fr;
  }
}

@media (min-width: 62rem) {
  .hero-inner {
    grid-template-columns: 1.05fr 1fr;
  }
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  .hero-copy,
  .codecard {
    animation: rise 480ms ease-out both;
  }

  .codecard {
    animation-delay: 90ms;
  }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
