/* Dad Joke Battle site. Colors mirror the app's asset catalog
   (DadJokeBattle/Resources/Assets.xcassets), light and dark. */

:root {
  --bg: #fcebb6;
  --surface: #fffaec;
  --ink: #5e412f;
  --ink-soft: #765a43;      /* ink at 85% on cream, 5.3:1 */
  --accent: #b23a0e;        /* brand orange darkened for text on cream */
  --orange: #f25a24;
  --teal: #2a8a82;
  --red: #b40000;
  --band: #393020;
  --band-ink: #fcebb6;
  --rule: rgba(94, 65, 47, 0.18);
  --shadow: 0 6px 16px rgba(57, 48, 32, 0.18);

  --display: "Anton", Impact, "Arial Narrow Bold", sans-serif;
  --typewriter: "American Typewriter", "Courier Prime", ui-monospace, monospace;
  --text: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --page: min(1120px, 100% - 32px);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #241b12;
    --surface: #362b1e;
    --ink: #fcebb6;
    --ink-soft: #dccc9d;
    --accent: #f25a24;
    --red: #d23a2a;
    --band: #1a130c;
    --rule: rgba(252, 235, 182, 0.16);
    --shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

img {
  max-width: 100%;
  height: auto;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  padding: 8px 14px;
  background: var(--surface);
  border-radius: 8px;
  z-index: 10;
}

.skip-link:focus {
  top: 12px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Wordmark ---------- */

.wordmark {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--display);
  font-weight: 400;
  line-height: 0.95;
  text-decoration: none;
  text-transform: none;
}

.wordmark__top {
  color: var(--accent);
  font-size: 0.58em;
  letter-spacing: 0.01em;
}

.wordmark__bottom {
  color: var(--ink);
  font-size: 1em;
  letter-spacing: 0.02em;
}

/* ---------- Line-art illustrations (tinted with ink, like the app) ---------- */

.man {
  background-color: var(--ink);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.man--pipe {
  aspect-ratio: 462 / 501;
  -webkit-mask-image: url("man-pipe.svg");
  mask-image: url("man-pipe.svg");
}

.man--mug {
  aspect-ratio: 442 / 432;
  -webkit-mask-image: url("man-mug.svg");
  mask-image: url("man-mug.svg");
}

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

.hero {
  position: relative;
  min-height: min(100svh, 920px);
  display: grid;
  place-items: center;
  padding: 72px 16px;
  overflow: hidden;
  text-align: center;
}

.hero .man {
  position: absolute;
  pointer-events: none;
}

.hero .man--pipe {
  width: clamp(190px, 34vw, 400px);
  top: clamp(8px, 3vw, 40px);
  left: clamp(-60px, -2vw, 0px);
}

.hero .man--mug {
  width: clamp(210px, 36vw, 430px);
  bottom: -2px;
  right: clamp(-50px, -2vw, 0px);
}

.hero__content {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 22px;
  padding: 24px;
  background: radial-gradient(closest-side, var(--bg) 70%, transparent);
}

.hero h1 {
  margin: 0;
  font-size: clamp(4.5rem, 15vw, 9.5rem);
}

.tagline {
  margin: 0;
  font-family: var(--typewriter);
  font-size: clamp(1.15rem, 2.6vw, 1.5rem);
  line-height: 1.35;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--band);
  color: var(--band-ink);
  font-weight: 600;
  font-size: 1.05rem;
  box-shadow: var(--shadow);
}

.pill svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.hero__note {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.98rem;
}

/* ---------- Sections ---------- */

.section {
  width: var(--page);
  margin: 0 auto;
  padding: clamp(56px, 9vw, 104px) 0;
}

.section__title {
  margin: 0 0 12px;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.3rem, 6vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: 0.01em;
  text-align: center;
}

.section__lead {
  max-width: 34em;
  margin: 0 auto 40px;
  color: var(--ink-soft);
  text-align: center;
}

.band {
  background: var(--band);
  color: var(--band-ink);
  border-block: 6px double var(--bg);
  outline: 6px solid var(--band);
}

.band .section__title {
  color: var(--band-ink);
}

.band .section__lead {
  color: #dccc9d;
}

/* ---------- Battle demo ---------- */

.battle {
  width: min(560px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.joke-card {
  position: relative;
  display: block;
  width: 100%;
  min-height: 150px;
  padding: 26px 26px;
  border: 3px solid #fff;
  border-radius: 6px 30px 6px 30px;
  background: var(--orange);
  color: #fff;
  font-family: var(--typewriter);
  font-weight: 700;
  font-size: clamp(1.25rem, 3.4vw, 1.5rem);
  line-height: 1.35;
  text-align: left;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s, filter 0.3s;
}

.joke-card--teal {
  background: var(--teal);
}

.joke-card:hover {
  transform: translateY(-2px);
}

.joke-card:active {
  transform: scale(0.98);
}

.battle[data-state="decided"] .joke-card {
  cursor: default;
}

.joke-card[data-outcome="winner"] {
  transform: scale(1.03);
}

.joke-card[data-outcome="loser"] {
  transform: scale(0.95);
  opacity: 0.78;
  filter: saturate(0.6);
}

.stamp {
  position: absolute;
  top: -20px;
  right: 10px;
  padding: 2px 12px;
  border: 3px solid var(--red);
  border-radius: 6px;
  background: #fff;
  color: var(--red);
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.7rem;
  letter-spacing: 0.02em;
  text-shadow: none;
  transform: rotate(-6deg);
  animation: stamp 0.35s cubic-bezier(0.2, 1.4, 0.5, 1);
}

@keyframes stamp {
  from {
    transform: rotate(-6deg) scale(2.4);
    opacity: 0;
  }
}

.battle__prompt {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.6rem;
  letter-spacing: 0.02em;
  text-align: center;
}

.battle__next {
  justify-self: center;
  margin-top: 8px;
  padding: 14px 34px;
  border: 0;
  border-radius: 999px;
  background: var(--orange);
  color: #fff;
  font-family: var(--display);
  font-size: 1.45rem;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.battle__next[hidden] {
  display: block;
  visibility: hidden;
}

/* ---------- Features ---------- */

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(20px, 4vw, 48px);
  align-items: start;
}

.feature {
  display: grid;
  gap: 18px;
  justify-items: center;
  text-align: center;
}

.feature h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.8rem;
  letter-spacing: 0.01em;
  line-height: 1.1;
}

.feature p {
  margin: 0;
  color: var(--ink-soft);
}

.phone {
  width: min(280px, 100%);
  aspect-ratio: 1206 / 2622;
  padding: 9px;
  border-radius: 46px;
  background: #1c1610;
  box-shadow: var(--shadow), inset 0 0 0 2px #4a3f30;
}

.phone img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 38px;
  object-fit: cover;
}

.phone picture {
  display: contents;
}

/* ---------- Safety ---------- */

.safety {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.safety li {
  padding: 24px;
  border-radius: 6px 30px 6px 30px;
  background: var(--surface);
  color: var(--ink);
}

.band .safety li {
  background: rgba(252, 235, 182, 0.08);
  color: var(--band-ink);
}

.safety strong {
  display: block;
  margin-bottom: 6px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.45rem;
  letter-spacing: 0.01em;
}

/* ---------- Legal pages ---------- */

.site-header {
  width: var(--page);
  margin: 0 auto;
  padding: 24px 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-header .wordmark {
  font-size: 2.6rem;
}

.site-header nav {
  display: flex;
  gap: 20px;
  font-weight: 600;
}

.legal {
  width: min(720px, 100% - 32px);
  margin: 0 auto;
  padding: 24px 0 72px;
}

.legal h1 {
  margin: 0.4em 0 0.1em;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.6rem, 8vw, 3.8rem);
  line-height: 1.05;
  letter-spacing: 0.01em;
}

.legal .updated {
  margin: 0 0 32px;
  color: var(--ink-soft);
}

.legal h2 {
  margin: 2.2em 0 0.5em;
  font-size: 1.35rem;
  line-height: 1.3;
}

.legal h3 {
  margin: 1.6em 0 0.4em;
  font-size: 1.1rem;
}

.legal p,
.legal li {
  max-width: 68ch;
}

.legal ul {
  padding-left: 1.3em;
}

.legal li + li {
  margin-top: 0.45em;
}

.summary {
  margin: 0 0 8px;
  padding: 22px 26px;
  border-radius: 6px 30px 6px 30px;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--rule);
}

.summary h2 {
  margin-top: 0;
}

.summary ul {
  margin-bottom: 0;
}

.toc {
  margin: 28px 0 0;
  padding: 18px 26px;
  border-left: 4px solid var(--accent);
}

.toc ol {
  margin: 0;
  padding-left: 1.2em;
  columns: 2 16em;
  column-gap: 32px;
}

.toc li {
  margin: 0.2em 0;
  break-inside: avoid;
}

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

.site-footer {
  border-top: 1px solid var(--rule);
}

.site-footer__inner {
  width: var(--page);
  margin: 0 auto;
  padding: 32px 0 48px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  font-weight: 600;
}

.site-footer p {
  margin: 0;
}

/* ---------- Not found ---------- */

.not-found {
  min-height: 70svh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  padding: 48px 16px;
  text-align: center;
}

.not-found .man--pipe {
  width: 200px;
}

.not-found h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.6rem, 9vw, 4rem);
  line-height: 1.05;
}

/* ---------- Small screens ---------- */

@media (max-width: 760px) {
  .features,
  .safety {
    grid-template-columns: 1fr;
  }

  .feature {
    grid-template-columns: 1fr;
  }

  .phone {
    width: min(260px, 78vw);
  }

  .hero {
    min-height: auto;
    padding: 220px 16px 230px;
  }

  .hero .man--pipe {
    width: 200px;
    top: 0;
    left: -24px;
  }

  .hero .man--mug {
    width: 220px;
    right: -30px;
  }

  .site-header .wordmark {
    font-size: 2.1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
