/* ---------------------------------------------------------
   Right to Repair Zine — dark grey / blue theme
   --------------------------------------------------------- */

:root {
  --bg: #0d1b2e;
  --window-bg: #23262c;
  --titlebar-bg: #292d34;
  --border: #363b43;
  --text: #e4e6ea;
  --muted: #8b919c;
  --accent: #4d7ee0;
  --accent-dark: #3a63b8;
  --max-width: 60rem;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  /* reserve the scrollbar's width at all times so a card expanding and
     making the page taller (scrollbar appearing) never shifts the
     layout width */
  overflow-y: scroll;
  scrollbar-gutter: stable;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  font-size: 1rem;
  min-height: 100vh;
  /* sticky footer: body is a column flex container, main grows to fill
     any leftover vertical space so the footer always sits at the
     bottom of the viewport instead of riding up under short content */
  display: flex;
  flex-direction: column;
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 max(1.5rem, env(safe-area-inset-right)) 0
    max(1.5rem, env(safe-area-inset-left));
}

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

header.site-header {
  border-bottom: 1px solid var(--border);
  /* viewport-fit=cover lets the page extend under the iPhone notch/
     status bar; this keeps the actual header content clear of it */
  padding-top: env(safe-area-inset-top);
}

header.site-header .wrap {
  padding-top: 1.5rem;
  padding-bottom: 1.25rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.site-title {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
}

nav.site-nav a {
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
  margin-left: 1.25rem;
}

nav.site-nav a:hover,
nav.site-nav a:focus,
nav.site-nav a[aria-current="page"] {
  color: var(--accent);
}

/* -------------------- Hero -------------------- */

.hero {
  padding: 3rem 0 2.25rem;
}

.hero .kicker {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.hero h1 {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  line-height: 1.2;
  margin: 0 0 1rem;
  font-weight: 700;
}

.hero p.lede {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 40rem;
}

.hero .byline {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 1rem;
}

.cta-row {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn {
  font-family: var(--font-sans);
  display: inline-block;
  padding: 0.65rem 1.25rem;
  border-radius: 5px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid var(--accent);
}

.btn-primary {
  background: var(--accent);
  color: #10131a;
}

.btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* -------------------- Generic sections -------------------- */

main.page-shell {
  padding-bottom: 4rem;
  flex: 1 0 auto;
}

section + section {
  margin-top: 2.5rem;
}

h2 {
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
}

.placeholder-note {
  background: #2a2316;
  border: 1px dashed #8a5a2a;
  color: #e3b56f;
  font-size: 0.85rem;
  padding: 0.9rem 1rem;
  border-radius: 5px;
  margin: 1.25rem 0;
}

.placeholder-note strong {
  display: block;
  margin-bottom: 0.25rem;
}

/* -------------------- Window grid (overlapping "desktop" layout) --------------------
   A real CSS grid (not column-based masonry) so each card gets its own
   cell — the random per-card offset/tilt below can never spill into a
   neighboring card's space or throw off the overall layout. */

.window-controls {
  display: flex;
  gap: 0.75rem;
  margin: 0 0 1.75rem;
}

.window-controls button {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
}

.window-controls button:hover,
.window-controls button:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  outline: none;
}

.window-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 2.25rem 1.75rem;
  align-items: start;
}

.mac-window {
  background: var(--window-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  /* --dx/--dy/--tilt are set per-window by js/app.js so each "window"
     sits at its own random offset, like scattered desktop windows */
  transform: translate(var(--dx, 0px), var(--dy, 0px)) rotate(var(--tilt, 0deg));
}

.mac-window.focused {
  transform: none;
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
  z-index: 2;
}

/* the reference list reads badly tilted/narrow — give it its own full
   row instead of scattering it like the argument cards */
.mac-window.works-cited-window {
  grid-column: 1 / -1;
  transform: none;
}

.mac-titlebar {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--titlebar-bg);
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 6px 6px 0 0;
  padding: 0.65rem 1rem;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--text);
}

.mac-titlebar:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.traffic-lights {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.traffic-lights .dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  display: block;
}

.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }

.mac-filename {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  flex: 1;
}

.mac-chevron {
  transition: transform 0.15s ease;
}

.mac-titlebar[aria-expanded="true"] .mac-chevron {
  transform: rotate(180deg);
}

.mac-body-inner {
  padding: 0.95rem 1.3rem;
}

/* Collapsed by default: only the bold headline sentence shows. Expanding
   a window (clicking its titlebar, or "Expand all") reveals everything
   else inside it. */
.mac-body-inner > *:not(.mac-headline) {
  display: none;
}

.mac-body.is-open .mac-body-inner > *:not(.mac-headline) {
  display: block;
}

.mac-body.is-open .mac-body-inner {
  padding: 1.1rem 1.3rem 1.4rem;
}

/* the one sentence each card is built around — larger, bolder, and
   marked with an accent rule so it reads before the supporting bullets */
.mac-headline {
  margin: 0;
  padding-left: 0.85rem;
  border-left: 3px solid var(--accent);
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.4;
  color: #f4f6f9;
}

.mac-body.is-open .mac-headline {
  margin-bottom: 1rem;
}

/* used on the counterargument card: it's the opposition's claim, not
   the essay's, so it gets a neutral rule instead of the accent one */
.mac-headline.is-neutral {
  border-left-color: var(--border);
  color: var(--text);
}

.mac-body-inner p {
  margin: 0 0 1rem;
}

.mac-body-inner p:last-child {
  margin-bottom: 0;
}

.mac-body-inner blockquote {
  margin: 1.25rem 0;
  padding-left: 1rem;
  border-left: 3px solid var(--accent);
  color: var(--text);
  font-style: italic;
  font-size: 1.02rem;
}

.mac-body-inner ul.points {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.mac-body-inner ul.points li {
  margin-bottom: 0.5rem;
}

.mac-body-inner ul.points li::marker {
  color: var(--accent);
}

/* -------------------- Works Cited window -------------------- */

.works-cited-window .mac-body-inner ul {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.works-cited-window .mac-body-inner li {
  padding-left: 2em;
  text-indent: -2em;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.works-cited-window .mac-body-inner a {
  color: var(--accent);
  word-break: break-word;
}

/* -------------------- Teaser window on home page -------------------- */

.teaser {
  max-width: 34rem;
}

/* -------------------- Footer -------------------- */

footer.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  padding: 1.5rem 0 calc(3rem + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.8rem;
}

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

  /* keep some life on small screens: a smaller version of the same
     scatter, plus alternating left/right insets so cards still read as
     loosely cascading windows instead of a flat list */
  .mac-window {
    width: calc(100% - 1.25rem);
    transform: translate(calc(var(--dx, 0px) * 0.4), calc(var(--dy, 0px) * 0.4))
      rotate(calc(var(--tilt, 0deg) * 0.7));
  }

  .mac-window:nth-child(odd) {
    margin-right: auto;
  }

  .mac-window:nth-child(even) {
    margin-left: auto;
  }

  .mac-window.works-cited-window {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    transform: none;
  }
}
