/*
 * fairhearth.com – the studio site and the Pegwood pages.
 * The palette is Pegwood's Heirloom table: deep felt green, ivory, gold. No web fonts: headings use
 * the system serif (Charter on Apple devices, as in the game), body text the system sans.
 * One calm dark theme on purpose: the site is the table the cards lie on.
 */

:root {
  --felt: #0f2a1d;
  --felt-deep: #0b2016;
  --surface: #143626;
  --surface-2: #1f4d3a;
  --ivory: #f4eedf;
  --muted: #cfc8b6;
  --gold: #d9b866;
  --gold-line: rgba(217, 184, 102, 0.38);
  --line: rgba(244, 238, 223, 0.16);
  --on-gold: #0f2a1d;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --radius: 22px;
  --serif: Charter, 'Bitstream Charter', 'Sitka Text', Cambria, Georgia, serif;
  --sans:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, Roboto, 'Helvetica Neue', Arial,
    sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: dark;
}

@media (prefers-contrast: more) {
  :root {
    --muted: #f4eedf;
    --line: rgba(244, 238, 223, 0.5);
    --gold-line: rgba(217, 184, 102, 0.8);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--felt);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ivory);
  background:
    radial-gradient(1100px 620px at 78% -8%, rgba(31, 77, 58, 0.7), transparent 70%),
    radial-gradient(900px 520px at -10% 40%, rgba(31, 77, 58, 0.35), transparent 70%), var(--felt);
  /* rem, not px: the reading text follows the browser's font size setting like everything else. */
  font: 1.125rem/1.6 var(--sans);
}

main {
  flex: 1;
}

[hidden] {
  display: none !important;
}

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

a {
  color: var(--gold);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

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

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  border-radius: 6px;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.3rem, 6vw, 3.7rem);
  letter-spacing: -0.01em;
}

h2 {
  font-size: clamp(1.7rem, 3.6vw, 2.4rem);
}

h3 {
  font-size: 1.3rem;
}

p {
  margin: 0 0 1em;
}

strong {
  font-weight: 650;
}

.wrap {
  width: min(1120px, 100% - 32px);
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 12px;
}

.skip:focus {
  left: 16px;
  z-index: 10;
  background: var(--ivory);
  color: var(--felt);
  padding: 10px 16px;
  border-radius: 10px;
}

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

.eyebrow {
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 0.9em;
}

.lede {
  font-size: 1.2rem;
  color: var(--muted);
  max-width: 34em;
}

.muted {
  color: var(--muted);
}

.suit {
  font-family: var(--serif);
}

/* Header */

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  flex-wrap: wrap;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--ivory);
  text-decoration: none;
  font: 700 1.4rem/1 var(--serif);
  letter-spacing: 0.01em;
}

.brand svg {
  width: 34px;
  height: 34px;
  flex: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 22px;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
}

.site-nav a:hover {
  color: var(--ivory);
}

.site-nav a[aria-current='page'] {
  color: var(--ivory);
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.45em;
}

/* Buttons and the App Store area */

.store {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
  margin-top: 30px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 26px;
  border-radius: 999px;
  border: 2px solid var(--gold);
  background: var(--gold);
  color: var(--on-gold);
  font: 700 1.05rem/1.2 var(--sans);
  text-decoration: none;
  text-align: center;
}

.button:hover {
  background: #e6c97f;
  border-color: #e6c97f;
}

.button-quiet {
  background: transparent;
  color: var(--gold);
}

.button-quiet:hover {
  background: rgba(217, 184, 102, 0.12);
  border-color: var(--gold);
}

button.button {
  cursor: pointer;
}

/* Pegwood is not on the App Store yet: a calm label, not a control. */
.store-soon {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  margin: 0;
  padding: 12px 24px;
  border-radius: 999px;
  border: 2px dashed var(--gold-line);
  color: var(--ivory);
  font-weight: 700;
}

.store-soon::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  flex: none;
}

/* Sections */

.section {
  padding: 64px 0;
}

.section + .section {
  border-top: 1px solid var(--line);
}

.section-intro {
  max-width: 44em;
  margin-bottom: 34px;
}

.section-intro p {
  color: var(--muted);
}

