/* AHAM: The Inner Journey - legal site.
   Colours, fonts and art are taken from the game (see LegalSite/README.md). */

/* ------------------------------------------------------------------ fonts */

@font-face { font-family: "Cinzel"; src: url("/assets/fonts/cinzel-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Cinzel"; src: url("/assets/fonts/cinzel-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Cinzel"; src: url("/assets/fonts/cinzel-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Cabin"; src: url("/assets/fonts/cabin-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Cabin"; src: url("/assets/fonts/cabin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Cabin"; src: url("/assets/fonts/cabin-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("/assets/fonts/cormorant-500-italic.woff2") format("woff2"); font-weight: 500; font-style: italic; font-display: swap; }

/* ----------------------------------------------------------------- palette */

:root {
  /* Parchment cards */
  --parchment-hi: #fcf5e7;
  --parchment: #f6ebd6;
  --parchment-lo: #ecdcbc;
  --parchment-edge: #e4cea8;

  /* Ink */
  --ink: #3a2716;
  --ink-soft: #6b5440;

  /* Gold frames and accents */
  --gold-hi: #f7d58a;
  --gold: #d9a24a;
  --gold-mid: #c08433;
  --gold-deep: #8a5a1c;

  /* "Start Journey" button */
  --orange-hi: #f8b03a;
  --orange: #e9891b;
  --orange-lo: #cf6307;
  --orange-shadow: #9c4a05;

  /* Lotus and leaf */
  --lotus: #d9536f;
  --teal: #27a37b;

  /* Night over the garden */
  --night: #2a1a0e;
  --cream-on-dark: #fbefd7;

  --display: "Cinzel", "Trajan Pro", Georgia, serif;
  --body: "Cabin", "Segoe UI", system-ui, sans-serif;
  --script: "Cormorant Garamond", Georgia, serif;

  --radius: 22px;
  --shadow: 0 22px 50px rgba(18, 9, 2, 0.45), 0 2px 6px rgba(18, 9, 2, 0.25);
}

/* ------------------------------------------------------------------- base */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 96px; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--ink);
  background: var(--night);
}

/* The garden from the game's home screen, softly blurred and dimmed. A fixed
   layer rather than background-attachment, which iOS ignores. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 55% at 50% 18%, rgba(255, 214, 140, 0.30), transparent 70%),
    linear-gradient(180deg, rgba(42, 26, 14, 0.25) 0%, rgba(42, 26, 14, 0.55) 55%, rgba(30, 18, 9, 0.85) 100%),
    url("/assets/bg.webp") center 30% / cover no-repeat,
    var(--night);
}

::selection { background: var(--gold-hi); color: var(--ink); }

a { color: var(--gold-deep); text-decoration-color: rgba(192, 132, 51, 0.55); text-underline-offset: 3px; }
a:hover { color: var(--orange-lo); text-decoration-color: currentColor; }

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

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

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 10;
  padding: 10px 16px; border-radius: 999px;
  background: var(--parchment); color: var(--ink); font-weight: 600;
}
.skip:focus { top: 12px; }

main { flex: 1; width: 100%; padding: 32px 20px 64px; }

/* ----------------------------------------------------------------- header */

.site-header {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px);
  background: linear-gradient(180deg, rgba(34, 21, 11, 0.86), rgba(34, 21, 11, 0.70));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(217, 162, 74, 0.35);
}

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img {
  width: 44px; height: 44px; border-radius: 12px;
  box-shadow: 0 0 0 2px var(--gold), 0 4px 12px rgba(0, 0, 0, 0.4);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name {
  font-family: var(--display); font-weight: 700; font-size: 1.35rem; letter-spacing: 0.08em;
  background: linear-gradient(180deg, #fff1c4 0%, var(--gold-hi) 40%, var(--gold) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-sub {
  font-family: var(--display); font-weight: 600; font-size: 0.62rem; letter-spacing: 0.22em;
  text-transform: uppercase; color: rgba(251, 239, 215, 0.8);
}

.site-nav { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.site-nav a {
  font-family: var(--display); font-weight: 600; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase;
  text-decoration: none; color: var(--ink);
  padding: 8px 16px; border-radius: 999px;
  background: linear-gradient(180deg, var(--parchment-hi), var(--parchment-lo));
  border: 1.5px solid var(--gold);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.site-nav a:hover { transform: translateY(-1px); color: var(--ink); }
.site-nav a[aria-current="page"] {
  background: linear-gradient(180deg, var(--orange-hi), var(--orange) 55%, var(--orange-lo));
  border-color: #f6c66b; color: #2e1806;
}

/* -------------------------------------------------------- parchment panel */

.parchment {
  position: relative;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.55), transparent 60%),
    linear-gradient(180deg, var(--parchment-hi) 0%, var(--parchment) 45%, var(--parchment-lo) 100%);
  border: 3px solid var(--gold);
  border-radius: var(--radius);
  /* Inner hairline, like the double frame on the in-game cards */
  box-shadow:
    inset 0 0 0 5px var(--parchment-hi),
    inset 0 0 0 6.5px rgba(192, 132, 51, 0.55),
    var(--shadow);
}

.crest {
  position: absolute; left: 50%; top: 0;
  width: 180px; transform: translate(-50%, -58%);
  pointer-events: none;
  filter: drop-shadow(0 3px 4px rgba(60, 30, 0, 0.35));
}

/* Document pages: the game's title, small, sitting on the panel's top edge */
.doc-logo {
  position: absolute; left: 50%; top: 0;
  width: 230px; transform: translate(-50%, -46%);
  line-height: 0;
  filter: drop-shadow(0 4px 8px rgba(40, 16, 0, 0.35));
}
.doc-logo img { width: 100%; }

.divider { display: block; width: min(260px, 70%); margin: 14px auto 0; opacity: 0.95; }

/* Round icon badge - the game's nav buttons: dark wood, gold ring, gold glyph */
.badge {
  display: inline-grid; place-items: center;
  width: 64px; height: 64px; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #5a3a20, #2e1c0f 75%);
  box-shadow:
    0 0 0 3px var(--gold),
    0 0 0 5px var(--parchment-hi),
    0 0 0 6.5px rgba(192, 132, 51, 0.6),
    0 6px 14px rgba(40, 20, 0, 0.35);
}
.badge.large { width: 80px; height: 80px; }
.badge-icon {
  width: 52%; height: 52%;
  background: linear-gradient(180deg, #fff0c2, var(--gold-hi) 45%, var(--gold));
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

/* "Start Journey" */
.button {
  display: inline-block;
  padding: 12px 30px;
  font-family: var(--display); font-weight: 700; font-size: 0.9rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: #2e1806; text-decoration: none;
  background: linear-gradient(180deg, var(--orange-hi) 0%, var(--orange) 55%, var(--orange-lo) 100%);
  border: 2px solid #f6c66b;
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--orange-shadow), 0 10px 18px rgba(80, 30, 0, 0.3), inset 0 1px 0 rgba(255, 240, 200, 0.7);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
a.button:hover, .card:hover .button { transform: translateY(-1px); color: #2e1806; }
a.button:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--orange-shadow), 0 4px 10px rgba(80, 30, 0, 0.3); }

/* -------------------------------------------------------------------- home */

.hero { text-align: center; margin: 8px auto 28px; max-width: 820px; }
.hero h1 { margin: 0; line-height: 0; }
.title-logo {
  width: min(560px, 90vw);
  filter: drop-shadow(0 6px 18px rgba(40, 16, 0, 0.55)) drop-shadow(0 0 30px rgba(255, 210, 120, 0.25));
}
.tagline {
  margin: 10px auto 0; max-width: 34ch;
  font-family: var(--script); font-style: italic; font-weight: 500;
  font-size: clamp(1.3rem, 3.4vw, 1.65rem); line-height: 1.35;
  color: var(--cream-on-dark);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
}

.cards {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px;
  max-width: 820px; margin: 40px auto 0;
}
.card {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 36px 28px 30px;
  text-decoration: none; color: var(--ink);
  transition: transform 0.2s ease;
}
.card:hover { transform: translateY(-4px); color: var(--ink); }
.card h2 {
  margin: 20px 0 6px;
  font-family: var(--display); font-weight: 700; font-size: 1.45rem; letter-spacing: 0.04em;
}
.card p { margin: 0 0 22px; color: var(--ink-soft); flex: 1; }

.contact {
  text-align: center; margin: 40px auto 0;
  color: var(--cream-on-dark); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}
.contact a { color: var(--gold-hi); }

/* -------------------------------------------------------------- documents */

.doc-layout {
  display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 32px; align-items: start;
  max-width: 1120px; margin: 72px auto 0;
}

.toc {
  position: sticky; top: 96px;
  padding: 20px 18px;
  background: rgba(252, 245, 231, 0.93);
  border: 1.5px solid var(--gold);
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(18, 9, 2, 0.35);
}
.toc-title, .toc-mobile summary {
  margin: 0 0 8px;
  font-family: var(--display); font-weight: 700; font-size: 0.75rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--gold-deep);
}
.toc ol, .toc-mobile ol { list-style: none; margin: 0; padding: 0; }
.toc li a, .toc-mobile li a {
  display: flex; gap: 10px; align-items: baseline;
  padding: 5px 6px; border-radius: 8px;
  font-size: 0.93rem; line-height: 1.35; color: var(--ink); text-decoration: none;
}
.toc li a:hover, .toc-mobile li a:hover { background: rgba(217, 162, 74, 0.16); }
.toc .num, .toc-mobile .num {
  flex: 0 0 1.4em; text-align: right;
  font-family: var(--display); font-weight: 700; font-size: 0.8rem; color: var(--gold-mid);
}

.toc-mobile { display: none; }

.doc { padding: 96px clamp(22px, 5vw, 64px) 48px; }

.doc-header { text-align: center; margin-bottom: 8px; }
.doc-header h1 {
  margin: 22px 0 6px;
  font-family: var(--display); font-weight: 700;
  font-size: clamp(1.9rem, 4.6vw, 2.75rem); line-height: 1.15; letter-spacing: 0.04em;
}
.doc-meta { margin: 0; color: var(--ink-soft); font-size: 0.98rem; }
.doc-meta strong { font-family: var(--display); font-weight: 600; letter-spacing: 0.06em; color: var(--gold-deep); }

.doc h2 {
  display: flex; align-items: center; gap: 14px;
  margin: 2.6em 0 0.7em;
  padding-top: 1.2em;
  border-top: 1px solid rgba(192, 132, 51, 0.35);
  font-family: var(--display); font-weight: 700; font-size: clamp(1.25rem, 2.6vw, 1.5rem); line-height: 1.25; letter-spacing: 0.03em;
}
.doc-header + p { margin-top: 2em; }

.doc h2 .num {
  flex: 0 0 auto;
  display: inline-grid; place-items: center;
  width: 2em; height: 2em; border-radius: 50%;
  font-size: 0.8em; color: #3a2210;
  background: radial-gradient(circle at 50% 30%, #fff0c2, var(--gold-hi) 45%, var(--gold) 100%);
  box-shadow: 0 0 0 2px var(--parchment-hi), 0 0 0 3.5px rgba(192, 132, 51, 0.6), 0 3px 6px rgba(80, 40, 0, 0.25);
}

.doc h3 {
  margin: 1.8em 0 0.4em;
  font-family: var(--display); font-weight: 600; font-size: 1.02rem; letter-spacing: 0.06em;
  color: var(--gold-deep);
}

.doc p { margin: 0 0 1em; }

.doc ul { margin: 0 0 1.2em; padding: 0; list-style: none; }
.doc li { position: relative; padding-left: 1.6em; margin: 0.35em 0; }
.doc li::before {
  content: ""; position: absolute; left: 0.25em; top: 0.62em;
  width: 0.5em; height: 0.5em; transform: rotate(45deg);
  background: linear-gradient(135deg, var(--gold-hi), var(--gold-mid));
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.6);
}

.doc strong { color: #2a1a0c; }

/* --------------------------------------------------------------------- 404 */

.lost {
  max-width: 560px; margin: 70px auto 0; padding: 56px 28px 36px; text-align: center;
}
.lost .lotus { width: 220px; }
.lost h1 { margin: 10px 0 4px; font-family: var(--display); font-weight: 700; font-size: 2rem; letter-spacing: 0.05em; }
.lost p { color: var(--ink-soft); }
.lost-links { margin-top: 26px; }

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

.site-footer {
  padding: 28px 20px 34px; text-align: center;
  background: linear-gradient(180deg, rgba(30, 18, 9, 0.72), rgba(24, 14, 7, 0.95));
  border-top: 1px solid rgba(217, 162, 74, 0.35);
  color: rgba(251, 239, 215, 0.75); font-size: 0.9rem;
}
.site-footer .divider { margin: 0 auto 14px; width: 220px; }
.site-footer p { margin: 4px 0; }
.footer-links { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.footer-links a { color: var(--gold-hi); text-decoration: none; }
.footer-links a:hover { color: #fff1c4; text-decoration: underline; }

/* ------------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .doc-layout { grid-template-columns: minmax(0, 1fr); margin-top: 24px; gap: 20px; }
  .toc { display: none; }

  .toc-mobile {
    display: block;
    padding: 14px 18px;
    background: rgba(252, 245, 231, 0.95);
    border: 1.5px solid var(--gold);
    border-radius: 16px;
    box-shadow: 0 8px 22px rgba(18, 9, 2, 0.35);
  }
  .toc-mobile summary { margin: 0; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
  .toc-mobile summary::-webkit-details-marker { display: none; }
  .toc-mobile summary::after { content: "+"; font-size: 1.2rem; color: var(--gold-mid); }
  .toc-mobile[open] summary::after { content: "\2212"; }
  .toc-mobile[open] ol { margin-top: 10px; }

  /* The logo needs room above the panel once the contents sit on top */
  .doc { margin-top: 64px; }
}

@media (max-width: 640px) {
  body { font-size: 1rem; }
  main { padding: 20px 14px 48px; }
  .site-header { padding: 10px 14px; }
  .brand-sub { display: none; }
  .brand img { width: 38px; height: 38px; }
  .site-nav a { padding: 7px 11px; font-size: 0.68rem; }
  .cards { grid-template-columns: minmax(0, 1fr); gap: 24px; margin-top: 32px; }
  .doc { padding: 76px 20px 36px; }
  .doc-logo { width: 180px; }
  .doc h2 { gap: 10px; }
}

@media (max-width: 520px) {
  /* Icon only, so both pills fit on one row */
  .brand-text { display: none; }
  .site-nav { flex-wrap: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* ------------------------------------------------------------------ print */

@media print {
  body { background: #fff; color: #000; font-size: 11pt; }
  body::before, .site-header, .site-footer, .toc, .toc-mobile, .crest, .doc-logo, .divider, .badge, .skip { display: none !important; }
  main { padding: 0; }
  .doc-layout { display: block; margin: 0; }
  .parchment { background: none; border: 0; box-shadow: none; padding: 0; }
  .doc h2 .num { background: none; box-shadow: none; width: auto; height: auto; }
  a { color: #000; }
}
