/* Fractions Calculator Support Site — Design System */

:root {
  --accent: #007AFF;
  --accent-hover: #0063CC;
  --accent-light: #E5F1FF;
  --success: #34C759;
  --warning: #FF9500;
  --danger: #FF3B30;

  --bg: #FFFFFF;
  --bg-secondary: #F5F5F7;
  --bg-tertiary: #EBEBEB;
  --surface: #FFFFFF;
  --surface-raised: #FFFFFF;
  --border: #D2D2D7;
  --border-light: #E8E8ED;

  --text-primary: #1D1D1F;
  --text-secondary: #6E6E73;
  --text-tertiary: #AEAEB2;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --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.12);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  --font-mono: "SF Mono", ui-monospace, "Cascadia Code", Menlo, monospace;

  --nav-width: 260px;
  --header-height: 60px;
  --content-max: 820px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-secondary: #1C1C1E;
    --bg-tertiary: #2C2C2E;
    --surface: #1C1C1E;
    --surface-raised: #2C2C2E;
    --border: #38383A;
    --border-light: #2C2C2E;

    --text-primary: #F5F5F7;
    --text-secondary: #AEAEB2;
    --text-tertiary: #636366;

    --accent-light: #1A2E4A;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  }
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ─── Typography ───────────────────────────────────── */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -0.015em; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }

p { color: var(--text-secondary); }
p + p { margin-top: 1em; }

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

strong { font-weight: 600; color: var(--text-primary); }

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-tertiary);
  padding: 0.15em 0.45em;
  border-radius: 4px;
  color: var(--text-primary);
}

/* ─── Site Header ──────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  padding: 0 24px;
}

@media (prefers-color-scheme: dark) {
  .site-header {
    background: rgba(0,0,0,0.85);
    border-bottom-color: var(--border);
  }
}

.header-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 32px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 17px;
  color: var(--text-primary);
  text-decoration: none;
  flex-shrink: 0;
}

.header-logo:hover { color: var(--text-primary); text-decoration: none; }

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(145deg, #007AFF, #5856D6);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.header-nav {
  display: flex;
  gap: 4px;
  flex: 1;
}

.header-nav a {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
  text-decoration: none;
}

.header-nav a:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
  text-decoration: none;
}

.header-nav a.active {
  color: var(--accent);
  background: var(--accent-light);
}

.header-cta {
  margin-left: auto;
  flex-shrink: 0;
}

/* ─── Buttons ──────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 980px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  border: none;
  line-height: 1.2;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  text-decoration: none;
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}
.btn-outline:hover {
  background: var(--accent-light);
  color: var(--accent);
  text-decoration: none;
}

.btn svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ─── Hero ─────────────────────────────────────────── */

.hero {
  padding: 80px 24px 72px;
  text-align: center;
  background: var(--bg);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 980px;
  margin-bottom: 24px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.hero h1 { margin-bottom: 20px; }

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 36px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.app-store-badge {
  display: inline-block;
  height: 44px;
  transition: opacity 0.15s, transform 0.15s;
}
.app-store-badge:hover { opacity: 0.85; transform: translateY(-1px); }
.app-store-badge img { height: 44px; display: block; }

/* ─── Cards ─────────────────────────────────────────── */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: box-shadow 0.2s, transform 0.2s;
}

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

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 24px;
}