.card {
  background: linear-gradient(180deg, rgba(31, 77, 58, 0.55), rgba(20, 54, 38, 0.55));
  border: 1px solid var(--gold-line);
  border-radius: var(--radius);
  padding: 26px;
}

.card p {
  color: var(--muted);
}

.card > :last-child {
  margin-bottom: 0;
}

/* Studio home */

.studio-hero {
  padding: 72px 0 56px;
  max-width: 50em;
}

.studio-hero h1 {
  font-size: clamp(2.2rem, 5.4vw, 3.5rem);
}

.works {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.work {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.work:hover,
.work:focus-within {
  border-color: var(--gold);
}

.work-icon {
  width: 84px;
  height: 84px;
  border-radius: 19px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

.work h3 {
  margin: 4px 0 0;
}

/* The whole card follows the title link. */
.work h3 a {
  color: var(--ivory);
  text-decoration: none;
}

.work h3 a::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

.work h3 a:focus-visible {
  outline: none;
}

.work h3 a:focus-visible::after {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.work p {
  margin: 0;
}

.work .status {
  margin-top: auto;
  padding-top: 6px;
  color: var(--gold);
  font-weight: 600;
  font-size: 0.95rem;
}

.contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px 32px;
}

.contact p {
  margin: 0;
  max-width: 36em;
}

/* Pegwood landing */

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 56px;
  align-items: center;
  padding: 56px 0 72px;
}

.hero h1 {
  font-size: clamp(2.6rem, 6.4vw, 4.2rem);
  margin-bottom: 0.2em;
}

.subtitle {
  font: 400 clamp(1.35rem, 2.6vw, 1.75rem) / 1.3 var(--serif);
  color: var(--gold);
  margin-bottom: 0.9em;
}

.hero-art {
  margin: 0;
  justify-self: center;
  max-width: 440px;
  width: 100%;
}

.hero-art img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 28px;
  border: 1px solid var(--gold-line);
  box-shadow: var(--shadow);
  background: var(--surface);
}

.promises {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.promise h3 {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Sized in em so the circle grows with its glyph when text is enlarged. */
.promise .suit {
  display: inline-grid;
  place-items: center;
  width: 2.05em;
  height: 2.05em;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--gold-line);
  color: var(--gold);
  font-size: 1.35rem;
  line-height: 1;
}

.sealed {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 40px;
  align-items: start;
}

.sealed img {
  width: 160px;
  filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.45));
}

.steps {
  list-style: none;
  counter-reset: step;
  margin: 0 0 1.2em;
  padding: 0;
  display: grid;
  gap: 18px;
}

.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 3.25em;
  min-height: 2.5em;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -2px;
  width: 2.25em;
  height: 2.25em;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--gold);
  color: var(--on-gold);
  font: 700 1.1rem/1 var(--serif);
}

.steps h3 {
  font-size: 1.2rem;
  margin-bottom: 0.3em;
}

.steps p {
  color: var(--muted);
  margin: 0;
}

.fine {
  color: var(--muted);
  font-size: 0.92rem;
}

.two-up {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.tables {
  margin: 0;
}

.tables img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--gold-line);
  box-shadow: var(--shadow);
}

.tables figcaption {
  margin-top: 14px;
  color: var(--muted);
}

.link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 26px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.link-list a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
}

/* A standalone link outside a list or nav: still a 44 pt tap target. */
.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

/* Legal and support pages */

.doc {
  max-width: 46rem;
  padding: 48px 0 80px;
}

.doc h1 {
  font-size: clamp(2.2rem, 5vw, 3rem);
}

.doc h2 {
  font-size: clamp(1.45rem, 3vw, 1.75rem);
  margin-top: 2.2em;
  scroll-margin-top: 16px;
}

.doc h3 {
  font-size: 1.2rem;
  margin-top: 1.8em;
  scroll-margin-top: 16px;
}

.doc .updated {
  color: var(--muted);
}

.doc .summary {
  margin: 28px 0;
}

.doc .summary h2 {
  margin-top: 0;
  font-size: 1.35rem;
}

.doc ul,
.doc ol {
  padding-left: 1.3em;
}

.doc li {
  margin-bottom: 0.45em;
}

