/* ───────────────────────────────────────────────────────────────────────────
   Doc Formatter — docformat.dev
   An editorial specimen: the site itself is a typeset document.
   Paper ground, ink text, rubrication red, hairline rules, mono print labels.
   ─────────────────────────────────────────────────────────────────────────── */

:root {
  --paper: #FAF6EF;
  --paper-deep: #F3EDE2;
  --ink: #1C1B18;
  --ink-soft: #4A463F;
  --ink-faint: #8B8478;
  --rubric: #B5341F;           /* rubrication red — the one accent */
  --rubric-deep: #8E2718;
  --hairline: #D8D0C2;
  --serif: "Spectral", Georgia, serif;
  --garamond: "EB Garamond", Garamond, serif;
  --slab: "Merriweather", Georgia, serif;
  --sans: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", monospace;
  --max: 1120px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--serif);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(ellipse at 20% -10%, #FFFDF8 0%, transparent 55%);
}

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

::selection { background: var(--rubric); color: var(--paper); }

a { color: inherit; }

/* ── Type utilities ─────────────────────────────────────────────────────── */

.kicker {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--rubric);
  margin-bottom: 14px;
}

h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(30px, 4.2vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.015em;
}

.section-head { margin-bottom: 48px; max-width: 640px; }
.section-desc { margin-top: 16px; color: var(--ink-soft); font-size: 18px; }

.field-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 22px 0 10px;
}

.hint { font-size: 13.5px; color: var(--ink-faint); margin-top: 10px; font-style: italic; }

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

.btn {
  display: inline-block;
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-decoration: none;
  border: 1.5px solid var(--ink);
  padding: 13px 26px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease;
  background: transparent;
  color: var(--ink);
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 3px 3px 0 var(--ink); }
.btn:active { transform: translate(0, 0); box-shadow: none; }

.btn-accent { background: var(--rubric); border-color: var(--rubric-deep); color: #FFF8F2; }
.btn-accent:hover { box-shadow: 3px 3px 0 var(--rubric-deep); background: var(--rubric-deep); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 9px 18px; font-size: 12.5px; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn:disabled { opacity: .45; cursor: wait; transform: none; box-shadow: none; }

/* ── Masthead ───────────────────────────────────────────────────────────── */

.masthead {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
}
.masthead-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; gap: 24px;
}
.wordmark {
  font-family: var(--serif); font-weight: 800; font-size: 20px;
  text-decoration: none; letter-spacing: -0.01em;
}
.wordmark-accent { color: var(--rubric); font-weight: 400; padding: 0 1px; }
.masthead-links { display: flex; gap: 28px; }
.masthead-links a {
  font-family: var(--mono); font-size: 13px; text-decoration: none;
  color: var(--ink-soft); letter-spacing: 0.03em;
}
.masthead-links a:hover { color: var(--rubric); }

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

.hero { padding: 110px 0 0; position: relative; }

.eyebrow {
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 26px;
}

.hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(44px, 7.4vw, 88px);
  line-height: 1.02;
  letter-spacing: -0.022em;
  max-width: 18ch;
}
.hero h1 em {
  font-style: italic;
  font-weight: 300;
  color: var(--rubric);
}

.lede {
  margin-top: 30px; max-width: 56ch; font-size: 19.5px;
  line-height: 1.65; color: var(--ink-soft);
}

.hero-actions { display: flex; gap: 16px; margin-top: 40px; flex-wrap: wrap; }

.hero-stats {
  display: flex; gap: 56px; margin-top: 72px; flex-wrap: wrap;
  border-top: 1px solid var(--hairline); padding-top: 28px;
}
.hero-stats strong {
  display: block; font-family: var(--serif); font-size: 34px;
  font-weight: 800; letter-spacing: -0.02em;
}
.hero-stats span {
  font-family: var(--mono); font-size: 12px; color: var(--ink-faint);
  max-width: 24ch; display: block; line-height: 1.5; margin-top: 4px;
}

.hero-rule { height: 4px; background: var(--ink); margin-top: 90px; }

/* Staggered reveal */
.reveal { animation: rise .7s cubic-bezier(.2,.7,.3,1) both; }
.d1 { animation-delay: .08s; } .d2 { animation-delay: .18s; }
.d3 { animation-delay: .28s; } .d4 { animation-delay: .4s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .reveal { animation: none; } }

