/* ============================================================
   CivilCalc Pro — Professional Minimal Dark UI
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,400;14..32,500;14..32,600;14..32,700;14..32,800&display=swap');

/* ---- Custom properties ---- */
:root {
  --bg:          #09090b;
  --surface:     #111113;
  --surface-2:   #1c1c1f;
  --surface-3:   #27272a;
  --border:      rgba(255, 255, 255, 0.07);
  --border-mid:  rgba(255, 255, 255, 0.11);
  --border-hi:   rgba(255, 255, 255, 0.18);

  --text:        #fafafa;
  --text-2:      #a1a1aa;
  --text-3:      #71717a;

  --accent:      #22c55e;
  --accent-h:    #16a34a;
  --accent-dim:  rgba(34, 197, 94, 0.08);
  --accent-bord: rgba(34, 197, 94, 0.22);
  --accent-ink:  #052e16;

  --warn-bg:     rgba(245, 158, 11, 0.07);
  --warn-bord:   rgba(245, 158, 11, 0.22);
  --info-bg:     rgba(96, 165, 250, 0.07);
  --info-bord:   rgba(96, 165, 250, 0.22);

  --max:   1100px;
  --r-s:   8px;
  --r:     12px;
  --r-l:   16px;
  --ease:  cubic-bezier(0.16, 1, 0.3, 1);
  --t:     200ms;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle dot grid texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
}

a { color: var(--accent); text-decoration: none; transition: color var(--t); }
a:hover { color: var(--accent-h); text-decoration: underline; }
img { max-width: 100%; display: block; }
p { margin: 0; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 700; color: var(--text); }
strong { color: var(--text); }

/* ---- Layout ---- */
.container {
  width: min(calc(100% - 40px), var(--max));
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* ---- Skip link ---- */
.skip-link {
  position: absolute;
  left: 16px;
  top: -120px;
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: var(--r-s);
  z-index: 200;
  font-weight: 600;
  font-size: 0.875rem;
  transition: top var(--t) var(--ease);
}
.skip-link:focus { top: 16px; }

/* ============================================================
   HEADER / NAV
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 64px;
}
.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
  flex-shrink: 0;
  transition: opacity var(--t);
}
.brand:hover { opacity: 0.75; text-decoration: none; color: var(--text); }
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #062e2a;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--accent-bord);
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  align-items: center;
}
.nav-links a {
  color: var(--text-2);
  text-decoration: none;
  padding: 7px 13px;
  border-radius: var(--r-s);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color var(--t), background var(--t);
}
.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--text);
  background: var(--surface-2);
  outline: none;
  text-decoration: none;
}
.nav-links a.active {
  color: var(--text);
  background: var(--surface-2);
}

/* ============================================================
   KEYFRAME ANIMATIONS
   ============================================================ */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ============================================================
   HERO
   ============================================================ */
.hero { padding: 72px 0 56px; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
  align-items: start;
}
.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-l);
  padding: 40px;
  animation: fade-up 0.55s var(--ease) both;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.71rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}
.eyebrow::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  box-shadow: 0 0 8px var(--accent);
}
.hero h1 {
  font-size: clamp(1.75rem, 3.2vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}
.hero p.lead {
  color: var(--text-2);
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 28px;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}
.hero-note {
  color: var(--text-3);
  font-size: 0.82rem;
  margin-bottom: 22px;
  line-height: 1.55;
}
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border-mid);
  color: var(--text-3);
  font-size: 0.775rem;
  font-weight: 500;
}
.badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.hero-side { display: grid; gap: 12px; }
.hero-side .info-card:nth-child(1) { animation: fade-up 0.55s var(--ease) 0.09s both; }
.hero-side .info-card:nth-child(2) { animation: fade-up 0.55s var(--ease) 0.17s both; }

/* ============================================================
   CARDS
   ============================================================ */
