/*
 * Vestra Hosting guides (vestra.systems/guides)
 * Loaded after /static/css/styles.css. Laid out like Vestra Transmissions, the
 * newsroom (vestracorp.com/news): a big page title, a three-up story grid, and a
 * 680px reading column with a sticky "On this page" list. Black by default; an
 * optional light mode is white, never grey. No borders, glows or gradient text.
 */

/* ------------------------------------------------------------ Light mode */

html[data-theme="light"] {
  color-scheme: light;
  --bg: #fff;
  --bg-2: #f5f5f7;
  --surface: #f2f2f4;
  --surface-2: #ececef;
  --ink: #0a0a0c;
  --ink-2: #3b3f46;
  --muted: #5f6670;          /* 5.9:1 on white */
  --line: rgba(0, 0, 0, 0.08);
  --line-2: rgba(0, 0, 0, 0.16);
  --signal: #1d4ed8;         /* 6.7:1 on white */
}

html[data-theme="light"] .guides .nav.is-scrolled,
html[data-theme="light"] .guides .nav.is-open {
  background: rgba(255, 255, 255, 0.78);
}

@media (max-width: 959.98px) {
  html.js[data-theme="light"] .guides .nav-links {
    background: rgba(255, 255, 255, 0.94);
  }
}

html[data-theme="light"] .guides .brand img { filter: brightness(0); }
html[data-theme="light"] .guides .footer-mark { color: #e9e9ec; }
html[data-theme="light"] .guides .story-media,
html[data-theme="light"] .guides .post-cover-media { background: var(--surface); }

@media (hover: hover) {
  html[data-theme="light"] .guides .nav-cta:hover { color: #fff; }
}

/* ---------------------------------------------------------------- Nav */

.guides .nav-section {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  min-height: 40px;
  margin-left: -0.35rem;
  margin-right: auto;
  font-size: 0.9rem;
  color: var(--ink-2);
  transition: color 0.25s var(--ease-out);
}

.guides .brand { margin-right: 0; }

.guides .nav-section::before {
  content: "";
  width: 1px;
  height: 1.1rem;
  background: var(--line-2);
}

.guides .nav-section[aria-current="page"] { color: var(--ink); }

@media (hover: hover) {
  .guides .nav-section:hover { color: var(--ink); }
}

/* Light / dark: a quiet text switch, only when JavaScript can run it. */
.theme-toggle {
  display: none;
  align-items: center;
  gap: 0.5rem;
  min-height: 40px;
  padding: 0 0.35rem;
  font-size: 0.9rem;
  color: var(--ink-2);
  transition: color 0.25s var(--ease-out);
}

.js .theme-toggle { display: inline-flex; }

.theme-toggle-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: inset -0.22rem 0 0 0 var(--bg);
  transition: box-shadow 0.5s var(--ease-out);
}

.theme-toggle[aria-pressed="true"] .theme-toggle-dot { box-shadow: inset 0 0 0 0 var(--bg); }

@media (hover: hover) {
  .theme-toggle:hover { color: var(--ink); }
}

/* ---------------------------------------------------------- Shared */

.guides .sep {
  margin-inline: 0.45rem;
  color: var(--muted);
}

.guides .section-title {
  max-width: none;
  font-size: clamp(1.5rem, 1.25rem + 1vw, 2.1rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.guides .link-arrow {
  min-height: 44px;
  font-size: 0.95rem;
}

.guides .link-arrow .story-arrow {
  width: 0.9em;
  height: 0.9em;
  transition: transform 0.35s var(--ease-out);
}

@media (hover: hover) {
  .guides .link-arrow:hover .story-arrow { transform: translateX(4px); }
}

/* Entrances come from hosting-motion.js (short, never pre-hidden); no page-wide fade. */

/* --------------------------------------------------------- Page head */

.guides .page-head {
  padding-top: calc(var(--nav-h) + clamp(3rem, 2rem + 5vw, 6.5rem));
  padding-bottom: clamp(1rem, 0.5rem + 1.5vw, 2rem);
}

.guides .page-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.6rem, 1.5rem + 4.2vw, 5.25rem);
  line-height: 1;
  letter-spacing: -0.045em;
}

.guides .page-lede {
  max-width: 36rem;
  margin-top: 0.9rem;
  font-size: clamp(1.06rem, 1rem + 0.3vw, 1.25rem);
  color: var(--ink-2);
}

/* ------------------------------------------------------------ Stories */

.guides .latest {
  padding-top: clamp(2.5rem, 2rem + 3vw, 5rem);
  padding-bottom: clamp(3rem, 2rem + 3vw, 5rem);
}

.guides .latest-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-bottom: clamp(1.25rem, 1rem + 1.25vw, 2.25rem);
}

.guides .story-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(2.5rem, 2rem + 2vw, 3.75rem) clamp(1.25rem, 1rem + 1.5vw, 2.25rem);
}

