/* ============================================================
   VISIONS, CHAPTER II — STATIC SITE
   DESIGN SYSTEM — SINGLE SOURCE OF TRUTH
   All colors, fonts, radii, etc. are defined here and only here.
   The structural tokens come from the original app's src/index.css;
   the palette has since been reworked from amber/red to blue.
   To restyle the site, edit the :root block.
   ============================================================ */

:root {
  /* Fonts */
  --font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;

  --background: #070b12;
  --foreground: #ffffff;

  --card: #070b12;
  --card-foreground: #ffffff;
  --card-border: #25528f;

  --primary: #1e90ff;
  --primary-foreground: #000000;

  --secondary: #21aefc;
  --secondary-foreground: #000000;

  --muted: #41607d;
  --muted-foreground: #c9d6e4;

  --accent: #33a6ff;
  --accent-foreground: #0a1420;

  --border: #2a3647;
  --ring: #33a6ff;

  --radius: 0.5rem;
}

/* ----------------------------------------------------------
   RESET
   ---------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
  border: 0 solid var(--border);
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  line-height: 1.5;
}

body {
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  line-height: inherit;
  -webkit-font-smoothing: antialiased;
}

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

button {
  font-family: inherit;
  font-size: 100%;
  line-height: inherit;
  color: inherit;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--foreground);
}

ul {
  padding: 0;
  list-style: none;
}

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* ----------------------------------------------------------
   LAYOUT
   ---------------------------------------------------------- */

.page {
  min-height: 100vh;
  background-color: var(--background);
}

.container {
  width: 100%;
  margin-inline: auto;
  padding: 4rem 1rem;
}

@media (min-width: 640px) {
  .container {
    max-width: 640px;
  }
}
@media (min-width: 768px) {
  .container {
    max-width: 768px;
  }
}
@media (min-width: 1024px) {
  .container {
    max-width: 1024px;
  }
}
@media (min-width: 1280px) {
  .container {
    max-width: 1280px;
  }
}
@media (min-width: 1400px) {
  .container {
    max-width: 1400px;
  }
}

/* ----------------------------------------------------------
   MASTHEAD
   ---------------------------------------------------------- */

.masthead {
  text-align: center;
  margin-bottom: 3rem;
}

.masthead--visions img {
  --logo-scale: 2.54545;
  width: calc(100% / var(--logo-scale));
  max-width: calc(42rem / var(--logo-scale));
}

/* A block-level anchor gives the logo a stable containing block, so the
   percentage widths below resolve against the container rather than against
   a shrink-to-fit box. */
.masthead a {
  display: block;
  text-decoration: none;
}

.masthead img {
  width: 100%;
  max-width: 42rem;
  margin-inline: auto;
  object-fit: contain;
}

.masthead--visions img {
  --logo-scale: 2.54545;
  width: calc(100% / var(--logo-scale));
  max-width: calc(42rem / var(--logo-scale));
}

/* ----------------------------------------------------------
   CARD
   ---------------------------------------------------------- */

.card-wrap {
  max-width: 42rem;
  margin-inline: auto;
}

