/* Science Founders — single-page app stylesheet */

:root {
  /* Neutral palette */
  --bg: #ffffff;
  --bg-muted: #f5f6f7;
  --text: #1d1d1d;
  --text-muted: #626a72;
  --text-dim: #33383f;
  --border: #e6e6e6;
  --accent: #1d1d1d;
  --accent-contrast: #ffffff;
  --link: #2A67B1;

  /* reNature brand palette */
  --color-cherry:          #CC3728;
  --color-arizona-sunset:  #E86C2D;
  --color-sunflower:       #F6D32B;
  --color-spring-leaves:   #009A49;
  --color-ocean-breeze:    #2A67B1;
  --color-royalty:         #5F337B;
  --color-simple-gray:     #9F9FA3;
  --color-eternity:        #000000;

  /* Semantic aliases pointing at the brand palette */
  --color-ok:    var(--color-spring-leaves);
  --color-warn:  var(--color-arizona-sunset);
  --color-err:   var(--color-cherry);

  --max: 1140px;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 12px rgba(0,0,0,.04);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

/* The `hidden` attribute must always win — many of our display:flex/grid
   rules would otherwise override the UA `display: none`. */
[hidden] { display: none !important; }

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

.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

.container.narrow { max-width: 720px; }

.muted { color: var(--text-muted); }
.small { font-size: 14px; }

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  height: 64px;
  gap: 24px;
}

.brand {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  font-size: 16px;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }

.nav-search {
  flex: 0 1 320px;
  margin: 0;
}
.nav-search-input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--bg-muted);
  background-color: var(--bg-muted);
  background-image: url("/assets/svg/search.svg");
  background-position: 10px center;
  background-repeat: no-repeat;
  background-size: 16px;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
}
.nav-search-input::placeholder { color: var(--text-muted); }
.nav-search-input:focus {
  outline: none;
  border-color: var(--text-dim);
  background-color: #fff;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-left: auto;
}
.nav-links a {
  color: var(--text);
  font-weight: 500;
  font-size: 15px;
  padding: 8px 0;
}
.nav-links a[aria-current="page"] { text-decoration: underline; text-underline-offset: 4px; }

.nav-toggle {
  display: none;
  background: none;
  border: 0;
  padding: 6px;
  cursor: pointer;
  margin-left: auto;
}

.guides-empty {
  color: var(--text-muted);
  font-style: italic;
  margin: 8px 0 24px;
}

.badge-soon {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff3d6;
  color: #6b4900;
  border: 1px solid #f0c97c;
  margin-left: 8px;
  vertical-align: middle;
}
.guide-card--soon .guide-thumb { opacity: 0.92; }
.link-button {
  background: none;
  border: 0;
  padding: 0;
  margin-left: 6px;
  font: inherit;
  font-style: normal;
  color: var(--link);
  text-decoration: underline;
  cursor: pointer;
}
.link-button:hover { text-decoration: none; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 22px;
  font: inherit;
  font-weight: 500;
  font-size: 15px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 80ms ease, background-color 120ms ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}
.btn-primary:hover { background: #000; }

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

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.link-arrow {
  display: inline-block;
  margin-top: 8px;
  font-weight: 500;
}

/* ---------- Views (router toggles [hidden]) ---------- */

.view { padding: 56px 0 72px; }
.view[hidden] { display: none; }

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

.hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 48px;
  align-items: center;
  padding-top: 24px;
  padding-bottom: 64px;
}

.hero-text h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.15;
  margin: 0 0 18px;
}

.lead {
  font-size: 18px;
  color: var(--text);
}

.hero-illustration img {
  max-height: 480px;
  margin: 0 auto;
}

/* ---------- Section variants ---------- */

.section { padding: 64px 0; }
.section-muted { background: var(--bg-muted); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.section h2 { font-size: 28px; margin: 0 0 24px; }

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 8px; font-size: 18px; }
.card p { margin: 0 0 12px; color: var(--text-muted); }

/* ---------- Page header ---------- */

.page-header {
  padding-bottom: 24px;
}
.page-header h1 {
  font-size: clamp(2rem, 3.6vw, 2.75rem);
  margin: 0 0 12px;
}

/* ---------- Principles two-col ---------- */

.two-col {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 56px;
  align-items: start;
}

.prose h3 {
  font-size: 20px;
  margin: 32px 0 8px;
}
.prose p, .prose blockquote { margin: 12px 0; }
.prose blockquote {
  border-left: 3px solid var(--border);
  padding: 8px 16px;
  color: var(--text-muted);
  font-style: italic;
}

.principles-art {
  position: sticky;
  top: 96px;
}
.principles-art img { width: 100%; max-width: 380px; margin: 0 auto; }

/* ---------- About / Team ---------- */

.team-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
  margin-top: 32px;
}

.team-card img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 50%;
  margin: 0 0 16px;
  border: 1px solid var(--border);
}
.team-card h4 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
}
.team-card p { color: var(--text); margin: 0 0 12px; }

/* ---------- Guides ---------- */

.guides-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}
.guide-card { display: flex; flex-direction: column; }
.guide-thumb {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-muted);
}
.guide-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.guide-byline {
  margin: 12px 0 4px;
  font-size: 14px;
  color: var(--text-muted);
}
.guide-title { text-decoration: none; color: var(--text); }
.guide-title:hover { text-decoration: none; }
.guide-title:hover h3 { text-decoration: underline; }
.guide-title h3 {
  font-size: 20px;
  line-height: 1.3;
  margin: 0 0 12px;
}
.guide-desc {
  color: var(--text);
  margin: 0 0 12px;
}