@media (min-width: 760px) {
  .guides .story-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1100px) {
  .guides .story-grid.is-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.guides .story { position: relative; }

.guides .story-media {
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: clamp(12px, 0.6rem + 0.6vw, 18px);
  background: #0d0f13;
  isolation: isolate;
}

.guides .story-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1s var(--ease-out);
}

.guides .story-meta {
  margin-top: 1.1rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.guides .story-title {
  margin-top: 0.35rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.25rem, 1.12rem + 0.45vw, 1.5rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.guides .story-title a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.3s var(--ease-out);
}

/* The whole story is clickable: the title link is stretched over it. */
.guides .story-title a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.guides .story-title a:focus-visible { outline: none; }

.guides .story:has(.story-title a:focus-visible) .story-media {
  outline: 2px solid var(--signal);
  outline-offset: 4px;
}

.guides .story-arrow {
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  margin-left: 0.3em;
  vertical-align: -0.02em;
}

.guides .story-title .story-arrow {
  opacity: 0;
  transform: translateX(-0.35em);
  transition: opacity 0.35s var(--ease-out), transform 0.45s var(--ease-out);
}

.guides .story-summary {
  display: -webkit-box;
  margin-top: 0.55rem;
  overflow: hidden;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink-2);
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-wrap: pretty;
}

@media (hover: hover) {
  .guides .story:hover .story-media img { transform: scale(1.035); }
  .guides .story:hover .story-title a { text-decoration-color: var(--line-2); }
  .guides .story:hover .story-title .story-arrow { opacity: 1; transform: none; }
}

.guides .story:has(.story-title a:focus-visible) .story-title .story-arrow {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------------- Post */

.guides .post-head,
.guides .post-main {
  width: 100%;
  max-width: calc(680px + 2 * var(--gutter));
  margin-inline: auto;
}

.guides .post-main {
  max-width: 680px;
  min-width: 0;
}

.guides .post-head {
  padding-top: calc(var(--nav-h) + clamp(3rem, 2rem + 5vw, 6.5rem));
}

.guides .post-crumbs {
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.guides .post-crumbs a {
  color: var(--ink-2);
  transition: color 0.25s var(--ease-out);
}

@media (hover: hover) {
  .guides .post-crumbs a:hover { color: var(--ink); }
}

.guides .post-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.2rem, 1.4rem + 3.2vw, 3.9rem);
  line-height: 1.04;
  letter-spacing: -0.042em;
  text-wrap: balance;
  overflow-wrap: break-word;
}

.guides .post-lede {
  margin-top: 1.1rem;
  font-size: clamp(1.1rem, 1.02rem + 0.35vw, 1.3rem);
  line-height: 1.5;
  color: var(--ink-2);
  text-wrap: pretty;
}

.guides .post-meta {
  margin-top: 1.1rem;
  font-size: 0.94rem;
  color: var(--muted);
}

.guides .post-layout {
  display: grid;
  margin-top: clamp(2.5rem, 2rem + 2.5vw, 4.5rem);
}

.guides .toc { display: none; }

@media (min-width: 1180px) {
  .guides .post-layout.has-toc {
    grid-template-columns: minmax(0, 1fr) minmax(0, 680px) minmax(0, 1fr);
    column-gap: clamp(2rem, 4vw, 4rem);
  }
  .guides .has-toc .post-main {
    grid-column: 2;
    margin-inline: 0;
  }
  .guides .toc {
    display: block;
    grid-column: 1;
    grid-row: 1;
    justify-self: end;
    align-self: start;
    position: sticky;
    top: calc(var(--nav-h) + 2.5rem);
    width: min(100%, 13rem);
  }
  .guides .toc-label {
    margin-bottom: 0.6rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--muted);
  }
  .guides .toc ol { display: grid; gap: 0.15rem; }
  .guides .toc .toc-level-3 { padding-left: 0.75rem; }
  .guides .toc a {
    display: block;
    padding-block: 0.3rem;
    font-size: 0.9375rem;
    line-height: 1.4;
    color: var(--ink-2);
    transition: color 0.25s var(--ease-out);
  }
  .guides .toc a.is-active,
  .guides .toc a:hover { color: var(--ink); }
}

/* -------------------------------------------------------------- Prose */

.guides .prose {
  max-width: none;
  font-size: 1.125rem;
  line-height: 1.75;
  color: var(--ink-2);
  overflow-wrap: break-word;
}

.guides .prose > * + * { margin-top: 1.25em; }

.guides .prose > p:first-child {
  font-size: clamp(1.15rem, 1.05rem + 0.35vw, 1.3rem);
  line-height: 1.6;
  color: var(--ink);
}

.guides .prose h2,
.guides .prose h3 {
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  text-wrap: balance;
  scroll-margin-top: calc(var(--nav-h) + 1.5rem);
}

