/* ==========================================================================
   NovoltGear — global tokens & base styles
   ==========================================================================
   Contrast policy (WCAG 2.1 AA), verified by scripts/check-contrast.mjs:

     --color-accent       #9C5A73   ORNAMENT ONLY (rules, marks, logo, badges).
                                    It happens to clear 4.5:1 on the page
                                    backgrounds, but the rule is still: never
                                    let it carry body text or a control border.
     --color-accent-text  #7C4059   Every letter and every control/state border.
                                    7.26:1 on --color-bg, 6.62:1 on --color-bg-alt,
                                    7.68:1 on white.
     --color-border-strong #8E828A  Form fields and floating buttons.
                                    3.48:1 / 3.17:1 / 3.68:1 — clears the 3:1
                                    non-text requirement on all three grounds.
   ========================================================================== */

:root {
  /* Grounds */
  --color-bg: #FBF8F6;
  --color-bg-alt: #F3EDEA;
  --color-bg-deep: #2A2126;
  --color-surface: #FFFFFF;

  /* Type */
  --color-text: #221C20;
  --color-text-light: #6D6269;
  --color-text-invert: #FBF8F6;

  /* Brand */
  --color-accent: #9C5A73;        /* ornament only */
  --color-accent-text: #7C4059;   /* all text + control borders */
  --color-accent-soft: #F0E2E7;   /* tinted panels */
  --color-gold: #B98A4B;          /* ornament only — device/luxe cue */

  /* Lines */
  --color-border: #E9E1E3;
  --color-border-strong: #8E828A;

  /* Feedback */
  --color-success: #2F6B4F;
  --color-error: #A83232;

  /* Type stacks */
  --font-serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* Rhythm */
  --container: 1240px;
  --container-narrow: 760px;
  --radius: 4px;
  --radius-lg: 10px;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(34, 28, 32, 0.05);
  --shadow-md: 0 4px 16px rgba(34, 28, 32, 0.07);
  --shadow-lg: 0 12px 36px rgba(34, 28, 32, 0.10);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
picture,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.6em;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2rem, 1.4rem + 2.4vw, 3.1rem); }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.1rem); }
h3 { font-size: clamp(1.2rem, 1.05rem + 0.6vw, 1.5rem); }
h4 { font-size: 1.1rem; }

p { margin: 0 0 1.2em; }

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

/* ---------- Focus ---------- */
:focus-visible {
  outline: 2px solid var(--color-accent-text);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.container--narrow {
  max-width: var(--container-narrow);
}

main { display: block; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 26px;
  border: 1px solid var(--color-text);
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition);
}
.btn:hover {
  background: var(--color-text);
  color: var(--color-bg);
  text-decoration: none;
}

.btn--accent {
  background: var(--color-accent-text);
  border-color: var(--color-accent-text);
  color: #FFFFFF;
}
.btn--accent:hover {
  background: #66344A;
  border-color: #66344A;
  color: #FFFFFF;
}

.btn--ghost {
  border-color: var(--color-border-strong);
  color: var(--color-text);
}
.btn--ghost:hover {
  background: var(--color-text);
  border-color: var(--color-text);
  color: var(--color-bg);
}

/* ---------- Forms ---------- */
label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  margin-bottom: 7px;
  color: var(--color-text);
}

input[type='text'],
input[type='email'],
input[type='search'],
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  transition: border-color var(--transition);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--color-accent-text);
  outline: none;
}

/* Scoped re-declaration: the base rule above sets `outline: none`, and the
   global :focus-visible block has the same specificity as these element
   selectors, so which one wins would depend on stylesheet order. Declaring it
   here with the attribute-selector-scoped form keeps it deterministic. */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--color-accent-text);
  outline-offset: 1px;
}

/* ---------- Section helpers ---------- */
.section { padding: 72px 0; }
.section--alt { background: var(--color-bg-alt); }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 34px;
}

