/* ==========================================================================
   SheetToAnki — Design Tokens & Shared Styles
   Palette: deep ink surface, amber "front-of-card" accent, teal "back-of-card"
   accent. Type: Sora (display) + Inter (body) + JetBrains Mono (data/CSV).
   ========================================================================== */

:root {
  /* Color */
  --bg: #0E1016;
  --bg-elevated: #171A24;
  --bg-card: #1E2230;
  --bg-card-hover: #262B3D;
  --border: #2B3044;
  --border-strong: #3A4159;
  --text: #EDEEF4;
  --text-muted: #9297AC;
  --text-faint: #656B82;
  --accent-front: #F2B84B;   /* amber — the question / front face */
  --accent-front-dim: #4A3A1E;
  --accent-back: #5FE3C0;    /* teal — the answer / back face */
  --accent-back-dim: #1C3A34;
  --accent-danger: #F2665B;
  --accent-danger-dim: #3A2020;

  /* Type */
  --font-display: 'Sora', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  /* Layout */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --container: 1140px;
  --shadow-card: 0 1px 0 rgba(255,255,255,0.04) inset, 0 8px 24px rgba(0,0,0,0.35);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2.1rem, 4vw + 1rem, 3.4rem); }
h2 { font-size: clamp(1.5rem, 2vw + 1rem, 2.2rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; color: var(--text-muted); }
code, .mono { font-family: var(--font-mono); }

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

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-front);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 12px;
  display: inline-block;
}

/* Focus visibility */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent-back);
  outline-offset: 2px;
}

/* ---------------- Header ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(14,16,22,0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  color: var(--text);
}
.brand-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-front), var(--accent-back));
  display: flex; align-items: center; justify-content: center;
  color: #10121A; font-weight: 800; font-size: 0.85rem;
}
.nav-links { display: flex; gap: 28px; list-style: none; margin: 0; padding: 0; }
.nav-links a { text-decoration: none; color: var(--text-muted); font-size: 0.92rem; transition: color .15s; }
.nav-links a:hover { color: var(--text); }
.nav-cta {
  background: var(--accent-front);
  color: #171200;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
}
.nav-toggle { display: none; }

@media (max-width: 780px) {
  .nav-links { display: none; }
  .nav-toggle {
    display: block; background: none; border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); color: var(--text); padding: 6px 10px; font-family: var(--font-mono);
  }
}

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: var(--font-body);
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent-front); color: #171200; }
.btn-primary:hover { background: #f6c874; }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--accent-back); color: var(--accent-back); }
.btn-ghost { background: transparent; color: var(--text-muted); border: none; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------------- Hero / Row→Card signature ---------------- */
.hero {
  padding: 72px 0 40px;
  position: relative;
  overflow: hidden;
}
.hero .container {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 48px;
  align-items: center;
}
@media (max-width: 900px) {
  .hero .container { grid-template-columns: 1fr; }
}
.hero-copy p.lead { font-size: 1.08rem; max-width: 46ch; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 26px; }
.hero-note { margin-top: 18px; font-size: 0.82rem; color: var(--text-faint); font-family: var(--font-mono); }

.rowcard-demo { position: relative; height: 320px; display: flex; align-items: center; justify-content: center; }
.rc-row {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  width: 260px;
  position: absolute;
  left: 0;
  box-shadow: var(--shadow-card);
}
.rc-row .rc-cell { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px dashed var(--border); color: var(--text-muted); }
.rc-row .rc-cell:last-child { border-bottom: none; }
.rc-row .rc-cell b { color: var(--text); font-weight: 500; }
.rc-arrow {
  position: absolute; left: 265px; color: var(--text-faint); font-size: 1.4rem;
  animation: rc-pulse 2.4s ease-in-out infinite;
}
@keyframes rc-pulse { 0%,100% { opacity: 0.35; transform: translateX(0);} 50% { opacity: 1; transform: translateX(6px);} }