.guides .prose h2 {
  margin-top: 2.1em;
  font-size: clamp(1.45rem, 1.25rem + 0.8vw, 1.85rem);
  line-height: 1.15;
  letter-spacing: -0.028em;
}

.guides .prose h3 {
  margin-top: 1.8em;
  font-size: clamp(1.15rem, 1.08rem + 0.3vw, 1.3rem);
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.guides .prose h2 + *,
.guides .prose h3 + * { margin-top: 0.6em; }

.guides .prose strong { color: var(--ink); font-weight: 600; }

.guides .prose a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--line-2);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: text-decoration-color 0.25s var(--ease-out);
}

@media (hover: hover) {
  .guides .prose a:hover { text-decoration-color: var(--ink-2); }
}

.guides .prose ul,
.guides .prose ol { padding-left: 1.25rem; }
.guides .prose ul { list-style: disc; }
.guides .prose ol { list-style: decimal; }
.guides .prose li + li { margin-top: 0.55em; }
.guides .prose li::marker { color: var(--muted); }

/* Quotes and notes: a quiet panel instead of a rule. */
.guides .prose blockquote {
  padding: 1rem 1.25rem;
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
}

.guides .prose blockquote > * + * { margin-top: 0.75em; }

.guides .prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--ink);
}

.guides .prose :not(pre) > code { overflow-wrap: anywhere; }

.guides .prose pre {
  overflow-x: auto;
  padding: 1rem 1.2rem;
  border-radius: 12px;
  background: var(--surface);
  font-size: 0.86rem;
  line-height: 1.65;
}

.guides .prose pre code { font-size: inherit; }

.guides .table-wrap { overflow-x: auto; }
.guides .table-wrap:focus-visible { outline: 2px solid var(--signal); outline-offset: 4px; }

/* Tables: rows separated by space and type, no rules. */
.guides .prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.guides .prose th,
.guides .prose td {
  padding: 0.6rem 1.25rem 0.6rem 0;
  text-align: left;
  vertical-align: top;
}

.guides .prose thead th {
  padding-bottom: 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
}

/* End of a guide: where to go next. */
.guides .post-end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  margin-top: clamp(3rem, 2.5rem + 2vw, 4.5rem);
  padding-bottom: clamp(3rem, 2rem + 3vw, 5rem);
  font-size: 0.95rem;
  color: var(--ink-2);
}

.guides .guide-related a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--line-2);
  text-underline-offset: 0.2em;
}

.guides .related { padding-top: clamp(2rem, 1.5rem + 3vw, 5rem); }

/* -------------------------------------------------------------- Motion */

@media (prefers-reduced-motion: reduce) {
  .guides .story-media img,
  .guides .story-arrow,
  .theme-toggle-dot { transition: none; }
  .guides .story:hover .story-media img { transform: none; }
}

@media print {
  .guides .nav, .guides .toc, .guides .footer, .theme-toggle { display: none; }
  html[data-theme="light"], html { --bg: #fff; --ink: #000; --ink-2: #222; }
}

/* ------------------------------------------------------------ Lead story */

.guides .lead { padding-top: clamp(1.5rem, 1rem + 2vw, 3rem); }

.guides .story-lead { display: grid; gap: 1.5rem; align-items: center; }

.guides .story-lead .story-media { aspect-ratio: 16 / 9; border-radius: clamp(14px, 0.7rem + 1vw, 24px); }

.guides .story-lead .story-title {
  margin-top: 0.5rem;
  font-size: clamp(1.9rem, 1.3rem + 2.2vw, 3.1rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.guides .story-lead .story-summary {
  margin-top: 0.9rem;
  font-size: clamp(1.05rem, 1rem + 0.25vw, 1.2rem);
  -webkit-line-clamp: 4;
}

.guides .lead-go {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1.25rem;
  font-weight: 500;
  color: var(--signal);
}

.guides .lead-go .story-arrow { margin: 0; opacity: 1; transform: none; transition: transform 0.35s var(--ease-out); }

@media (min-width: 900px) {
  .guides .story-lead { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(2rem, 4vw, 4rem); }
}

@media (hover: hover) {
  .guides .story-lead:hover .lead-go .story-arrow { transform: translateX(4px); }
}

/* --------------------------------------------------------- Mobile header */

.theme-toggle-text { min-width: 2.4em; text-align: left; }

@media (max-width: 959.98px) {
  .guides .nav-section { margin-left: 0; gap: 0.6rem; }
}

@media (max-width: 560px) {
  .guides .brand-sub { display: none; }
  .guides .theme-toggle-text { display: none; }
  .guides .theme-toggle { min-width: 40px; justify-content: center; }
}

@media (max-width: 359.98px) {
  .guides .nav-cta { display: none; }
}
