/* fun.johnbrodish.com — all page styling. Same system as the portfolio:
   two polarities, teal-only accent, square corners, base-4 throughout. */

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

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--text-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 1px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: var(--space-xs);
  background: var(--exhibit-ground);
  color: var(--text);
  padding: var(--space-sm) var(--space-md);
  font-family: var(--gro);
  font-size: var(--text-fine);
}
.skip-link:focus { left: var(--space-md); z-index: 10; }

.wrap {
  max-width: var(--page);
  margin: 0 auto;
  padding-left: var(--pad);
  padding-right: var(--pad);
}

/* ---------- masthead — same chrome as the portfolio ---------- */

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-lg);
  padding-top: var(--space-lg);
  padding-bottom: var(--space-lg);
}

.brand { white-space: nowrap; }

.wordmark {
  font-family: var(--gro);
  font-weight: 500;
  font-size: var(--text-link);
  line-height: var(--lh-body);
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.masthead-rail {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
}

.masthead-nav { display: flex; gap: var(--space-lg); }
.masthead-nav .link {
  font-size: var(--text-link-small);
  line-height: var(--lh-eyebrow);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: inherit;
  text-decoration-color: transparent;
}
.masthead-nav .link:hover { text-decoration-color: var(--accent); }

/* Theme toggle — the portfolio's, verbatim (toggles.dev "classic", MIT). */
.theme-toggle {
  color: var(--text-2);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2xs);
  transition: color var(--dur-micro) var(--ease-out);
}
.theme-toggle:hover { color: var(--text); }
.theme-toggle:active { color: var(--accent); }
.theme-toggle svg { display: block; width: 20px; height: 20px; }
.theme-toggle circle {
  transform-origin: center;
  transition: transform var(--dur-long) var(--ease-out);
}
.theme-toggle g path {
  transform-origin: center;
  transition: transform var(--dur-long) var(--ease-out),
              opacity var(--dur-long) var(--ease-out);
  transition-delay: calc(var(--dur-long) * 0.15);
}
.theme-toggle defs path {
  transition: d var(--dur-long) var(--ease-out),
              translate var(--dur-long) var(--ease-out);
}
:root[data-theme="dark"] .theme-toggle circle { transform: scale(1.7); }
:root[data-theme="dark"] .theme-toggle g path {
  transform: scale(0.5) rotate(45deg);
  opacity: 0;
  transition-delay: 0s;
}
:root[data-theme="dark"] .theme-toggle defs path {
  d: path("M0 2h13a1 1 0 0 0 10 10v14H0Z");
  transition-delay: calc(var(--dur-long) * 0.15);
}
@supports not (d: path("M0 0")) {
  :root[data-theme="dark"] .theme-toggle defs path { translate: -13px 2px; }
}
@media (prefers-reduced-motion: reduce) {
  .theme-toggle circle,
  .theme-toggle g path,
  .theme-toggle defs path { transition: none; }
}

@media (max-width: 40rem) {
  .masthead { flex-wrap: wrap; }
  .masthead:has(.masthead-nav) .masthead-rail {
    flex: 1 1 100%;
    justify-content: space-between;
  }
}

/* ---------- intro ---------- */

.intro {
  padding-top: var(--space-2xl);
  padding-bottom: var(--space-2xl);
  border-bottom: 1px solid var(--hairline);
}

/* Title scale, not display — matches the portfolio's case-study titles and
   keeps the headline on one line at the wide breakpoints. */
.intro h1 {
  margin: 0;
  font-size: var(--text-title);
  line-height: var(--lh-title);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.intro .lede {
  margin: var(--space-lg) 0 0;
  max-width: var(--measure);
  font-size: var(--text-lede);
  line-height: var(--lh-lede);
  color: var(--text-2);
}

/* ---------- the shelf ---------- */

.shelf {
  padding-top: var(--space-2xl);
  padding-bottom: var(--space-2xl);
}

.entries {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-2xl);
}

.entry {
  background: var(--exhibit-ground);
  border: 1px solid var(--hairline);
  overflow: hidden;
}

/* The art is the whole top of the card and the primary click target. */
.entry-art {
  display: block;
  position: relative;
  background: var(--ground);
  border-bottom: 1px solid var(--hairline);
}