.card-icon.blue { background: #E5F1FF; }
.card-icon.purple { background: #F0EEFF; }
.card-icon.green { background: #E6F9ED; }
.card-icon.orange { background: #FFF3E5; }

@media (prefers-color-scheme: dark) {
  .card-icon.blue { background: #1A2E4A; }
  .card-icon.purple { background: #2A1F4A; }
  .card-icon.green { background: #1A3A25; }
  .card-icon.orange { background: #3A2A10; }
}

.card h3 { margin-bottom: 8px; }
.card p { font-size: 15px; margin: 0 0 16px; }
.card a { font-size: 15px; font-weight: 500; }

/* ─── Section wrapper ──────────────────────────────── */

.section {
  padding: 72px 24px;
}

.section-inner {
  max-width: 1100px;
  margin: 0 auto;
}

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

.section-header {
  margin-bottom: 48px;
  text-align: center;
}

.section-header p {
  font-size: 1.1rem;
  margin-top: 12px;
}

/* ─── Docs layout ──────────────────────────────────── */

.docs-layout {
  display: grid;
  grid-template-columns: var(--nav-width) 1fr;
  gap: 0;
  min-height: calc(100vh - var(--header-height));
  max-width: 1200px;
  margin: 0 auto;
}

.docs-sidebar {
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  padding: 32px 16px 32px 24px;
  border-right: 1px solid var(--border-light);
  flex-shrink: 0;
}

.docs-sidebar::-webkit-scrollbar { width: 4px; }
.docs-sidebar::-webkit-scrollbar-track { background: transparent; }
.docs-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar-section { margin-bottom: 28px; }

.sidebar-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 0 8px;
  margin-bottom: 6px;
}

.sidebar-nav { list-style: none; }

.sidebar-nav a {
  display: block;
  font-size: 15px;
  color: var(--text-secondary);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  transition: color 0.12s, background 0.12s;
  text-decoration: none;
}

.sidebar-nav a:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
  text-decoration: none;
}

.sidebar-nav a.active {
  color: var(--accent);
  background: var(--accent-light);
  font-weight: 500;
}

.sidebar-nav .sub-item a {
  padding-left: 20px;
  font-size: 14px;
}

.docs-content {
  padding: 48px 48px 80px;
  min-width: 0;
}

.docs-content > * + * { margin-top: 24px; }

.docs-content h1 { margin-bottom: 8px; }
.docs-content h2 {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}
.docs-content h2:first-of-type { border-top: none; padding-top: 0; }
.docs-content h3 { margin-top: 32px; }

.docs-content ul, .docs-content ol {
  padding-left: 24px;
  color: var(--text-secondary);
}
.docs-content li { margin-top: 6px; }
.docs-content li + li { }

/* ─── Callouts ─────────────────────────────────────── */

.callout {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  font-size: 15px;
  line-height: 1.5;
}

.callout-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

.callout.tip {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid rgba(0,122,255,0.2);
}
.callout.tip p { color: var(--accent); }

.callout.warning {
  background: #FFF3E5;
  color: #8A4200;
  border: 1px solid rgba(255,149,0,0.25);
}
.callout.warning p { color: #8A4200; }

.callout.note {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.callout.note p { color: var(--text-secondary); }

@media (prefers-color-scheme: dark) {
  .callout.warning { background: #3A2010; color: #FF9F45; border-color: rgba(255,149,0,0.3); }
  .callout.warning p { color: #FF9F45; }
}

/* ─── Step list ────────────────────────────────────── */

.steps { list-style: none; padding: 0; counter-reset: steps; }

.steps li {
  counter-increment: steps;
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 15px;
}

.steps li:last-child { border-bottom: none; }

.steps li::before {
  content: counter(steps);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  margin-top: 1px;
}

/* ─── Keyboard shortcut ────────────────────────────── */

kbd {
  display: inline-block;
  padding: 2px 7px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
}

/* ─── Table ─────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

th {
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 16px;
  border-bottom: 2px solid var(--border);
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  vertical-align: top;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-secondary); }

/* ─── FAQ ───────────────────────────────────────────── */

.faq-item {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 8px;
}

details summary {
  padding: 18px 20px;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  list-style: none;
  background: var(--surface);
  transition: background 0.15s;
  color: var(--text-primary);
}

details summary::-webkit-details-marker { display: none; }

details summary::after {
  content: "+";
  font-size: 22px;
  font-weight: 300;
  color: var(--text-tertiary);
  transition: transform 0.2s;
  flex-shrink: 0;
  margin-left: 16px;
}

details[open] summary::after {
  transform: rotate(45deg);
}

details summary:hover { background: var(--bg-secondary); }

.faq-body {
  padding: 0 20px 20px;
  font-size: 15px;
  color: var(--text-secondary);
  background: var(--surface);
  border-top: 1px solid var(--border-light);
  padding-top: 16px;
}

.faq-body p + p { margin-top: 10px; }
.faq-body ul { padding-left: 20px; margin-top: 8px; }
.faq-body li { margin-top: 4px; }

/* ─── Feature grid ─────────────────────────────────── */

.feature-list { list-style: none; padding: 0; display: grid; gap: 12px; }

.feature-list li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 15px;
  color: var(--text-secondary);
}

.feature-list li::before {
  content: "✓";
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  min-width: 22px;
  background: var(--success);
  color: white;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  margin-top: 1px;
}

/* ─── Contact form / cards ─────────────────────────── */

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.contact-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  text-decoration: none;
  transition: box-shadow 0.2s, transform 0.2s;
  display: block;
}

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

.contact-card-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.contact-card h3 { margin-bottom: 6px; font-size: 17px; }
.contact-card p { font-size: 14px; color: var(--text-secondary); margin: 0; }

/* ─── Footer ────────────────────────────────────────── */

.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-light);
  padding: 48px 24px;
  margin-top: 0;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: start;
}

.footer-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.footer-brand span { font-weight: 600; font-size: 15px; }

.footer-tagline { font-size: 14px; color: var(--text-tertiary); }

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.footer-links a {
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
}
.footer-links a:hover { color: var(--text-primary); text-decoration: underline; }

.footer-bottom {
  max-width: 1100px;
  margin: 32px auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.footer-bottom p { font-size: 13px; color: var(--text-tertiary); margin: 0; }

/* ─── Breadcrumb ────────────────────────────────────── */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-tertiary);
  margin-bottom: 32px;
}

.breadcrumb a { color: var(--text-tertiary); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { color: var(--text-primary); }

/* ─── Inline badge ──────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 980px;
  font-size: 12px;
  font-weight: 600;
}

.badge-ios { background: #E5F1FF; color: var(--accent); }
.badge-mac { background: #F0EEFF; color: #5856D6; }

@media (prefers-color-scheme: dark) {
  .badge-ios { background: #1A2E4A; }
  .badge-mac { background: #2A1F4A; }
}

/* ─── Responsive ────────────────────────────────────── */

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

  .docs-sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    padding: 24px;
  }

  .sidebar-nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .sidebar-nav li { display: contents; }
  .sidebar-nav a { white-space: nowrap; }
  .sidebar-label { display: none; }
  .sidebar-section { margin-bottom: 0; }

  .docs-content { padding: 32px 24px 64px; }
}

@media (max-width: 680px) {
  .header-nav { display: none; }
  .docs-content h2 { font-size: 1.35rem; }

  .footer-inner { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; }
}

/* ─── Misc utilities ────────────────────────────────── */

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border-width: 0;
}

.text-center { text-align: center; }
.mt-0 { margin-top: 0 !important; }
.mt-8 { margin-top: 8px !important; }
.mt-16 { margin-top: 16px !important; }
.mt-24 { margin-top: 24px !important; }
.mt-32 { margin-top: 32px !important; }
.mt-48 { margin-top: 48px !important; }
.mt-64 { margin-top: 64px !important; }
