/* ==========================================================================
   serverdrivers.com - main stylesheet
   Mobile-first. Base rules target a 360px screen; wider layouts are layered
   on at 480px, 768px and 1024px. Light theme only.
   ========================================================================== */

:root {
  color-scheme: only light;

  --paper: #ffffff;
  --ink: #0d0b2e;
  --text: #1d1f33;
  --text-soft: #34364d;
  --muted: #565a70;
  --blue: #0a3fb0;
  --blue-deep: #072d82;
  --tint: #eef2fb;
  --grey: #eceef3;
  --grey-hover: #e1e5ee;
  --rule: #dde1ec;
  --frame: #dfe3ee;

  --font-head: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-body: "Open Sans", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;

  --step-body: clamp(1.0625rem, 1.02rem + 0.22vw, 1.1875rem);
  --step-lead: clamp(1.125rem, 1.05rem + 0.4vw, 1.3125rem);
  --step-h1: clamp(1.85rem, 1.3rem + 2.6vw, 3.2rem);
  --step-h2: clamp(1.4rem, 1.15rem + 1.2vw, 1.875rem);
  --step-h2-legal: clamp(1.25rem, 1.1rem + 0.7vw, 1.5rem);

  --measure: 53.25rem;
  --gutter: 1rem;
  --radius: 4px;
}

@media (min-width: 480px) {
  :root { --gutter: 1.25rem; }
}

@media (min-width: 768px) {
  :root { --gutter: 1.5rem; }
}

/* ---------- Reset ---------- */

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

html {
  background-color: var(--paper);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "masthead"
    "story"
    "foot";
  background-color: var(--paper);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-body);
  line-height: 1.7;
  overflow-wrap: break-word;
}

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

a {
  color: var(--blue);
  text-underline-offset: 0.2em;
  transition: color 0.2s ease, background-color 0.2s ease;
}

a:hover {
  color: var(--blue-deep);
}

a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* ---------- Reading progress (index only) ---------- */

.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10;
  width: 100%;
  height: 3px;
  background-color: var(--blue);
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
}

/* ---------- Layout wrapper ---------- */

.measure {
  width: 100%;
  max-width: calc(var(--measure) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.story {
  grid-area: story;
  min-width: 0;
  background-color: var(--paper);
  color: var(--text);
}

/* ---------- Masthead ---------- */

.masthead {
  grid-area: masthead;
  position: relative;
  z-index: 2;
  background-color: var(--paper);
  color: var(--ink);
  box-shadow: 0 8px 24px -14px rgba(13, 11, 46, 0.3);
}

.masthead__bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  min-height: 3.75rem;
  padding: 0.35rem var(--gutter);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--font-head);
  font-size: 1.375rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  color: var(--blue);
}

.label {
  display: inline-block;
  padding: 0.4rem 0.6rem;
  border-radius: 3px;
  background-color: var(--tint);
  color: var(--blue-deep);
  font-family: var(--font-head);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

@media (min-width: 768px) {
  .masthead__bar { min-height: 5.25rem; }
  .brand { font-size: 1.875rem; }
}

/* ---------- Article header ---------- */

.story-head {
  padding-top: 1.25rem;
}

.kicker {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--ink);
}

.story-head h1 {
  margin: 0.6rem 0 0;
  font-family: var(--font-head);
  font-size: var(--step-h1);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.025em;
  color: var(--ink);
  text-wrap: balance;
}

.dek {
  margin: 1rem 0 1.5rem;
  font-size: var(--step-lead);
  line-height: 1.5;
  color: var(--text-soft);
}

@media (min-width: 768px) {
  .story-head { padding-top: 1.75rem; }
  .dek { margin-bottom: 1.75rem; }
}

/* ---------- Frames: images and looping video ---------- */

.frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: var(--ratio, 16 / 9);
  border-radius: var(--radius);
  background-color: var(--frame);
}

.frame > img,
.frame > video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

.frame--hero { --ratio: 3 / 2; }
.frame--portrait { --ratio: 4 / 3; }