.flip-card {
  position: absolute;
  right: 10px;
  width: 240px;
  height: 150px;
  perspective: 1000px;
}
.flip-card-inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
  animation: rc-flip 4.8s ease-in-out infinite;
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-lg);
}
@keyframes rc-flip {
  0%, 38% { transform: rotateY(0deg); }
  50%, 88% { transform: rotateY(180deg); }
  100% { transform: rotateY(360deg); }
}
.flip-face {
  position: absolute; inset: 0;
  border-radius: var(--radius-lg);
  backface-visibility: hidden;
  display: flex; flex-direction: column; justify-content: center; padding: 22px;
  border: 1px solid var(--border-strong);
}
.flip-front { background: linear-gradient(160deg, var(--accent-front-dim), var(--bg-card)); }
.flip-back { background: linear-gradient(160deg, var(--accent-back-dim), var(--bg-card)); transform: rotateY(180deg); }
.flip-face .flip-label { font-family: var(--font-mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px; }
.flip-front .flip-label { color: var(--accent-front); }
.flip-back .flip-label { color: var(--accent-back); }
.flip-face .flip-text { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }

/* ---------------- Cards / feature grid ---------------- */
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
}
.card h3 { margin-bottom: 8px; }
.card p { margin-bottom: 0; font-size: 0.92rem; }
.card .card-icon {
  width: 38px; height: 38px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elevated); margin-bottom: 14px; font-size: 1.05rem;
}

/* ---------------- How it works ---------------- */
.steps { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
@media (max-width: 900px) { .steps { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } }
.step {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 0.85rem;
}
.step .step-n { font-family: var(--font-mono); color: var(--accent-front); font-size: 0.75rem; display: block; margin-bottom: 6px; }

/* ---------------- Converter widget ---------------- */
.converter {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  overflow: hidden;
}
.converter-tabs { display: flex; border-bottom: 1px solid var(--border); overflow-x: auto; }
.converter-tab {
  flex: none;
  padding: 16px 20px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-faint);
  background: none; border: none; cursor: default;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.converter-tab.active { color: var(--text); border-bottom-color: var(--accent-front); }
.converter-tab.done { color: var(--accent-back); }
.converter-body { padding: 28px; }

.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 44px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent-front); background: rgba(242,184,75,0.04); }
.dropzone input[type="file"] { display: none; }
.dropzone .dz-icon { font-size: 2rem; margin-bottom: 10px; }
.dropzone .dz-title { font-weight: 600; margin-bottom: 4px; }
.dropzone .dz-sub { font-size: 0.82rem; color: var(--text-faint); }

.paste-area {
  width: 100%;
  min-height: 110px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 12px;
  resize: vertical;
}
.paste-area::placeholder { color: var(--text-faint); }

.divider-or {
  display: flex; align-items: center; gap: 12px; margin: 22px 0;
  color: var(--text-faint); font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase;
}
.divider-or::before, .divider-or::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.field-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.78rem; color: var(--text-muted); font-family: var(--font-mono); }
select, .txt-input {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 0.88rem;
  font-family: var(--font-body);
  min-width: 200px;
}

.data-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table.data-table { border-collapse: collapse; width: 100%; font-size: 0.82rem; }
table.data-table th, table.data-table td {
  padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; text-align: left;
}
table.data-table th { background: var(--bg-card); font-family: var(--font-mono); font-weight: 500; color: var(--text-muted); position: sticky; top: 0; }
table.data-table tr:last-child td { border-bottom: none; }

.mapping-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 16px; }
@media (max-width: 780px) { .mapping-grid { grid-template-columns: repeat(2, 1fr); } }
.map-slot { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; }
.map-slot .map-label { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; display: flex; justify-content: space-between; }
.map-slot .req { color: var(--accent-front); }
.map-slot select { width: 100%; min-width: 0; }

.cleanup-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 16px; }
@media (max-width: 600px) { .cleanup-options { grid-template-columns: 1fr; } }
.check-row { display: flex; align-items: center; gap: 9px; font-size: 0.88rem; }
.check-row input { accent-color: var(--accent-front); width: 16px; height: 16px; }