/* ── Converter app ──────────────────────────────────────────────────────── */

.app-section { padding: 96px 0; }

.app-layout {
  display: grid; grid-template-columns: 1.6fr 1fr; gap: 36px;
  align-items: start;
}

.app-input {
  border: 1.5px solid var(--ink);
  background: #FFFDF8;
  box-shadow: 6px 6px 0 var(--paper-deep);
}

.input-tabs { display: flex; border-bottom: 1px solid var(--hairline); }
.tab {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.05em;
  padding: 13px 20px; background: none; border: none; cursor: pointer;
  color: var(--ink-faint); border-right: 1px solid var(--hairline);
}
.tab.selected { color: var(--ink); background: var(--paper); box-shadow: inset 0 -2px 0 var(--rubric); }

.tab-pane.hidden { display: none; }

#md-input {
  width: 100%; min-height: 420px; resize: vertical;
  border: none; outline: none; background: transparent;
  padding: 22px 24px;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.7;
  color: var(--ink);
}
#drop-zone.dragover, .docx-drop.dragover { outline: 2px dashed var(--rubric); outline-offset: -10px; }

.docx-drop {
  min-height: 420px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  text-align: center; padding: 40px;
}
.docx-drop-title { font-size: 24px; font-weight: 600; }
.docx-drop-sub { color: var(--ink-faint); max-width: 44ch; font-size: 14.5px; }
.file-btn { margin-top: 8px; }

.gdocs-pane { min-height: 420px; padding: 40px; }
.gdocs-row { display: flex; gap: 10px; }
#gdocs-url {
  flex: 1; border: 1.5px solid var(--ink); background: var(--paper);
  padding: 11px 14px; font-family: var(--mono); font-size: 13px; outline: none;
}
#gdocs-url:focus { border-color: var(--rubric); }

/* Controls */
.app-controls {
  border-top: 4px solid var(--ink); padding-top: 6px;
  position: sticky; top: 84px;
}

.tpl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tpl-chip {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 1px solid var(--hairline); background: #FFFDF8;
  padding: 10px 4px 8px; cursor: pointer;
  transition: border-color .12s, box-shadow .12s;
}
.tpl-chip:hover { border-color: var(--ink); }
.tpl-chip.selected { border: 1.5px solid var(--ink); box-shadow: 3px 3px 0 var(--paper-deep), inset 0 -2px 0 var(--rubric); }
.tpl-aa { font-size: 21px; line-height: 1; }
.tpl-chip-name { font-family: var(--mono); font-size: 10px; letter-spacing: 0.04em; color: var(--ink-soft); }
.pro-tag {
  position: absolute; top: -7px; right: -5px;
  font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.08em;
  background: var(--ink); color: var(--paper); padding: 2px 5px;
}
.pro-hint { margin-top: 8px; }