.section-head__title {
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 1.2rem + 0.9vw, 1.95rem);
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

.section-head__link {
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--color-accent-text);
}

.eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-accent-text);
  margin-bottom: 12px;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 12px 20px;
  background: var(--color-text);
  color: var(--color-bg);
  font-size: 14px;
}
.skip-link:focus { left: 0; }

/* ---------- Cookie banner ---------- */
.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 24px;
  background: var(--color-bg-deep);
  color: var(--color-text-invert);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
}
.cookie-banner.show { display: flex; }
.cookie-banner p { margin: 0; }
.cookie-banner a { color: #F0C9D8; text-decoration: underline; }
.cookie-banner .btn {
  border-color: var(--color-text-invert);
  color: var(--color-text-invert);
  flex-shrink: 0;
}
.cookie-banner .btn:hover {
  background: var(--color-text-invert);
  color: var(--color-bg-deep);
}

@media (max-width: 640px) {
  .cookie-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 18px;
  }
}

/* ---------- Scroll to top ---------- */
.scroll-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 80;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border-strong);
  border-radius: 50%;
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all var(--transition);
  box-shadow: var(--shadow-md);
}
.scroll-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.scroll-top:hover { background: var(--color-text); color: var(--color-bg); }
.scroll-top svg { width: 20px; height: 20px; }

/* ---------- Prose (article body) ---------- */
.prose {
  font-size: 17px;
  line-height: 1.78;
  color: var(--color-text);
}
.prose > * + * { margin-top: 1.15em; }
.prose h2 {
  margin-top: 2.1em;
  padding-top: 0.2em;
  font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.8rem);
}
.prose h3 { margin-top: 1.7em; font-size: 1.22rem; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: 0.5em; }
.prose li::marker { color: var(--color-accent); }
.prose strong { font-weight: 600; }
.prose blockquote {
  margin: 1.8em 0;
  padding: 4px 0 4px 24px;
  border-left: 3px solid var(--color-accent);
  font-family: var(--font-serif);
  font-size: 1.16em;
  font-style: italic;
  color: var(--color-text-light);
}
.prose img {
  border-radius: var(--radius);
  margin: 1.9em 0;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  margin: 1.8em 0;
}
.prose th, .prose td {
  padding: 11px 14px;
  border: 1px solid var(--color-border);
  text-align: left;
}
.prose th {
  background: var(--color-bg-alt);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.prose hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin: 2.4em 0;
}

/* ---------- Page header ---------- */
.page-header {
  padding: 56px 0 40px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 44px;
}
.page-header h1 { margin-bottom: 0.3em; }
.page-header p {
  color: var(--color-text-light);
  max-width: 62ch;
  margin: 0;
}

/* ---------- Legal / long-form pages ---------- */
.legal {
  max-width: 780px;
  margin: 0 auto;
  font-size: 16px;
  line-height: 1.75;
}
.legal h2 {
  margin-top: 2.2em;
  font-size: 1.35rem;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--color-border);
}
.legal h3 { margin-top: 1.6em; font-size: 1.1rem; }
.legal ul { padding-left: 1.3em; }
.legal li { margin-bottom: 0.45em; }
.legal .updated {
  font-size: 14px;
  color: var(--color-text-light);
  margin-bottom: 2.2em;
}

/* ---------- Shared card grid ----------
   Used by the article index, category pages, the homepage and the "More in …"
   block at the end of every article. It lives here rather than in each page's
   scoped <style> because Astro scopes those styles to the page that declares
   them — the same class in BlogPostLayout.astro silently fell back to one
   column until this moved. One definition, every consumer. */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 26px;
  padding-bottom: 20px;
}

@media (max-width: 640px) {
  .posts-grid { grid-template-columns: 1fr; gap: 20px; }
}

@media (max-width: 640px) {
  .section { padding: 52px 0; }
  .container { padding: 0 18px; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 10px; }
}

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