.doc li > ul {
  margin-top: 0.45em;
}

.doc hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 48px 0 0;
}

.toc {
  margin: 28px 0 8px;
}

.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
}

.toc a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
}

.table-scroll {
  overflow-x: auto;
  margin: 0 0 1.2em;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.doc th,
.doc td {
  text-align: left;
  vertical-align: top;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.doc tr:last-child td {
  border-bottom: 0;
}

.doc th {
  color: var(--gold);
  font-weight: 700;
  background: rgba(31, 77, 58, 0.5);
}

.doc td:first-child {
  min-width: 11em;
}

.signature {
  margin-top: 2.4em;
  color: var(--muted);
}

/* Invite page */

.join {
  max-width: 42rem;
  padding: 48px 0 80px;
}

.join h1 {
  font-size: clamp(2.1rem, 6vw, 3.1rem);
}

.invite {
  text-align: center;
  margin: 32px 0 40px;
  padding: 30px 22px;
}

.invite-label {
  color: var(--gold);
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.invite .invite-code {
  margin: 0 0 18px;
  font: 700 clamp(2.4rem, 12vw, 4.2rem) / 1.1 var(--serif);
  letter-spacing: 0.08em;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--ivory);
  overflow-wrap: anywhere;
}

.copy-status {
  min-height: 1.6em;
  margin: 12px 0 0;
  color: var(--muted);
}

.notice {
  margin: 32px 0 40px;
  border-color: var(--gold);
}

.notice h2 {
  font-size: 1.45rem;
}

.join .steps {
  margin: 12px 0 44px;
  gap: 28px;
}

.join .steps .store {
  margin-top: 16px;
}

.code-inline {
  font-family: var(--serif);
  font-weight: 700;
  color: var(--ivory);
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.already {
  padding: 26px;
}

.already h2 {
  font-size: 1.35rem;
}

/* 404 */

.lost {
  max-width: 40rem;
  padding: 80px 0;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(11, 32, 22, 0.6);
  color: var(--muted);
  font-size: 0.95rem;
}

.site-footer .wrap {
  padding: 30px 0 44px;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 22px;
  margin-bottom: 12px;
}

.site-footer nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ivory);
}

.site-footer p {
  margin: 0 0 6px;
}

/* Narrow screens */

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 36px;
    padding-top: 36px;
  }

  .hero-art {
    max-width: 520px;
  }

  .hero-art img {
    aspect-ratio: 4 / 5;
    object-position: center 62%;
  }

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

  .work {
    display: grid;
    grid-template-columns: 84px 1fr;
    column-gap: 18px;
    row-gap: 8px;
    align-items: start;
  }

  .work-icon {
    grid-row: span 3;
  }

  .work .status {
    margin-top: 0;
    padding-top: 0;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 1.0625rem;
  }

  .section {
    padding: 48px 0;
  }

  .promises,
  .two-up {
    grid-template-columns: 1fr;
  }

  .sealed {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .sealed img {
    width: 112px;
  }

  .card {
    padding: 22px 20px;
  }

  .work {
    grid-template-columns: 64px 1fr;
  }

  .work-icon {
    width: 64px;
    height: 64px;
    border-radius: 14px;
  }

  .site-header .wrap {
    padding: 10px 0;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  a,
  .button,
  .work {
    transition:
      color 0.15s ease,
      background-color 0.15s ease,
      border-color 0.15s ease;
  }
}

@media (forced-colors: active) {
  .button,
  .store-soon,
  .card {
    border: 2px solid CanvasText;
  }

  .steps > li::before {
    border: 2px solid CanvasText;
  }
}

@media print {
  html,
  body {
    background: #fff;
    color: #000;
  }

  .site-header nav,
  .site-footer nav,
  .skip,
  .store {
    display: none;
  }

  a {
    color: #000;
  }

  .card,
  .table-scroll {
    background: none;
    border-color: #999;
  }

  .doc th {
    color: #000;
    background: none;
  }

  .muted,
  .fine,
  .doc .updated,
  .card p,
  .site-footer {
    color: #333;
  }
}

/* Long example links may wrap on narrow phones. */
.lost .code-inline {
  white-space: normal;
  overflow-wrap: anywhere;
}
