/*
  The age pages: legal.css supplies the paper, the header, the kicker, the
  title and the footer; this adds the wider column and the question cards.

  The cards are the home page's prompt cards made quieter: the same torn
  paper edge and grain, a smaller tilt, and the reason under the question.
  A page holds 24 of them, so they cannot each lean as hard as the three on
  the home page do.

  The store row repeats the home page's sizing exactly. Apple's and Google's
  artwork may not be redrawn, and Google's PNG carries its own clear space,
  so it is drawn 1.4881 times taller than Apple's to read the same height.
  The full reasoning is in the comment at .store-row in index.html.
*/

.age-shell {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding: 72px 0 96px;
}

.age-shell h1 {
  max-width: 15em;
  text-wrap: balance;
}

.age-shell .legal-lede {
  max-width: 40em;
  margin-bottom: 44px;
}

.age-theme {
  margin: 0 0 44px;
}

.age-theme h2,
.age-cta h2,
.age-list h2 {
  margin: 0 0 16px;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  line-height: 1.15;
}

.age-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.age-card {
  position: relative;
  padding: 22px 22px 34px;
  border: 1px solid rgba(157, 74, 50, 0.12);
  background-color: var(--card);
  background-image: url("/assets/brand/paper-grain.webp");
  background-size: 171px 171px;
  box-shadow: 0 10px 22px rgba(60, 40, 20, 0.1);
  clip-path: polygon(0 0, 100% 0, 100% 95%, 90% 97.5%, 78% 95.5%, 64% 99%, 50% 96.5%, 36% 99%, 22% 95.5%, 10% 98%, 0 95.5%);
}

.age-card:nth-child(3n + 1) {
  transform: rotate(-0.5deg);
}

.age-card:nth-child(3n + 2) {
  transform: rotate(0.4deg);
}

.age-capture {
  margin: 0 0 10px;
  color: var(--clay-deep);
  font-size: 13px;
  font-weight: 800;
}

.age-question {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 500;
  line-height: 1.3;
}

.age-why {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.55;
}

.age-dot {
  position: absolute;
  inset-inline-end: 18px;
  bottom: 16px;
  width: 14px;
  height: 14px;
  border-radius: 52% 44% 51% 47%;
  background: #8f9a6c;
  opacity: 0.85;
}

.age-card:nth-child(2n) .age-dot {
  background: var(--blue);
}

.age-cta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px 36px;
  align-items: center;
  margin: 64px 0 56px;
  padding: clamp(24px, 4vw, 44px);
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper);
}

.age-cta h2 {
  color: var(--paper);
}

.age-cta p {
  max-width: 34em;
  margin: 0;
  color: #e4d9c4;
  font-size: 1.05rem;
  line-height: 1.6;
}

.store-row {
  --badge-height: 44px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.store-badge {
  display: inline-flex;
  border-radius: 10px;
  transition: transform 180ms ease;
}

.store-badge:hover {
  transform: translateY(-2px);
}

.store-badge:focus-visible {
  outline: 3px solid #f0b03d;
  outline-offset: 3px;
}

.badge-apple {
  width: auto;
  height: var(--badge-height);
}

.badge-google {
  width: auto;
  height: calc(var(--badge-height) * 1.4881);
}

.age-list h2 {
  font-size: 1.25rem;
}

.age-list ul,
.age-index {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.age-list a,
.age-index a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(249, 239, 220, 0.7);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.age-list a:hover,
.age-index a:hover {
  border-color: var(--ink-soft);
}

.age-list a[aria-current="page"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.age-index {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 12px;
}

.age-index a {
  display: flex;
  min-height: 64px;
  border-radius: 14px;
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 500;
}

.age-list a:focus-visible,
.age-index a:focus-visible,
.word-switch button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/* Shown only once age-words.js runs; hidden in the markup until then. */
.word-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin: -20px 0 40px;
}

.word-switch[hidden] {
  display: none;
}

.word-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.word-group span {
  margin-inline-end: 4px;
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 700;
}

.word-switch button {
  min-width: 52px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(249, 239, 220, 0.7);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.word-switch button[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

/* Arabic needs room above and below joined letters. */
:root[lang="ar"] .age-question {
  font-family: var(--sans);
  font-weight: 600;
  line-height: 1.7;
}

:root[lang="ar"] .age-why,
:root[lang="ar"] .age-cta p {
  line-height: 1.9;
}

:root[lang="ar"] .age-index a {
  font-family: var(--sans);
  font-weight: 600;
}

@media (max-width: 760px) {
  .age-shell {
    width: min(100% - 32px, 1120px);
    padding: 52px 0 74px;
  }

  .age-cta {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .store-badge:hover {
    transform: none;
  }
}

@media print {
  .word-switch,
  .age-cta,
  .age-list {
    display: none;
  }

  .age-card {
    transform: none;
    box-shadow: none;
    clip-path: none;
    break-inside: avoid;
  }
}