.card {
  padding: 1.5rem;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  background-color: var(--card);
  color: var(--card-foreground);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.card-header {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 1.5rem 1.5rem 2rem;
  text-align: center;
}

.card-hero {
  margin-inline: auto;
  margin-bottom: 1.5rem;
  width: 100%;
  max-width: 28rem;
  overflow: hidden;
  border-radius: var(--radius);
}

/* The hero is cropped at every viewport: the box is wider than the image's
   2:1 ratio on desktop (cropping top/bottom) and narrower than it on a phone
   in portrait (cropping left/right). Anchoring to the right edge keeps the
   right-hand side of the picture in frame when the crop is horizontal, while
   leaving the vertical crop centred as before. */
.card-hero img {
  width: 100%;
  height: 12rem;
  object-fit: cover;
  object-position: 100% 50%;
}

.card-title {
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.025em;
}

.card-content {
  padding: 0 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ----------------------------------------------------------
   PROSE
   ---------------------------------------------------------- */

.prose {
  color: var(--muted-foreground);
  text-align: justify;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.prose--tight {
  gap: 0.75rem;
}

.prose p,
.prose li {
  text-align: justify;
}

/* Inline code. The background is the same gray as --border, so code chips sit
   on the one neutral the design system already defines. Sized in `em` so the
   chip tracks whatever text it is embedded in, including the smaller FAQ
   panels. */
code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  color: var(--primary);
  background-color: var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: 0.15em 0.4em;
  /* Paths and commands are single long tokens; let them break rather than
     overflow the card on narrow viewports. */
  overflow-wrap: break-word;
  /* ...but break them on their own boundaries, never with a hyphen inserted
     into a command. */
  hyphens: none;
  -webkit-hyphens: none;
}

/* A multi-line terminal block. The inline `code` chip above is a pill per
   span, which would render a two-line prompt as two disjointed pills; making
   the code element a block instead puts one continuous panel behind every
   line. `pre-wrap` keeps the authored line breaks while still letting a long
   line wrap on narrow viewports rather than forcing a horizontal scroll. */
.terminal {
  margin: 0;
  min-width: 0;
}

.terminal > code {
  display: block;
  padding: 0.75rem 1rem;
  white-space: pre-wrap;
  /* .prose justifies its text; a terminal block must not be justified. */
  text-align: left;
}

/* An opt-in blinking cursor for a terminal block that ends on a live prompt.
   A generated inline-block, sized in `em` so it tracks the monospace text at
   any viewport, rather than a block glyph like U+2588 — the glyph's height and
   baseline vary with whichever font in the stack actually resolves. */
.terminal--prompt > code::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 0.15em;
  /* An empty inline-block takes its bottom margin edge as its baseline, so a
     numeric vertical-align offsets the cursor from the text baseline directly.
     `text-bottom` instead aligns it to the bottom of the content area, which
     includes the font's descender, leaving the cursor hanging ~0.2em low. The
     small negative value lets it dip just under the baseline the way a real
     terminal cell does; nudge it toward 0 to sit the cursor exactly on it. */
  vertical-align: -0.125em;
  background-color: var(--primary);
  animation: cursor-blink 1.1s steps(1, end) infinite;
}

/* steps(1, end) holds each value for its whole interval, so this is a hard
   on/off square wave rather than a fade. */
@keyframes cursor-blink {
  50% {
    opacity: 0;
  }
}

.note {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  text-align: justify;
}

.disc {
  list-style: disc;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.plain {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.lead-in {
  margin-bottom: 0.5rem;
}

/* ----------------------------------------------------------
   BUTTONS
   ---------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease-in-out;
  height: 2.75rem;
  padding-inline: 2rem;
}

.btn--block {
  width: 100%;
  display: flex;
}

.btn--primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
}

.btn--primary:hover {
  filter: brightness(1.1);
  color: var(--primary-foreground);
}

.btn--outline {
  border: 1px solid var(--card-border);
  background-color: var(--background);
  color: var(--foreground);
}

.btn--outline:hover {
  background-color: var(--accent);
  color: var(--accent-foreground);
  filter: brightness(1.1);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.5;
}

.btn-link {
  display: block;
  text-decoration: none;
}

/* Inline text buttons used as cross-references inside the FAQ */
.xref {
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s ease-in-out;
}

.xref:hover {
  color: var(--foreground);
}

/* ----------------------------------------------------------
   ACCORDION (native <details>)
   ---------------------------------------------------------- */

.accordion {
  width: 100%;
}

.accordion__item {
  border-bottom: 1px solid var(--border);
}

.accordion__item > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding-block: 1rem;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  transition: all 0.2s ease-in-out;
}

.accordion__item > summary::-webkit-details-marker {
  display: none;
}

.accordion__item > summary:hover {
  text-decoration: underline;
}

.accordion__item > summary::after {
  /* lucide-react "chevron-down", tinted with currentColor via a mask */
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  content: "";
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  background-color: currentColor;
  transition: transform 0.2s ease-in-out;
  -webkit-mask: var(--chevron) center / contain no-repeat;
  mask: var(--chevron) center / contain no-repeat;
}

.accordion__item[open] > summary::after {
  transform: rotate(180deg);
}

.accordion__panel {
  padding-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

/* ----------------------------------------------------------
   FOOTER
   ---------------------------------------------------------- */

.footer {
  max-width: 42rem;
  margin: 2rem auto 0;
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.footer a {
  color: inherit;
}

/* ----------------------------------------------------------
   NARROW VIEWPORTS (phone, portrait)
   ---------------------------------------------------------- */

/* Justified text only looks right when the measure is wide enough for the
   browser to absorb the slack of each line into the word-gaps unnoticed. In
   portrait the three nested gutters (container + card + card-content) spend
   ~160px of a ~390px viewport, leaving a ~230px measure — around 30 characters
   per line, where a single long word tears a visible river open.

   Three things widen the measure in characters: narrower gutters, type that
   scales down with the viewport, and hyphenation, which gives the justifier
   break points *inside* long words. The last is what actually closes the gaps;
   it relies on <html lang="en">, which the pages set. */
@media (max-width: 640px) {
  .container {
    padding-inline: 0.75rem;
  }

  .card {
    padding: 0.75rem;
  }

  .card-header {
    padding: 0.75rem 0.75rem 1.5rem;
  }

  .card-content {
    padding: 0 0.75rem 0.75rem;
  }

  /* ~13px at 390px wide, growing to the full 16px by the time the viewport is
     roughly 470px, where the measure no longer needs the help. */
  .prose,
  .note,
  .accordion__panel {
    font-size: clamp(0.8125rem, 3.4vw, 1rem);
  }

  .prose p,
  .prose li,
  .note,
  .accordion__panel {
    hyphens: auto;
    -webkit-hyphens: auto;
    hyphenate-limit-chars: 6 3 3;
  }

  /* A last resort for anything the hyphenator cannot break, such as a URL:
     overflow rather than a line with two words on it. */
  .prose p,
  .prose li {
    overflow-wrap: break-word;
  }

  .card-title {
    font-size: 1.625rem;
  }
}

/* ----------------------------------------------------------
   ACCESSIBILITY
   ---------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  html {
    scroll-behavior: auto !important;
  }
  /* The rule above crushes every duration to 0.01ms; for an infinite blink
     that is a strobe, not a stillness. Park the cursor on, solid. */
  .terminal--prompt > code::after {
    animation: none !important;
    opacity: 1;
  }
}