.card,
.info-card,
.policy-card,
.callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-l);
}
.card,
.info-card {
  padding: 26px;
  transition: border-color var(--t) var(--ease), transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.card:hover,
.info-card:hover {
  border-color: var(--border-mid);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}
.policy-card { padding: 40px; }
.callout { padding: 30px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.button,
.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 20px;
  min-height: 42px;
  border-radius: var(--r-s);
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t), border-color var(--t), color var(--t),
              transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.button {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.button:hover,
.button:focus-visible {
  background: var(--accent-h);
  border-color: var(--accent-h);
  color: var(--accent-ink);
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(34, 197, 94, 0.28);
  text-decoration: none;
  outline: none;
}
.button-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-mid);
}
.button-secondary:hover,
.button-secondary:focus-visible {
  background: var(--surface-3);
  border-color: var(--border-hi);
  color: var(--text);
  transform: translateY(-1px);
  text-decoration: none;
  outline: none;
}

/* ============================================================
   SECTIONS
   ============================================================ */
.section { padding: 16px 0 0; }
.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.section-intro {
  color: var(--text-2);
  font-size: 0.875rem;
  line-height: 1.65;
  margin-bottom: 16px;
}
.kicker {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
  display: block;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

/* Stagger grid card animations */
.grid-3 .card:nth-child(1),
.grid-2 .card:nth-child(1) { animation: fade-up 0.5s var(--ease) 0.05s both; }
.grid-3 .card:nth-child(2),
.grid-2 .card:nth-child(2) { animation: fade-up 0.5s var(--ease) 0.12s both; }
.grid-3 .card:nth-child(3) { animation: fade-up 0.5s var(--ease) 0.19s both; }
.section .callout { animation: fade-in 0.5s var(--ease) 0.08s both; }

/* ============================================================
   LISTS
   ============================================================ */
.list-tight {
  list-style: none;
  padding: 0;
  margin: 0;
}
.list-tight li {
  position: relative;
  padding-left: 18px;
  color: var(--text-2);
  font-size: 0.875rem;
  line-height: 1.6;
}
.list-tight li + li { margin-top: 8px; }
.list-tight li::before {
  content: '–';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 600;
}

/* ============================================================
   CONTACT
   ============================================================ */
.contact-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}
.contact-item {
  padding: 12px 16px;
  border-radius: var(--r-s);
  border: 1px solid var(--border);
  background: var(--surface-2);
  transition: border-color var(--t);
}
.contact-item:hover { border-color: var(--border-mid); }
.contact-item strong {
  display: block;
  color: var(--text-3);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 3px;
}
.contact-item a { font-size: 0.875rem; color: var(--accent); }
.contact-item a:hover { color: var(--accent-h); }

/* Card text helpers */
.info-card h2,
.card h2,
.policy-card h2,
.callout h2 { color: var(--text); }
.info-card p,
.card p,
.info-card li,
.card li { color: var(--text-2); }

/* ============================================================
   POLICY LAYOUT
   ============================================================ */
.policy-layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 20px;
  padding: 48px 0 64px;
}
.policy-layout > article { min-width: 0; }
.toc {
  position: sticky;
  top: 84px;
  align-self: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-l);
  padding: 22px;
  animation: fade-in 0.5s var(--ease) 0.1s both;
}
.toc h2 {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 14px;
}
.toc ol,
.toc ul { margin: 0; padding-left: 14px; }
.toc li { list-style-type: decimal; }
.toc li + li { margin-top: 7px; }
.toc a {
  text-decoration: none;
  color: var(--text-2);
  font-size: 0.825rem;
  line-height: 1.5;
  display: block;
  transition: color var(--t);
}
.toc a:hover,
.toc a:focus-visible { color: var(--text); outline: none; }

.policy-card { animation: fade-up 0.5s var(--ease) 0.05s both; }
.policy-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 14px 0 26px;
}
.policy-meta span {
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-3);
  font-size: 0.775rem;
}

