/* ==========================================================================
   CopyKit — design tokens
   Concept: "Typewriter & Red Pen" — bold monospace headlines (typebar feel)
   + a proofreader's red for corrections/accents, on crisp cool paper.
   Deliberately distinct from CalcMate's "Ledger & Tape" system.
   ========================================================================== */

:root {
  --paper: #F6F7F9;
  --paper-card: #FFFFFF;
  --grid-line: rgba(20, 21, 26, 0.05);

  --ink: #1A1B1F;
  --ink-soft: #5B5D66;
  --ink-faint: #92949C;

  --red: #B33939;
  --red-dark: #8F2E2E;
  --red-tint: #F5E4E3;

  --border: #E2E3E8;
  --alert: #B33939;

  --font-display: 'Space Mono', 'Courier New', monospace;
  --font-body: 'Work Sans', -apple-system, sans-serif;
  --font-mono: 'Space Mono', 'Courier New', monospace;

  --radius: 6px;
  --shadow-card: 0 1px 2px rgba(20,21,26,0.06), 0 1px 12px rgba(20,21,26,0.05);
  --shadow-lift: 0 8px 24px rgba(20,21,26,0.10);
}

@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;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
    var(--paper);
  background-size: 24px 24px, 24px 24px, 100% 100%;
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.18;
  margin: 0 0 0.5em 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(1.9rem, 3.8vw, 2.6rem); }
h2 { font-size: clamp(1.3rem, 2.4vw, 1.7rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em 0; color: var(--ink); font-family: var(--font-body); }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red-dark);
  font-weight: 700;
}

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(246,247,249,0.9);
  backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 40;
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; color: var(--ink); }
.logo .mark { color: var(--red); }
.site-nav { display: flex; gap: 26px; font-size: 0.94rem; font-weight: 500; font-family: var(--font-body); }
.site-nav a { color: var(--ink-soft); }
.site-nav a.active, .site-nav a:hover { color: var(--ink); text-decoration: none; }

/* ---------- Proofmark divider (signature element) ---------- */
.proofmark { width: 100%; height: 26px; display: block; color: var(--red); margin: 0; }
.ruler-section { margin: 60px 0; }

/* ---------- Hero / Tool ---------- */
.hero { padding: 48px 0 8px; }
.hero-head { max-width: 620px; margin-bottom: 30px; }
.hero-head h1 { margin-bottom: 14px; }
.hero-head p { color: var(--ink-soft); font-size: 1.04rem; }

.tool-card {
  background: var(--paper-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 30px;
}

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.field label { font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); font-family: var(--font-body); }
.field textarea {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #FCFCFB;
  color: var(--ink);
  resize: vertical;
  width: 100%;
  line-height: 1.55;
}
.field textarea:focus { border-color: var(--red); }

.result-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.result-box { padding: 18px; border-radius: 4px; background: var(--red-tint); border: 1px solid var(--border); }
.result-label { font-size: 0.76rem; color: var(--ink-soft); font-weight: 600; margin-bottom: 4px; font-family: var(--font-body); }
.result-value { font-family: var(--font-mono); font-size: 1.7rem; font-weight: 700; color: var(--ink); }

.text-toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.text-toolbar .btn { font-size: 0.85rem; padding: 10px 16px; }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 11px 22px;
  border-radius: 4px;
  border: 1px solid var(--red);
  background: var(--red);
  color: #FFFCFB;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--ink-soft); background: transparent; }

/* ---------- Sections / Article grid ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 8px; }
.section-head h2 { margin-bottom: 0; }
.see-all { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 700; }

.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }

.article-card {
  background: var(--paper-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.article-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.article-card .thumb { width: 100%; aspect-ratio: 16/9; display: block; background: var(--paper); }
.article-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.article-card .body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.article-card h3 { font-size: 1.02rem; margin-bottom: 0; font-family: var(--font-body); font-weight: 700; }
.article-card h3 a { color: var(--ink); }
.article-card h3 a:hover { color: var(--red); text-decoration: none; }
.article-card p { color: var(--ink-soft); font-size: 0.92rem; margin: 0; flex: 1; }
.read-more { font-family: var(--font-mono); font-size: 0.78rem; font-weight: 700; color: var(--red-dark); }

/* ---------- Why / features ---------- */
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.feature .num { font-family: var(--font-mono); color: var(--red); font-size: 0.83rem; font-weight: 700; }
.feature h3 { margin: 6px 0 6px; font-size: 1.02rem; font-family: var(--font-body); }
.feature p { color: var(--ink-soft); font-size: 0.93rem; margin: 0; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 40px 0; margin-top: 40px; }
.site-footer .wrap { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 24px; }
.footer-cols { display: flex; gap: 60px; flex-wrap: wrap; }
.footer-col h4 { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); margin-bottom: 10px; }
.footer-col a { display: block; color: var(--ink-soft); font-size: 0.9rem; margin-bottom: 8px; font-family: var(--font-body); }
.footer-col a:hover { color: var(--ink); }
.footer-note { color: var(--ink-faint); font-size: 0.82rem; margin-top: 26px; font-family: var(--font-body); }

/* ---------- Article page ---------- */
.article-header { padding: 42px 0 0; }
.breadcrumb { font-family: var(--font-mono); font-size: 0.76rem; color: var(--ink-faint); margin-bottom: 18px; }
.breadcrumb a { color: var(--ink-faint); }
.article-header h1 { max-width: 760px; }
.article-meta { color: var(--ink-faint); font-size: 0.85rem; font-family: var(--font-mono); margin-bottom: 24px; }
.article-hero-img { width: 100%; max-width: 900px; border-radius: var(--radius); overflow: hidden; margin: 8px 0 34px; box-shadow: var(--shadow-card); }
.article-hero-img img { width: 100%; display: block; }

.article-body { max-width: 720px; }
.article-body h2 { margin-top: 1.6em; font-size: 1.3rem; }
.article-body p { color: var(--ink); font-size: 1.02rem; font-family: var(--font-body); }
.article-body ul, .article-body ol { color: var(--ink); padding-left: 1.3em; margin-bottom: 1.2em; font-family: var(--font-body); }
.article-body li { margin-bottom: 0.4em; }
.article-body strong { color: var(--ink); }
.article-body .formula-box {
  font-family: var(--font-mono);
  background: var(--paper-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  padding: 14px 18px;
  border-radius: 4px;
  margin: 1.4em 0;
  font-size: 0.92rem;
  overflow-x: auto;
}

.tool-cta {
  margin: 2.2em 0;
  padding: 22px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--paper-card);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.tool-cta p { margin: 0; font-weight: 500; font-family: var(--font-body); }

.faq { margin-top: 2.4em; }
.faq-item { border-top: 1px solid var(--border); padding: 18px 0; }
.faq-item h3 { font-size: 1rem; margin-bottom: 8px; font-family: var(--font-body); font-weight: 700; }
.faq-item p { color: var(--ink-soft); margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .feature-grid { grid-template-columns: 1fr; gap: 20px; }
  .result-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .card-grid { grid-template-columns: 1fr; }
  .tool-card { padding: 20px; }
  .site-footer .wrap { flex-direction: column; }
  .footer-cols { gap: 32px; }
}