.entry-art img {
  width: 100%;
  height: auto;
  aspect-ratio: 1672 / 941;
  object-fit: cover;
  transform: scale(1.0);
  transition: transform var(--dur-short) var(--ease-out);
}

@media (hover: hover) {
  .entry-art:hover img { transform: scale(1.02); }
}

@media (prefers-reduced-motion: reduce) {
  .entry-art img { transition: none; }
  .entry-art:hover img { transform: none; }
}

/* position: relative anchors the Desktop-only pill in the top-right corner */
.entry-body { position: relative; padding: var(--space-lg); }

@media (min-width: 40rem) {
  .entry-body { padding: var(--space-lg) var(--space-xl) var(--space-xl); }
}

.pill {
  position: absolute;
  top: var(--space-lg);
  right: var(--space-lg);
  font-family: var(--gro);
  font-weight: 500;
  font-size: var(--text-fine);
  line-height: var(--lh-eyebrow);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  border-radius: 999px;
  padding: var(--space-2xs) var(--space-sm);
}

@media (min-width: 40rem) {
  .pill { right: var(--space-xl); }
}

/* Teal in its eyebrow role, same as the portfolio's entry eyebrows. */
.entry-kicker {
  margin: 0 0 var(--space-sm);
  font-family: var(--gro);
  font-weight: 500;
  font-size: var(--text-eyebrow);
  line-height: var(--lh-eyebrow);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

/* Entry titles sit on the portfolio's h3 step (its work-list titles). */
.entry h2 {
  margin: 0;
  font-size: var(--text-h3);
  line-height: var(--lh-h3);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.entry h2 a { text-decoration: none; }
.entry h2 a:hover { text-decoration: underline; text-underline-offset: 4px; }

.entry p.blurb {
  margin: var(--space-md) 0 0;
  max-width: var(--measure);
  color: var(--text-2);
}

.entry-meta {
  margin: var(--space-lg) 0 0;
  font-family: var(--gro);
  font-size: var(--text-fine);
  line-height: var(--lh-fine);
  color: var(--text-2);
}
.entry-meta .sep { padding: 0 var(--space-xs); opacity: 0.5; }

.entry-actions {
  margin: var(--space-lg) 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-lg);
}

/* Primary action: the portfolio's gate-button treatment, verbatim. */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  height: 3rem;
  padding-inline: var(--space-lg);
  font-family: var(--gro);
  font-weight: 500;
  font-size: var(--text-link-small);
  line-height: var(--lh-eyebrow);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ground);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 0;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--dur-micro) var(--ease-out),
              border-color var(--dur-micro) var(--ease-out),
              transform var(--dur-micro) var(--ease-out);
}
.btn:hover {
  background: color-mix(in srgb, var(--accent) 84%, var(--text));
  border-color: color-mix(in srgb, var(--accent) 84%, var(--text));
}
.btn:active { transform: translateY(1px); }
.btn .icon { width: 1rem; height: 1rem; }

/* Standalone links — the portfolio's treatment */
.link {
  font-family: var(--gro);
  font-weight: 500;
  font-size: var(--text-link);
  line-height: var(--lh-body);
  letter-spacing: 0.04em;
  color: var(--accent);
  white-space: nowrap;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  transition: text-decoration-color var(--dur-micro) var(--ease-out), text-underline-offset var(--dur-micro) var(--ease-out);
}
.link:hover { text-decoration-color: var(--accent); text-underline-offset: 0.42em; }
.link:active { text-underline-offset: 0.24em; }

/* ---------- back to portfolio + footer ---------- */

.backlink { padding-bottom: var(--space-2xl); }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}
.back-link .icon { width: 1.25rem; height: 1.25rem; }

/* ---------- footer ---------- */

/* Same treatment as the portfolio's colophon footer. */
.footer {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-2xl);
  border-top: 1px solid var(--hairline);
}

.footer p {
  margin: 0;
  font-family: var(--gro);
  font-size: var(--text-fine);
  line-height: var(--lh-fine);
  letter-spacing: 0.02em;
  color: var(--text-2);
}
