/* ==========================================================
   Site-wide styles: nav, footer, and content pages (template
   hub/detail pages, blog hub/article pages, About/Privacy/
   Terms/Contact). Loaded on every page. The invoice tool itself
   (form + live preview) is styled separately in /style.css,
   which is only loaded on pages that embed the tool.

   Repeats the same design tokens as style.css so this file
   works standalone on pages that never load style.css.
   ========================================================== */

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

:root {
  /* Paper & Ledger tokens — same five brand colors as style.css,
     kept under the site's original --color-* names so every rule
     below still works, just repainted. */
  --ink: #11161c;
  --paper: #fcfbf8;
  --ledger: #e4e1d8;
  --accent: #2f6f5e;
  --stamp: #c2413a;

  --color-bg: color-mix(in srgb, var(--paper) 92%, var(--ink) 8%);
  --color-surface: var(--paper);
  --color-border: color-mix(in srgb, var(--ledger) 55%, var(--ink) 45%);
  --color-text: var(--ink);
  --color-text-muted: color-mix(in srgb, var(--ink) 65%, var(--paper) 35%);
  --color-accent: var(--accent);
  --color-accent-dark: color-mix(in srgb, var(--accent) 75%, var(--ink) 25%);
  --color-accent-soft: color-mix(in srgb, var(--accent) 13%, var(--paper) 87%);
  --color-danger: var(--stamp);
  --color-success: var(--accent);
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(17, 22, 28, 0.07);
  --shadow-md: 0 3px 8px rgba(17, 22, 28, 0.08), 0 1px 2px rgba(17, 22, 28, 0.06);
  --font-display: "Bricolage Grotesque", "Segoe UI", Georgia, serif;
  --font-sans: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --content-max: 1400px;
}

html {
  font-size: 16px;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
}

p {
  margin: 0;
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

a {
  color: var(--color-accent);
}

button {
  font-family: inherit;
}

.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;
}

/* ==========================================================
   Site nav (shared header, injected via partials/header.html)
   ========================================================== */
.site-nav {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.site-nav__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-nav__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-text);
  text-decoration: none;
}

.site-nav__logo {
  width: 24px;
  height: 24px;
  color: var(--color-accent);
  flex: none;
}

.site-nav__links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1.75rem;
  margin: 0;
  padding: 0;
}

.site-nav__links a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.3rem 0.1rem;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.site-nav__links a:hover {
  color: var(--color-text);
}

.site-nav__links a.is-active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.site-nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  cursor: pointer;
}

.site-nav__toggle span {
  width: 16px;
  height: 2px;
  background: var(--color-text);
  border-radius: 1px;
}

@media (max-width: 720px) {
  .site-nav__toggle {
    display: flex;
  }

  .site-nav__nav {
    display: none;
    width: 100%;
    order: 3;
  }

  .site-nav__inner {
    flex-wrap: wrap;
  }

  .site-nav__inner.is-open .site-nav__nav {
    display: block;
  }

  .site-nav__links {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 0.75rem 0 0.25rem;
  }

  .site-nav__links a {
    display: block;
    width: 100%;
    padding: 0.5rem 0;
  }
}

/* ==========================================================
   Site footer (shared, injected via partials/footer.html)
   ========================================================== */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  margin-top: 3rem;
}

.site-footer__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 1.5rem;
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.site-footer__title {
  font-weight: 700;
  font-size: 1rem;
}

.site-footer__tagline {
  margin-top: 0.4rem;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  max-width: 32ch;
}

.site-footer__links {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.site-footer__links a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}

.site-footer__links a:hover {
  color: var(--color-accent);
}

.site-footer__bottom {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 1rem 1.5rem 2rem;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

/* ==========================================================
   Generic content page layout
   ========================================================== */
.site-container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.page-hero {
  padding: 3rem 1.5rem 2rem;
}

.page-hero__inner {
  max-width: var(--content-max);
  margin: 0 auto;
}

.breadcrumbs {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

.breadcrumbs a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--color-accent);
}

.page-hero h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  max-width: 46ch;
}

.page-hero__lede {
  margin-top: 0.85rem;
  font-size: 1.05rem;
  color: var(--color-text-muted);
  max-width: 62ch;
}

