/* ═══════════════════════════════════════════════════════════
   TechLedger.ai — Global Styles
   Typography: DM Serif Display + DM Sans
   Palette: Dark ink, slate, dark green accent (ledger books)
   ═══════════════════════════════════════════════════════════ */

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

:root {
  --ink: #0f1117;
  --ink-deep: #0a0c10;
  --slate: #2c3147;
  --mid: #5a617a;
  --muted: #9299b0;
  --rule: #dde1ed;
  --bg: #f5f6fa;
  --bg-warm: #f0f1f5;
  --white: #ffffff;
  --accent: #1a56db;
  --accent-light: #e8effe;
  --green: #1a5c3a;
  --green-deep: #145030;
  --green-light: #e6f4ee;
  --green-glow: #2a8c5a;
  --green-muted: #3a7a58;
  --red-soft: #b03030;

  --font-display: 'DM Serif Display', 'Georgia', serif;
  --font-body: 'DM Sans', 'Helvetica Neue', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --radius: 6px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.14);

  --page-max: 1140px;
  --nav-height: 64px;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--white);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ── TYPOGRAPHY ── */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 { font-size: 2.8rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.15rem; }

p { max-width: 65ch; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover { color: var(--green); }

/* ── LAYOUT ── */

.container {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 2rem;
}

.section {
  padding: 5rem 0;
}

.section--dark {
  background: var(--ink);
  color: var(--white);
}

.section--gray {
  background: var(--bg);
}

.section--green {
  background: var(--green-deep);
  color: var(--white);
}

/* ── NAVIGATION ── */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(15, 17, 23, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  transition: box-shadow 0.3s;
}

.nav.scrolled {
  box-shadow: 0 2px 20px rgba(0,0,0,0.3);
}

.nav__inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 2rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__logo {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--white);
  text-decoration: none;
  letter-spacing: -0.02em;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.nav__logo .tld {
  color: var(--green-glow);
}

.nav__logo:hover { color: var(--white); }

.nav__tag {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-left: 1px solid #3a3f55;
  padding-left: 0.6rem;
  display: none;
}

@media (min-width: 768px) {
  .nav__tag { display: block; }
}

.nav__links {
  display: none;
  list-style: none;
  gap: 0.2rem;
  align-items: center;
}

@media (min-width: 900px) {
  .nav__links { display: flex; }
}

.nav__links a {
  font-size: 0.85rem;
  font-weight: 400;
  color: #9299b0;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  transition: color 0.2s, background 0.2s;
  text-decoration: none;
}

.nav__links a:hover {
  color: var(--white);
  background: rgba(255,255,255,0.06);
}

.nav__links a.active {
  color: var(--white);
}

.nav__cta {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--white) !important;
  background: var(--green);
  padding: 0.45rem 1.1rem !important;
  border-radius: var(--radius) !important;
  transition: background 0.2s !important;
}

.nav__cta:hover {
  background: var(--green-glow) !important;
  color: var(--white) !important;
}

/* Mobile hamburger */
.nav__hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
  background: none;
  border: none;
}

@media (min-width: 900px) {
  .nav__hamburger { display: none; }
}

.nav__hamburger span {
  width: 22px;
  height: 2px;
  background: var(--muted);
  border-radius: 1px;
  transition: transform 0.3s, opacity 0.3s;
}

.nav__hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__hamburger.open span:nth-child(2) { opacity: 0; }
.nav__hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav__mobile {
  display: none;
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  background: rgba(15, 17, 23, 0.98);
  backdrop-filter: blur(12px);
  padding: 1rem 2rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  z-index: 999;
}

.nav__mobile.open { display: block; }

.nav__mobile a {
  display: block;
  font-size: 0.95rem;
  color: #9299b0;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  text-decoration: none;
}

.nav__mobile a:hover { color: var(--white); }

.nav__mobile .nav__cta {
  display: inline-block;
  margin-top: 0.8rem;
}

/* ── HERO ── */

.hero {
  padding: 8rem 0 5rem;
  background: var(--ink);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -100px;
  right: -150px;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(26,92,58,0.15) 0%, transparent 70%);
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--green) 0%, var(--accent) 60%, transparent 100%);
}

.hero__label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green-glow);
  margin-bottom: 1.2rem;
  display: inline-block;
}

.hero h1 {
  color: var(--white);
  max-width: 720px;
  margin-bottom: 1.2rem;
  font-size: clamp(2rem, 5vw, 3rem);
}

.hero h1 em {
  font-style: italic;
  color: #8ab8a0;
}

.hero__sub {
  font-size: 1.1rem;
  color: #9299b0;
  font-weight: 300;
  max-width: 560px;
  line-height: 1.7;
  margin-bottom: 2rem;
}

.hero__actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ── BUTTONS ── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.7rem 1.6rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn--primary {
  background: var(--green);
  color: var(--white);
}

.btn--primary:hover {
  background: var(--green-glow);
  color: var(--white);
}

