/* =========================================================
   base.css — reset, page background and the main layout
   ========================================================= */

/* Reset: remove browser default spacing so layout is predictable */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  min-height: 100dvh;                /* dvh = real visible height on mobile (ignores in-app toolbars) */
  display: grid;
  justify-items: center;
  align-content: start;              /* phones: start at the top, never float in the middle */
  padding:
    max(var(--space-14), env(safe-area-inset-top))    /* room for the share button */
    var(--space-6)                                     /* Groundwork phone gutter: 24px */
    max(var(--space-10), env(safe-area-inset-bottom));
  position: relative;
  overflow-x: hidden;

  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.5;

  /* Faint grid: two 1px line gradients repeated every 48px */
  background-image:
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 48px 48px;
}

/* Bigger screens have room: centre the column vertically */
@media (min-width: 768px) {
  body { align-content: center; }
}

/* Fade the grid out towards the edges */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 25%, transparent 25%, var(--bg) 70%);
  pointer-events: none;
  z-index: 0;
}

/* The column that holds everything */
.hub {
  position: relative;
  z-index: 2;                         /* above the grid fade and the lamp */
  width: 100%;
  max-width: var(--hub-width);
  min-width: 0;                       /* grid items default to min-width:auto — without this,
                                         one long unbreakable line could stretch the page */
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Vertical rhythm between blocks: header → quote → links → song → footer */
.hub > * + *       { margin-top: var(--space-8); }
.hub > .quote-slot { margin-top: var(--space-5); }
.hub > .quote-slot:empty { display: none; }

/* Groundwork focus: solid 2px ring, 3px offset, on every interactive element */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Respect people who've asked their OS for less motion — global switch */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-height: 700px) {
  body { padding-top: max(var(--space-11), env(safe-area-inset-top)); }
  .hub > * + *       { margin-top: var(--space-6); }
  .hub > .quote-slot { margin-top: var(--space-4); }
}