/* Callout boxes */
.summary-box {
  background: var(--accent-dim);
  border: 1px solid var(--accent-bord);
  border-radius: var(--r);
  padding: 16px 20px;
  margin: 20px 0;
}
.note {
  background: var(--info-bg);
  border: 1px solid var(--info-bord);
  border-radius: var(--r);
  padding: 16px 20px;
  margin: 20px 0;
}
.warning {
  background: var(--warn-bg);
  border: 1px solid var(--warn-bord);
  border-radius: var(--r);
  padding: 16px 20px;
  margin: 20px 0;
}

/* Content sections */
.content-section + .content-section {
  margin-top: 36px;
  padding-top: 30px;
  border-top: 1px solid var(--border);
}
.content-section h2 {
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.content-section h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 22px;
  margin-bottom: 8px;
}
.content-section p,
.content-section li,
.content-section dd,
.content-section td { color: var(--text-2); font-size: 0.9rem; }
.content-section p + p { margin-top: 10px; }
.content-section a { color: var(--accent); }
.content-section a:hover { color: var(--accent-h); }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; margin: 16px 0; }
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
  font-size: 0.875rem;
}
th, td {
  border: 1px solid var(--border);
  padding: 11px 14px;
  vertical-align: top;
  text-align: left;
}
th {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
td { color: var(--text-2); }
tr:hover td { background: rgba(255, 255, 255, 0.015); }

/* ============================================================
   INLINE LIST (policy pages)
   ============================================================ */
.inline-list {
  padding-left: 20px;
  margin-top: 12px;
}
.inline-list li + li { margin-top: 9px; }
.inline-list li { color: var(--text-2); font-size: 0.9rem; line-height: 1.65; }

/* ============================================================
   FAQ
   ============================================================ */
.faq details {
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  overflow: hidden;
  transition: border-color var(--t);
}
.faq details[open] { border-color: var(--border-mid); }
.faq details + details { margin-top: 8px; }
.faq summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  padding: 14px 18px;
  list-style: none;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '+';
  font-size: 1.1rem;
  font-weight: 300;
  color: var(--text-3);
  transition: transform var(--t);
  flex-shrink: 0;
  margin-left: 12px;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq p {
  padding: 0 18px 16px;
  color: var(--text-2);
  font-size: 0.875rem;
  line-height: 1.65;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  padding: 32px 0 44px;
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 1;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 14px;
}
.footer-card { padding: 20px 24px; }
.footer-card .section-title { font-size: 0.95rem; margin-bottom: 8px; }
.footer-card p { color: var(--text-2); font-size: 0.875rem; }
.footer-card .list-tight a { color: var(--accent); font-size: 0.875rem; }
.footer-card .list-tight a:hover { color: var(--accent-h); }

/* ============================================================
   UTILITY
   ============================================================ */
.muted { color: var(--text-2); }
.small { font-size: 0.85rem; }
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  font-size: 0.85em;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--border-mid);
  color: var(--text-2);
}
.hr {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .hero-grid,
  .policy-layout,
  .grid-2,
  .grid-3,
  .footer-grid { grid-template-columns: 1fr; }
  .toc { position: static; }
  table { min-width: 100%; }
}
@media (max-width: 640px) {
  .hero { padding: 44px 0 36px; }
  .hero-card,
  .policy-card { padding: 24px 20px; }
  .card,
  .info-card,
  .toc,
  .callout { padding: 20px; }
  .nav { align-items: flex-start; padding: 12px 0; flex-wrap: wrap; }
  .brand { flex: 0 0 100%; margin-bottom: 4px; }
  .nav-links { justify-content: flex-start; }
  .hero h1 { font-size: 1.6rem; }
  .content-section h2 { font-size: 1.05rem; }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  body { background: #fff; color: #000; }
  body::before { display: none; }
  .site-header, .toc, .site-footer, .hero-actions { display: none !important; }
  .policy-layout, .hero-grid { display: block; }
  .policy-card, .hero-card, .card, .info-card,
  .summary-box, .note, .warning {
    border: 1px solid #ddd;
    box-shadow: none;
    background: #fff;
    color: #000;
    margin-bottom: 16px;
    break-inside: avoid;
  }
  p, li, td, dd { color: #333 !important; }
  a { color: #000; text-decoration: underline; }
}