.btn--outline {
  background: transparent;
  color: var(--white);
  border: 1px solid rgba(255,255,255,0.2);
}

.btn--outline:hover {
  border-color: rgba(255,255,255,0.5);
  color: var(--white);
}

.btn--dark {
  background: var(--ink);
  color: var(--white);
}

.btn--dark:hover {
  background: var(--slate);
  color: var(--white);
}

/* ── CARDS ── */

.card {
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: box-shadow 0.25s, transform 0.25s;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card__icon {
  width: 40px;
  height: 40px;
  background: var(--green-light);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.card__icon svg {
  width: 20px;
  height: 20px;
  stroke: var(--green);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card h3 {
  margin-bottom: 0.5rem;
  color: var(--slate);
}

.card p {
  font-size: 0.92rem;
  color: var(--mid);
  line-height: 1.65;
}

/* ── GRID UTILITIES ── */

.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

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

@media (min-width: 768px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
}

/* ── SECTION HEADERS ── */

.section__label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 0.8rem;
}

.section--dark .section__label { color: var(--green-glow); }

.section__heading {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  color: var(--slate);
  margin-bottom: 1rem;
  max-width: 600px;
}

.section--dark .section__heading { color: var(--white); }

.section__desc {
  font-size: 1rem;
  color: var(--mid);
  max-width: 560px;
  line-height: 1.7;
  margin-bottom: 2.5rem;
}

.section--dark .section__desc { color: #9299b0; }

/* ── CALLOUT ── */

.callout {
  background: var(--white);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--green);
  border-radius: var(--radius);
  padding: 1.5rem 1.8rem;
}

.callout p {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--slate);
  line-height: 1.55;
  max-width: none;
}

/* ── SCENARIO CARDS ── */

.scenario {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.scenario__label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.scenario__label--bad { color: var(--red-soft); }
.scenario__label--good { color: var(--green); }

.scenario p {
  font-size: 0.92rem;
  color: var(--mid);
  line-height: 1.6;
}

/* ── WHY LIST ── */

.why-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.why-list li {
  font-size: 0.95rem;
  color: var(--mid);
  padding-left: 1.5rem;
  position: relative;
  line-height: 1.6;
}

.why-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--green);
  font-weight: 600;
}

/* ── CHECK LIST ── */

.check-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.check-list li {
  font-size: 0.95rem;
  color: var(--mid);
  padding-left: 1.5rem;
  position: relative;
  line-height: 1.55;
}

.check-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--green);
  font-weight: 700;
  font-size: 0.85rem;
}

/* ── FOOTER ── */

.footer {
  background: var(--ink-deep);
  padding: 3rem 0 2rem;
  border-top: 1px solid rgba(255,255,255,0.04);
}

.footer__inner {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .footer__inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: start;
  }
}

.footer__brand {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--white);
  margin-bottom: 0.5rem;
}

.footer__brand .tld { color: var(--green-glow); }

.footer__tagline {
  font-size: 0.8rem;
  color: #4a5070;
  margin-top: 0.3rem;
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer__links a {
  font-size: 0.82rem;
  color: #6a7094;
  text-decoration: none;
  transition: color 0.2s;
}

.footer__links a:hover { color: var(--white); }

.footer__bottom {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.04);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

@media (min-width: 768px) {
  .footer__bottom {
    flex-direction: row;
    justify-content: space-between;
  }
}

.footer__copy {
  font-size: 0.75rem;
  color: #3a4060;
}

.footer__cert {
  font-size: 0.75rem;
  color: #3a4060;
  font-style: italic;
}

/* ── PAGE HEADER (for inner pages) ── */

.page-header {
  padding: 7rem 0 3rem;
  background: var(--ink);
  position: relative;
}

.page-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--green) 0%, var(--accent) 60%, transparent 100%);
}

.page-header h1 {
  color: var(--white);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin-bottom: 0.6rem;
}

.page-header p {
  color: #9299b0;
  font-size: 1rem;
  font-weight: 300;
  max-width: 520px;
}

/* ── PLACEHOLDER PAGE ── */

.placeholder {
  text-align: center;
  padding: 6rem 0;
}

.placeholder__icon {
  width: 64px;
  height: 64px;
  background: var(--green-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
}

.placeholder__icon svg {
  width: 28px;
  height: 28px;
  stroke: var(--green);
  fill: none;
  stroke-width: 1.5;
}

.placeholder h2 {
  color: var(--slate);
  margin-bottom: 0.8rem;
}

.placeholder p {
  color: var(--mid);
  margin: 0 auto;
}

/* ── ANIMATIONS ── */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-up {
  opacity: 0;
  animation: fadeUp 0.6s ease forwards;
}

.fade-up--d1 { animation-delay: 0.1s; }
.fade-up--d2 { animation-delay: 0.2s; }
.fade-up--d3 { animation-delay: 0.3s; }
.fade-up--d4 { animation-delay: 0.4s; }

/* ── FORM EMBED ── */

.form-container {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 600px;
}

.form-container iframe {
  width: 100%;
  min-height: 600px;
  border: none;
}

/* ── DEMO SHOWCASE ── */

.demo-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.demo-nav__btn {
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--white);
  color: var(--mid);
  cursor: pointer;
  transition: all 0.2s;
}