.preview-card-shell { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 12px 0 6px; }
.preview-flip { width: min(420px, 100%); height: 220px; perspective: 1200px; cursor: pointer; }
.preview-flip-inner { position: relative; width: 100%; height: 100%; transition: transform .5s; transform-style: preserve-3d; }
.preview-flip.flipped .preview-flip-inner { transform: rotateY(180deg); }
.preview-face {
  position: absolute; inset: 0; backface-visibility: hidden;
  border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  display: flex; flex-direction: column; padding: 22px; overflow-y: auto;
}
.preview-face .pf-label { font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 10px; }
.preview-face .pf-text { font-size: 1.05rem; line-height: 1.5; white-space: pre-wrap; }
.pf-front { background: linear-gradient(160deg, var(--accent-front-dim), var(--bg-card)); }
.pf-front .pf-label { color: var(--accent-front); }
.pf-back { background: linear-gradient(160deg, var(--accent-back-dim), var(--bg-card)); transform: rotateY(180deg); }
.pf-back .pf-label { color: var(--accent-back); }
.preview-controls { display: flex; align-items: center; gap: 16px; }
.preview-controls .pc-count { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-muted); min-width: 90px; text-align: center; }

.summary-strip { display: flex; gap: 22px; flex-wrap: wrap; margin: 18px 0; font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-muted); }
.summary-strip b { color: var(--text); }

.alert { border-radius: var(--radius-sm); padding: 13px 16px; font-size: 0.86rem; margin-bottom: 16px; border: 1px solid; }
.alert-error { background: var(--accent-danger-dim); border-color: #6b3530; color: #ffb4ac; }
.alert-info { background: var(--accent-back-dim); border-color: #2a5a4e; color: #b9f3e2; }
.alert-warn { background: var(--accent-front-dim); border-color: #6b551f; color: #ffdd9c; }

.converter-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 26px; flex-wrap: wrap; gap: 12px; }
.step-back-link { background: none; border: none; color: var(--text-muted); font-size: 0.88rem; cursor: pointer; }
.step-back-link:hover { color: var(--text); }

/* ---------------- FAQ ---------------- */
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item:first-child { border-top: 1px solid var(--border); }
.faq-q {
  width: 100%; text-align: left; background: none; border: none; color: var(--text);
  padding: 20px 4px; font-family: var(--font-display); font-weight: 600; font-size: 1rem;
  display: flex; justify-content: space-between; align-items: center; cursor: pointer;
}
.faq-q .faq-plus { color: var(--accent-front); font-family: var(--font-mono); transition: transform .18s; }
.faq-item[open] .faq-plus { transform: rotate(45deg); }
.faq-a { padding: 0 4px 20px; color: var(--text-muted); font-size: 0.92rem; }

/* ---------------- Privacy section ---------------- */
.privacy-block {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: center;
}
@media (max-width: 800px) { .privacy-block { grid-template-columns: 1fr; } }
.privacy-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.privacy-list li { display: flex; gap: 10px; font-size: 0.92rem; color: var(--text); }
.privacy-list li::before { content: '✓'; color: var(--accent-back); font-weight: 700; }

/* ---------------- Footer ---------------- */
.site-footer { border-top: 1px solid var(--border); padding: 48px 0 32px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; margin-bottom: 36px; }
@media (max-width: 780px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer-grid h4 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); margin-bottom: 14px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 9px; }
.footer-grid a { color: var(--text-muted); text-decoration: none; font-size: 0.9rem; }
.footer-grid a:hover { color: var(--text); }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; border-top: 1px solid var(--border); padding-top: 22px; font-size: 0.8rem; color: var(--text-faint); }

/* ---------------- Content pages (SEO) ---------------- */
.prose { max-width: 72ch; margin: 0 auto; }
.prose h2 { margin-top: 1.6em; }
.prose ul, .prose ol { color: var(--text-muted); }
.prose table { width: 100%; border-collapse: collapse; margin: 1.2em 0; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 12px; font-size: 0.88rem; text-align: left; }
.prose th { background: var(--bg-elevated); }
.breadcrumb { font-size: 0.82rem; color: var(--text-faint); margin-bottom: 24px; }
.breadcrumb a { color: var(--text-faint); text-decoration: none; }
.breadcrumb a:hover { color: var(--text-muted); }

.page-hero { padding: 56px 0 20px; text-align: center; }
.page-hero .lead { max-width: 60ch; margin: 0 auto; }

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