.frame--desk > img { object-position: 55% 50%; }
.frame--screens > video { object-position: 50% 66%; }
.frame--laptop > video { object-position: 40% 50%; }
.frame--pointing > video { object-position: 74% 40%; }
.frame--hero > img { object-position: 50% 38%; }

@media (min-width: 768px) {
  .frame--hero { --ratio: 2.2 / 1; }
  .frame--portrait { --ratio: 1 / 1; }
}

figure,
.hero-figure {
  margin: 0;
}

figcaption {
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--muted);
}

/* ---------- Byline ---------- */

.byline {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "by"
    "meta";
  gap: 0.35rem 1rem;
  margin: 1.125rem 0 0;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--ink);
}

.byline__by {
  grid-area: by;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
}

.byline__mark {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background-color: var(--tint);
  color: var(--blue);
}

.byline__mark svg {
  width: 1rem;
  height: 1rem;
}

.byline__meta {
  grid-area: meta;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1rem;
  margin: 0;
  color: var(--text-soft);
}

.byline__read {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.byline__read svg {
  width: 1rem;
  height: 1rem;
  color: var(--blue);
}

@media (min-width: 768px) {
  .byline {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "by meta";
    align-items: center;
  }
}

/* ---------- Intro ---------- */

.intro {
  padding-top: 1.75rem;
}

.intro p {
  margin: 0 0 1.1rem;
  font-size: var(--step-lead);
  line-height: 1.65;
  color: var(--text);
}

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

@media (min-width: 768px) {
  .intro { padding-top: 2.5rem; }
}

/* ---------- Numbered question sections ---------- */

.story {
  counter-reset: question;
}

.q-section {
  display: flow-root;
  padding-block: 1.25rem;
  background-color: var(--paper);
  color: var(--text);
}

.q-section h2,
.faq h2 {
  margin: 0 0 1rem;
  font-family: var(--font-head);
  font-size: var(--step-h2);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-wrap: balance;
}

.q-section h2::before {
  counter-increment: question;
  content: counter(question) ". ";
}

.q-section p {
  margin: 0 0 1.1rem;
}

.answer {
  padding-left: 1rem;
  border-left: 3px solid var(--blue);
}

.answer strong {
  color: var(--ink);
}

.q-section .wrap-up {
  clear: both;
  padding-top: 0.5rem;
}

.checklist,
.steps {
  display: flow-root;
  margin: 0 0 1.25rem;
  padding-left: 1.4rem;
}

.checklist li,
.steps li {
  margin-bottom: 0.55rem;
  padding-left: 0.2rem;
}

.checklist li::marker {
  color: var(--blue);
}

.steps li::marker {
  color: var(--blue);
  font-weight: 700;
}

/* Inset media floats beside the text on wider screens */

.inset {
  margin: 1.5rem 0;
}

@media (min-width: 768px) {
  .q-section { padding-block: 1.75rem; }

  .inset {
    width: min(20rem, 42%);
    margin-top: 0.4rem;
    margin-bottom: 1rem;
  }

  .inset--right {
    float: right;
    margin-left: 1.75rem;
  }

  .inset--left {
    float: left;
    margin-right: 1.75rem;
  }
}

@media (min-width: 1024px) {
  .q-section { padding-block: 2rem; }
}

/* ---------- Calls to action ---------- */

.cta-block {
  margin: 1.25rem 0 0.25rem;
  clear: both;
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding-block: 0.5rem;
  font-family: var(--font-head);
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--blue);
  text-decoration: none;
}

.cta__text {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.28em;
}

.cta::after {
  content: "\2192";
  content: "\2192" / "";
  transition: transform 0.2s ease;
}

.cta:hover {
  color: var(--blue-deep);
}

.cta:hover::after {
  transform: translateX(4px);
}

.link-note {
  margin: 0.1rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--muted);
}

/* ---------- Quick answers (accordion) ---------- */

.faq {
  padding-block: 1.75rem 2.25rem;
  background-color: var(--paper);
  color: var(--text);
}

.faq h2 {
  margin-bottom: 1.25rem;
}