.demo-nav__btn:hover {
  border-color: var(--green);
  color: var(--green);
}

.demo-nav__btn.active {
  background: var(--green);
  color: var(--white);
  border-color: var(--green);
}

.demo-panel {
  display: none;
}

.demo-panel.active {
  display: block;
}

.demo-panel__frame {
  width: 100%;
  height: 80vh;
  min-height: 600px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.demo-panel__frame iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.md-render {
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 2rem 2.5rem;
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--slate);
  max-height: 70vh;
  overflow-y: auto;
}

.md-render h1 { font-size: 1.5rem; margin-bottom: 1rem; border-bottom: 2px solid var(--rule); padding-bottom: 0.5rem; }
.md-render h2 { font-size: 1.15rem; margin: 1.5rem 0 0.6rem; color: var(--green-deep); }
.md-render h3 { font-size: 1rem; margin: 1rem 0 0.5rem; }
.md-render p { margin-bottom: 0.8rem; max-width: none; }
.md-render strong { color: var(--ink); }
.md-render code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: var(--bg);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  color: var(--green-deep);
}

.md-render table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.82rem;
}

.md-render th, .md-render td {
  text-align: left;
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--rule);
}

.md-render th {
  font-weight: 600;
  color: var(--ink);
  background: var(--bg);
  position: sticky;
  top: 0;
}

.md-render td { color: var(--mid); }
.md-render td code { font-size: 0.78rem; }

.md-render a {
  color: var(--accent);
  cursor: pointer;
}

.md-render ul, .md-render ol {
  padding-left: 1.5rem;
  margin-bottom: 0.8rem;
}

.md-render li {
  margin-bottom: 0.3rem;
}

/* Module sidebar for demo */
.demo-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.5rem;
  min-height: 60vh;
}

@media (max-width: 768px) {
  .demo-layout {
    grid-template-columns: 1fr;
  }
}

.demo-sidebar {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 1rem;
  max-height: 70vh;
  overflow-y: auto;
}

.demo-sidebar__title {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 0.6rem;
  padding: 0 0.5rem;
}

.demo-sidebar a {
  display: block;
  font-size: 0.84rem;
  color: var(--mid);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: all 0.15s;
}

.demo-sidebar a:hover {
  background: var(--white);
  color: var(--green);
}

.demo-sidebar a.active {
  background: var(--green);
  color: var(--white);
}

.demo-content {
  min-height: 400px;
}

/* JSON viewer */
.json-render {
  background: #1a1d2b;
  border: 1px solid #2a2e42;
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.6;
  color: #e8eaf0;
  max-height: 70vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── LEGAL PAGES ── */

.legal {
  padding: 2rem 0 4rem;
}

.legal h2 {
  font-size: 1.3rem;
  margin: 2rem 0 0.8rem;
  color: var(--slate);
}

.legal h3 {
  font-size: 1.05rem;
  margin: 1.5rem 0 0.5rem;
  color: var(--slate);
}

.legal p {
  font-size: 0.92rem;
  color: var(--mid);
  margin-bottom: 0.8rem;
  max-width: none;
  line-height: 1.7;
}

.legal ul {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.legal li {
  font-size: 0.92rem;
  color: var(--mid);
  margin-bottom: 0.4rem;
  line-height: 1.6;
}

/* ── STATS BAR ── */

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  padding: 2rem 0;
}

@media (min-width: 768px) {
  .stats { grid-template-columns: repeat(4, 1fr); }
}

.stat {
  text-align: center;
}

.stat__number {
  font-family: var(--font-display);
  font-size: 2.2rem;
  color: var(--green-glow);
  line-height: 1;
  margin-bottom: 0.3rem;
}

.section--dark .stat__number { color: var(--green-glow); }

.stat__label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 400;
}

/* ── RESEARCH BLOCK ── */

.research {
  border-left: 3px solid var(--green);
  padding-left: 1.5rem;
  margin: 1.5rem 0;
}

.research p {
  font-size: 0.9rem;
  color: var(--mid);
  line-height: 1.7;
}

.research em {
  color: var(--slate);
  font-weight: 500;
}

/* ── TIMELINE ── */

.timeline {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.timeline__item {
  display: flex;
  gap: 1rem;
  align-items: start;
}

.timeline__marker {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  margin-top: 0.4rem;
  flex-shrink: 0;
}

.timeline__text strong {
  display: block;
  font-size: 0.9rem;
  color: var(--slate);
  margin-bottom: 0.15rem;
}

.timeline__text span {
  font-size: 0.85rem;
  color: var(--mid);
}