/* ---------- Stats grid (track-record callout) ---------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin: 40px 0;
}
.stat-num {
  font-size: 48px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.stat-num--yellow { color: var(--color-sunflower); }
.stat-num--green  { color: var(--color-spring-leaves); }
.stat-num--orange { color: var(--color-arizona-sunset); }
.stat-num--red    { color: var(--color-cherry); }
.stat-num--blue   { color: var(--color-ocean-breeze); }
.stat-num--purple { color: var(--color-royalty); }
.stat-label {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.45;
}

@media (max-width: 720px) {
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    margin: 24px 0;
  }
  .stat-num { font-size: 40px; }
}

/* ---------- Guide detail page ---------- */

.view-guide .page-header { padding-bottom: 16px; }
.view-guide .prose h2 {
  font-size: 24px;
  margin: 40px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* Long-form pandoc-rendered guides (e.g. The $500 Founder Guide) */
.long-prose ul, .long-prose ol { margin: 12px 0; padding-left: 22px; }
.long-prose li { margin: 6px 0; }
.long-prose li > ul, .long-prose li > ol { margin: 4px 0; }

.long-prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

.long-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: 15px;
}
.long-prose thead th {
  text-align: left;
  font-weight: 600;
  border-bottom: 1.5px solid var(--text-dim);
  padding: 8px 12px;
  background: var(--bg-muted);
}
.long-prose tbody td {
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  vertical-align: top;
}
.long-prose th[style*="text-align: right"],
.long-prose td[style*="text-align: right"] { text-align: right; }

.long-prose pre {
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
  margin: 12px 0 20px;
}
.long-prose code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
}
.long-prose p > code, .long-prose li > code {
  background: var(--bg-muted);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.long-prose pre code {
  background: transparent;
  padding: 0;
  border: 0;
}

.doc-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
}
.doc-list li {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin: 0 0 8px;
  padding: 0;
  background: transparent;
  border: 0;
}
.doc-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.doc-row:hover { background: var(--bg-muted); }
.doc-row a {
  font-weight: 500;
  color: var(--text);
}
.doc-meta {
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.link-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-shrink: 0;
  white-space: nowrap;
  cursor: help;
  min-width: 200px;
  justify-content: flex-start;
}
.link-status::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.link-status--ok::before   { background: #1f7a3a; }
.link-status--warn::before { background: #b8860b; }
.link-status--err::before  { background: #c0392b; }

@media (max-width: 720px) {
  .doc-list li { flex-direction: column; }
  .link-status { min-width: 0; align-self: flex-start; }
}

/* ---------- Join form ---------- */

.form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 24px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; }
.field label, .field legend {
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
}
.req { color: #c0392b; margin-left: 2px; }

.field input:not([type="radio"]):not([type="checkbox"]),
.field textarea {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  width: 100%;
}
.field input:not([type="radio"]):not([type="checkbox"]):focus,
.field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 8px;
}
.radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  cursor: pointer;
  user-select: none;
}
.radio input[type="radio"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.cf-turnstile { min-height: 65px; }

#join-submit { align-self: flex-start; }

.form-message {
  margin: 0;
  font-size: 14px;
  min-height: 22px;
}
.form-message.is-ok { color: #1f7a3a; }
.form-message.is-err { color: #c0392b; }

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

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-muted);
  padding: 48px 0;
  margin-top: 32px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
}
.footer-grid h5 {
  margin: 0 0 12px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.footer-grid a {
  display: block;
  color: var(--text);
  padding: 4px 0;
}
.brand-footer {
  display: inline-block;
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
  margin-bottom: 16px;
}
.brand-footer:hover { text-decoration: none; }
.site-footer address {
  font-style: normal;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ---------- Mobile ---------- */

/* Tablet: hero stacks, multi-column grids collapse, search bar shrinks */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-bottom: 32px; }
  .hero-illustration { order: -1; }
  .hero-illustration img { max-height: 320px; }

  .two-col { grid-template-columns: 1fr; gap: 32px; }
  .principles-art { position: static; }
  .principles-art img { max-width: 280px; }

  .grid-3 { grid-template-columns: 1fr; }
  .guides-grid { grid-template-columns: 1fr; }
  .team-grid { grid-template-columns: 1fr; }

  /* Footer: 2x2 on tablet — brand block spans the full first row, the
     three link columns sit on the second row. */
  .footer-grid {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 24px 32px;
  }
  .footer-grid > :first-child { grid-column: 1 / -1; }

  .nav-search { flex-basis: 180px; }
}

/* Phone: stack the nav, hide the in-nav search (use /guides search there
   if needed), single-column footer, single-column form. */
@media (max-width: 720px) {
  .nav { gap: 12px; }
  .nav-search { display: none; }
  .nav-toggle { display: inline-flex; margin-left: auto; }
  .nav-links {
    position: absolute;
    top: 64px;
    left: 0; right: 0;
    background: #fff;
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 24px 16px;
    display: none;
    margin-left: 0;
  }
  .nav-links.is-open { display: flex; }
  .nav-links.is-open::before {
    content: "";
    display: block;
    margin-bottom: 8px;
  }
  .nav-links a { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .nav-links a:last-child { border-bottom: 0; }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .footer-grid > :first-child { grid-column: auto; }

  .form-row { grid-template-columns: 1fr; }

  /* Tighten typography a touch on phones */
  .hero-text h1 { font-size: clamp(1.6rem, 7vw, 2.2rem); }
  .container { padding: 0 18px; }
}