/* per-template Aa specimens */
.tpl-aa-vignelli    { font-family: var(--sans); font-weight: 900; color: #E84820; }
.tpl-aa-bringhurst  { font-family: var(--serif); color: #8B4513; }
.tpl-aa-carter      { font-family: var(--slab); color: #2980B9; }
.tpl-aa-knuth       { font-family: var(--sans); font-weight: 600; color: #0284C7; }
.tpl-aa-tschichold  { font-family: var(--garamond); color: #9E2B25; }
.tpl-aa-brockmann   { font-family: var(--sans); font-weight: 900; color: #000; }
.tpl-aa-frutiger    { font-family: var(--sans); font-weight: 600; color: #0067B1; }
.tpl-aa-spiekermann { font-family: var(--serif); font-weight: 600; color: #E42313; }
.tpl-aa-lubalin     { font-family: var(--slab); font-weight: 900; color: #6B21A8; }

.format-toggle-wrapper { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.format-label { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.06em; }
.toggle { position: relative; width: 46px; height: 24px; display: inline-block; }
.toggle input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; background: var(--paper-deep);
  border: 1.5px solid var(--ink); cursor: pointer; transition: background .15s;
}
.slider::before {
  content: ""; position: absolute; width: 14px; height: 14px;
  left: 3px; top: 3px; background: var(--ink); transition: transform .15s;
}
.toggle input:checked + .slider::before { transform: translateX(22px); background: var(--rubric); }

.quota { font-family: var(--mono); font-size: 11.5px; color: var(--ink-faint); margin-top: 12px; }

.status { margin-top: 10px; font-size: 14px; min-height: 22px; }
.status.success { color: #2D6A4F; }
.status.error { color: var(--rubric-deep); }

.limit-banner {
  margin-top: 28px; padding: 20px 24px;
  border: 1.5px solid var(--rubric); background: #FCEEE9;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  flex-wrap: wrap;
}
.limit-banner.hidden { display: none; }

/* ── Specimen gallery ───────────────────────────────────────────────────── */

.templates-section { padding: 96px 0; background: var(--paper-deep); border-top: 1px solid var(--hairline); }

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

.specimen { display: flex; flex-direction: column; }
.specimen .page {
  aspect-ratio: 8.5 / 10;
  background: #FFFEFB;
  border: 1px solid var(--hairline);
  box-shadow: 0 1px 2px rgba(28,27,24,.08), 0 12px 28px -18px rgba(28,27,24,.35);
  padding: 14% 11%;
  overflow: hidden;
  position: relative;
  transition: transform .22s cubic-bezier(.2,.7,.3,1), box-shadow .22s;
}
.specimen:hover .page {
  transform: translateY(-6px) rotate(-0.4deg);
  box-shadow: 0 2px 3px rgba(28,27,24,.08), 0 24px 44px -20px rgba(28,27,24,.45);
}
.specimen figcaption { padding: 18px 4px 0; position: relative; }
.specimen h3 { font-family: var(--serif); font-size: 21px; font-weight: 600; margin-bottom: 6px; }
.specimen p { font-size: 14.5px; color: var(--ink-soft); line-height: 1.55; max-width: 36ch; }

.badge {
  position: absolute; top: 20px; right: 4px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; padding: 3px 8px;
}
.badge.free { border: 1px solid var(--hairline); color: var(--ink-faint); }
.badge.pro-badge { background: var(--ink); color: var(--paper); }

/* page miniature internals */
.page .page-title { font-size: clamp(14px, 1.6vw, 19px); line-height: 1.15; margin-bottom: 12%; }
.page .ln { height: 4px; background: #DDD6C9; margin-bottom: 7%; border-radius: 1px; }
.page .ln.centered { margin-left: auto; margin-right: auto; }
.w50 { width: 50%; } .w60 { width: 60%; } .w65 { width: 65%; } .w70 { width: 70%; }
.w75 { width: 75%; } .w80 { width: 80%; } .w85 { width: 85%; } .w90 { width: 90%; }
.page .rule { height: 2px; background: var(--ink); width: 30%; margin-bottom: 10%; }
.page .rule-red { background: #E30613; }
.page .page-band {
  position: absolute; top: 0; left: 0; right: 0; height: 30%;
  background: #E84820;
}
.page .band-plum { background: #6B21A8; height: 26%; }
.page .code-block { height: 16%; background: #EFF6FB; border-left: 3px solid #0284C7; margin-bottom: 9%; }
.page .zebra { height: 7%; background: #F0F0F0; margin-bottom: 2%; }
.page .zebra.alt { background: #FAFAFA; }

.page-vignelli .page-title { font-family: var(--sans); font-weight: 900; color: #FFF; position: relative; z-index: 1; margin-top: 2%; }
.page-vignelli { padding-top: 8% !important; }
.page-vignelli .ln:first-of-type { margin-top: 26%; }
.page-bringhurst .page-title { font-family: var(--serif); color: #1A1A1A; }
.page-carter .page-title { font-family: var(--slab); font-weight: 900; color: #1F3A50; }
.page-knuth .page-title { font-family: var(--sans); font-weight: 800; color: #0284C7; }
.page-tschichold .page-title { font-family: var(--garamond); color: #1C1B1A; text-align: center; }
.page-brockmann .page-title { font-family: var(--sans); font-weight: 900; font-size: clamp(17px, 2vw, 24px); letter-spacing: -0.02em; color: #000; }
.page-frutiger .page-title { font-family: var(--sans); font-weight: 600; color: #0B3954; }
.page-spiekermann .page-title { font-family: var(--serif); font-weight: 600; color: #1A1A1A; }
.page-lubalin .page-title { font-family: var(--slab); font-weight: 900; color: #FFF; position: relative; z-index: 1; margin-top: 0; }
.page-lubalin { padding-top: 7% !important; }
.page-lubalin .ln:first-of-type { margin-top: 24%; }
.centered { text-align: center; }
.serif-black { font-weight: 900; }

/* ── How it works ───────────────────────────────────────────────────────── */

.how-section { padding: 96px 0; }
.steps { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 36px; }
.steps li { border-top: 1px solid var(--ink); padding-top: 22px; }
.step-no {
  font-family: var(--mono); font-size: 13px; color: var(--rubric);
  display: block; margin-bottom: 12px;
}
.steps h3 { font-family: var(--serif); font-size: 22px; font-weight: 600; margin-bottom: 10px; }
.steps p { font-size: 15.5px; color: var(--ink-soft); }

/* ── Features ───────────────────────────────────────────────────────────── */

.features-section { padding: 0 0 96px; }
.features-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--hairline); border: 1px solid var(--hairline);
}
.feature { background: var(--paper); padding: 30px 26px 34px; }
.feature h3 { font-family: var(--serif); font-size: 19px; font-weight: 600; margin-bottom: 10px; }
.feature p { font-size: 14.5px; color: var(--ink-soft); }

/* ── Pricing ────────────────────────────────────────────────────────────── */

.pricing-section { padding: 96px 0; background: var(--ink); color: var(--paper); }
.pricing-section .kicker { color: #E8A294; }
.pricing-section .section-desc { color: #B8B2A6; }

.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.plan {
  border: 1px solid #3A3833; padding: 34px 30px 38px; position: relative;
  background: #232220;
}
.plan.featured { border: 1.5px solid var(--rubric); background: #262320; transform: translateY(-10px); }
.plan-flag {
  position: absolute; top: -12px; left: 30px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  background: var(--rubric); color: #FFF8F2; padding: 3px 10px;
}
.plan h3 { font-family: var(--mono); font-size: 14px; letter-spacing: 0.12em; text-transform: uppercase; color: #B8B2A6; }
.price { font-family: var(--serif); font-size: 52px; font-weight: 800; margin: 10px 0 22px; letter-spacing: -0.02em; }
.price span { font-size: 15px; font-weight: 400; color: #8B8478; font-family: var(--mono); }
.plan ul { list-style: none; margin-bottom: 30px; }
.plan li { padding: 8px 0; border-bottom: 1px solid #33312D; font-size: 15px; color: #D8D2C6; }
.plan li::before { content: "— "; color: var(--rubric); }
.pricing-section .btn { border-color: var(--paper); color: var(--paper); }
.pricing-section .btn:hover { box-shadow: 3px 3px 0 rgba(250,246,239,.35); }
.pricing-section .btn-accent { border-color: var(--rubric-deep); color: #FFF8F2; }

/* ── Obsidian ───────────────────────────────────────────────────────────── */

.obsidian-section { padding: 96px 0; }
.obsidian-inner { display: flex; align-items: center; justify-content: space-between; gap: 40px; flex-wrap: wrap; }
.obsidian-section p { color: var(--ink-soft); max-width: 50ch; margin-top: 14px; font-size: 17px; }

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

.footer { border-top: 4px solid var(--ink); padding: 44px 0 60px; }
.privacy { font-size: 13px; color: var(--ink-faint); max-width: 78ch; line-height: 1.7; }
.footer-links { margin-top: 22px; font-family: var(--mono); font-size: 12.5px; color: var(--ink-faint); }
.footer-links a { color: var(--ink-soft); text-decoration: none; }
.footer-links a:hover { color: var(--rubric); }
.sep { margin: 0 10px; }

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

@media (max-width: 960px) {
  .app-layout { grid-template-columns: 1fr; }
  .app-controls { position: static; }
  .specimen-grid { grid-template-columns: repeat(2, 1fr); }
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr; }
  .plan.featured { transform: none; }
  .masthead-links { display: none; }
}
@media (max-width: 560px) {
  .specimen-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: 28px; }
}