/* Hero content staggers in once on load, never repeats. */
@media (prefers-reduced-motion: no-preference) {
  .page-hero__inner > * {
    opacity: 0;
    animation: hero-rise 550ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  .page-hero__inner > *:nth-child(1) { animation-delay: 0ms; }
  .page-hero__inner > *:nth-child(2) { animation-delay: 90ms; }
  .page-hero__inner > *:nth-child(3) { animation-delay: 160ms; }

  @keyframes hero-rise {
    from {
      opacity: 0;
      transform: translateY(14px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

.content-section {
  padding: 2.5rem 1.5rem;
}

.content-section--muted {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.content-section__inner {
  max-width: var(--content-max);
  margin: 0 auto;
}

.content-section__inner--narrow {
  max-width: 760px;
}

.content-section h2 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
}

.content-section h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
}

/* "Prose" — long-form readable text used on template intros,
   blog articles, and legal pages */
.prose p {
  margin-bottom: 1rem;
  color: var(--color-text);
  max-width: 72ch;
}

.prose p:last-child {
  margin-bottom: 0;
}

.prose ul,
.prose ol {
  margin: 0 0 1rem;
  padding-left: 1.4rem;
  max-width: 72ch;
}

.prose li {
  margin-bottom: 0.4rem;
}

/* ==========================================================
   Checklist ("what to include on this invoice")
   ========================================================== */
.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
  max-width: 760px;
}

.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  font-size: 0.94rem;
}

.checklist li::before {
  content: "";
  flex: none;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--color-accent);
  margin-top: 0.45rem;
}

/* ==========================================================
   FAQ
   ========================================================== */
.faq-list {
  display: grid;
  gap: 0.75rem;
  max-width: 760px;
}

.faq-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}

.faq-item__question {
  font-weight: 700;
  font-size: 0.98rem;
  margin-bottom: 0.4rem;
}

.faq-item__answer {
  color: var(--color-text-muted);
  font-size: 0.92rem;
}

/* ==========================================================
   Related templates grid
   ========================================================== */
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.related-card {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  text-decoration: none;
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease;
}

.related-card:hover {
  border-color: var(--color-accent);
}

@media (prefers-reduced-motion: no-preference) {
  .related-card {
    transition: border-color 0.15s ease, transform 0.05s ease;
  }

  .related-card:active {
    transform: translateY(1px);
  }
}

.related-card__label {
  font-weight: 700;
  font-size: 0.95rem;
}

.related-card__hint {
  margin-top: 0.3rem;
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

/* ==========================================================
   Template / blog card grids (hub pages)
   ========================================================== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.entry-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--color-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.entry-card:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-md);
}

.entry-card__eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-accent);
}

.entry-card__title {
  font-size: 1.05rem;
  font-weight: 700;
}

.entry-card__desc {
  font-size: 0.88rem;
  color: var(--color-text-muted);
}

.entry-card--coming-soon {
  opacity: 0.6;
  cursor: default;
}

.entry-card--coming-soon:hover {
  border-color: var(--color-border);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================
   Blog article layout
   ========================================================== */
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
}

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

.article-toc {
  position: sticky;
  top: 1.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}

@media (max-width: 860px) {
  .article-toc {
    position: static;
  }
}

.article-toc__title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: 0.6rem;
}

.article-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.article-toc a {
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.88rem;
}

.article-toc a:hover {
  color: var(--color-accent);
}

.article-body h2 {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 2rem 0 0.85rem;
  scroll-margin-top: 1.5rem;
}

.article-body h2:first-child {
  margin-top: 0;
}

.article-meta {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

/* Call-to-action box used inside blog posts */
.cta-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
  background: var(--color-accent-soft);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 2rem 0;
}

.cta-box__text h3 {
  color: var(--color-accent-dark);
  margin-bottom: 0.3rem;
}

.cta-box__text p {
  color: var(--color-text);
  font-size: 0.9rem;
}

.cta-box .btn {
  flex: none;
}

/* ==========================================================
   Buttons (kept in sync with /style.css so shared partials —
   nav, footer, CTA boxes — look right on pages that never load
   the tool stylesheet)
   ========================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

@media (prefers-reduced-motion: no-preference) {
  .btn {
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
  }

  .btn:not(:disabled):hover {
    transform: translateY(-1px);
  }

  .btn:not(:disabled):active {
    transform: translateY(1px);
  }
}

.btn--primary {
  background: var(--color-accent);
  color: #fff;
}

/* :hover still matches a disabled button in most engines (it tracks
   cursor position, not interactivity) — gate every hover color change
   on :not(:disabled) so a disabled button (e.g. the download button
   mid-morph on tool pages) doesn't flash a hover color while the
   cursor happens to be resting on it. */
.btn--primary:not(:disabled):hover {
  background: var(--color-accent-dark);
}

.btn--ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-border);
}

.btn--ghost:not(:disabled):hover {
  background: var(--color-surface);
  color: var(--color-danger);
  border-color: var(--color-danger);
}

.btn--small {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

/* Neutral secondary action (unlike .btn--ghost, doesn't turn red on
   hover — that styling is reserved for destructive tool actions). */
.btn--outline {
  background: transparent;
  color: var(--color-accent-dark);
  border-color: var(--color-accent);
}

.btn--outline:hover {
  background: var(--color-accent-soft);
}

/* ==========================================================
   Print: never print the surrounding site chrome
   ========================================================== */
@media print {
  .site-nav,
  .site-footer,
  .tool-toolbar,
  .page-hero,
  .content-section,
  .article-toc {
    display: none !important;
  }
}