.faq-item {
  margin: 0 0 0.5rem;
  border-radius: var(--radius);
  background-color: var(--grey);
  color: var(--text);
}

.faq-item summary {
  position: relative;
  display: block;
  min-height: 44px;
  padding: 0.9rem 3.25rem 0.9rem 1.1rem;
  border-radius: var(--radius);
  font-family: var(--font-head);
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  transition: background-color 0.2s ease;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  position: absolute;
  top: 50%;
  right: 1.1rem;
  transform: translateY(-50%);
  font-family: var(--font-head);
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1;
  color: var(--blue);
}

.faq-item summary:hover {
  background-color: var(--grey-hover);
}

.faq-item[open] summary::after {
  content: "\2212";
}

.faq-answer {
  padding: 0 1.1rem 1.1rem;
}

.faq-answer p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.65;
}

@media (min-width: 768px) {
  .faq { padding-block: 2rem 3rem; }
  .faq-item summary { padding-left: 1.4rem; font-size: 1.125rem; }
  .faq-answer { padding: 0 1.4rem 1.25rem; }
}

/* ---------- Closing section ---------- */

.q-section.next-step {
  margin-top: 0.5rem;
  padding-block: 2.5rem;
  background-color: var(--tint);
  color: var(--text);
}

.next-step .cta-block {
  margin-top: 1.5rem;
}

.next-step .cta {
  display: flex;
  justify-content: center;
  min-height: 52px;
  padding: 0.85rem 1.5rem;
  border-radius: 6px;
  background-color: var(--blue);
  color: #ffffff;
  font-size: 1.125rem;
  box-shadow: 0 6px 16px -8px rgba(10, 63, 176, 0.7);
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.next-step .cta__text {
  text-decoration: none;
}

.next-step .cta:hover {
  background-color: var(--blue-deep);
  color: #ffffff;
  transform: translateY(-1px);
}

.next-step .link-note {
  margin-top: 0.6rem;
}

@media (min-width: 480px) {
  .next-step .cta { display: inline-flex; }
}

@media (min-width: 768px) {
  .q-section.next-step { padding-block: 3.25rem; }
}

/* ---------- Footer (publisher imprint) ---------- */

.page-footer {
  grid-area: foot;
  padding-block: 2.5rem 3rem;
  background-color: var(--paper);
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.65;
}

.page-footer p {
  margin: 0;
}

.publisher {
  margin-bottom: 1rem;
  color: var(--muted);
}

.publisher strong {
  color: var(--ink);
  font-weight: 700;
}

.page_links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
  margin-bottom: 1rem;
}

.page_links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
}

.page_links a:hover {
  color: var(--blue-deep);
  text-decoration: underline;
}

.site_note {
  max-width: 46rem;
  color: var(--muted);
}

@media (min-width: 768px) {
  .page-footer { padding-block: 3.5rem 4rem; }
}

/* ---------- Legal and about pages ---------- */

.legal {
  padding-block: 1.5rem 3rem;
  background-color: var(--paper);
  color: var(--text);
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.legal h1 {
  margin: 0.5rem 0 0.5rem;
  font-family: var(--font-head);
  font-size: clamp(1.75rem, 1.3rem + 2vw, 2.6rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--ink);
  text-wrap: balance;
}

.version-line {
  margin: 0 0 1.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--muted);
}

.legal h2 {
  margin: 2.25rem 0 0.5rem;
  font-family: var(--font-head);
  font-size: var(--step-h2-legal);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.legal p,
.legal li {
  color: var(--text);
}

.legal p {
  margin: 0 0 1rem;
}

.legal ul {
  margin: 0 0 1.25rem;
  padding-left: 1.4rem;
}

.legal li {
  margin-bottom: 0.45rem;
}

.legal li::marker {
  color: var(--blue);
}

.legal address {
  margin: 0 0 1.25rem;
  font-style: normal;
  color: var(--text);
}

.legal .lead {
  font-size: var(--step-lead);
  line-height: 1.6;
  color: var(--text-soft);
}

@media (min-width: 768px) {
  .legal { padding-block: 2.25rem 4.5rem; }
}
