/* =====================================================================
   Rafe Nauen Academy - site stylesheet
   Modern, accessible, mobile-first. No frameworks, no dependencies.
   ===================================================================== */

/* ---------- 1. Design tokens (therapeutic palette) ---------- */
:root {
  --body-bg:    #E7EFEA;   /* soft grounding sage            */
  --surface:    #FAF9F6;   /* warm safe neutral              */
  --surface-2:  #F1EEF5;   /* lavender tint for cards        */
  --nav-bg:     #5A4E6D;   /* muted constellation purple     */
  --nav-bg-2:   #463C57;
  --button-bg:  #A7C4BC;   /* gentle supportive green        */
  --teal:       #005F5F;   /* academy heading teal           */
  --coral:      #C4553D;   /* coral, darkened for contrast   */
  --accent:     #7A3E48;   /* wine accent                    */
  --text:       #2F2F2F;
  --text-muted: #5C5C66;
  --border:     #DAD6E0;

  --font-head: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-body: "Outfit", "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;

  --radius:    14px;
  --radius-sm: 8px;
  --shadow:    0 1px 2px rgba(47, 39, 64, .06), 0 8px 24px rgba(47, 39, 64, .08);
  --max-width: 72rem;
  --gutter:    clamp(1rem, 4vw, 2.5rem);
}

/* ---------- 2. Modern reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
img, svg, video { display: block; max-width: 100%; height: auto; }
input, button, select, textarea { font: inherit; }
p, li, blockquote { overflow-wrap: break-word; }

/* ---------- 3. Base typography ---------- */
body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1.0625rem;            /* 17px - comfortable reading size */
  line-height: 1.7;
  color: var(--text);
  background: var(--body-bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.2;
  color: var(--teal);
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.25rem); }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.1rem); color: var(--coral); }
h3 { font-size: 1.3rem; color: var(--nav-bg); }

p + p, p + ul, ul + p { margin-top: 1rem; }
ul { padding-inline-start: 1.25rem; }
strong { color: var(--nav-bg-2); }

a { color: var(--accent); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; border-radius: 4px; }

hr { border: 0; height: 1px; background: var(--border); margin-block: 2rem; }

.skip-link {
  position: absolute; inset-inline-start: 1rem; top: -4rem; z-index: 100;
  padding: .6rem 1rem; background: var(--nav-bg); color: #fff; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 1rem; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- 4. Constellation background (decorative) ---------- */
.constellation {
  position: fixed; inset: 0; z-index: -1;
  overflow: hidden; pointer-events: none;
}
.constellation::before,
.constellation::after {
  content: ""; position: absolute; inset: -50%;
  background-repeat: repeat;
}
.constellation::before {
  background-image:
    radial-gradient(2px 2px at 20% 30%, rgba(90, 78, 109, .35), transparent),
    radial-gradient(2px 2px at 70% 60%, rgba(90, 78, 109, .25), transparent),
    radial-gradient(1.5px 1.5px at 40% 80%, rgba(90, 78, 109, .30), transparent),
    radial-gradient(1.5px 1.5px at 80% 20%, rgba(90, 78, 109, .20), transparent);
  background-size: 320px 320px;
  animation: drift 240s linear infinite, breathe 12s ease-in-out infinite;
}
.constellation::after {
  background-image:
    radial-gradient(1px 1px at 10% 50%, rgba(122, 62, 72, .25), transparent),
    radial-gradient(1px 1px at 60% 15%, rgba(0, 95, 95, .25), transparent),
    radial-gradient(1px 1px at 85% 75%, rgba(90, 78, 109, .25), transparent);
  background-size: 220px 220px;
  animation: drift 360s linear infinite reverse;
}
@keyframes drift   { to { transform: translate3d(-25%, -25%, 0); } }
@keyframes breathe { 50% { opacity: .55; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .constellation::before, .constellation::after { animation: none; }
}

/* ---------- 5. Layout shell ---------- */
.site {
  width: min(100% - 2 * var(--gutter), var(--max-width));
  margin-inline: auto;
  padding-block: 1.25rem 2rem;
}

.site-header {
  display: grid; gap: 1rem;
  margin-bottom: 1.5rem;
}
.brand {
  font-family: var(--font-head); font-size: 1.5rem; font-weight: 600;
  color: var(--teal); text-decoration: none;
}

/* Primary navigation: wraps on small screens, no JS required */
.site-nav ul {
  display: flex; flex-wrap: wrap; gap: .35rem;
  list-style: none; padding: .4rem;
  background: var(--nav-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.site-nav a {
  display: block; padding: .55rem .95rem;
  color: #fff; text-decoration: none; font-weight: 500; font-size: .98rem;
  border-radius: calc(var(--radius) - 6px);
  transition: background-color .2s ease;
}
.site-nav a:hover, .site-nav a:focus-visible { background: rgba(255, 255, 255, .14); }
.site-nav a[aria-current="page"] { background: rgba(255, 255, 255, .22); }
.site-nav .nav-highlight { background: var(--button-bg); color: #1F2B28; font-weight: 600; }
.site-nav .nav-highlight:hover { background: #BCD6CF; }

.content {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.25rem, 4vw, 3rem);
}
.content > * + * { margin-top: 1.25rem; }
.content > h2, .content > section > h2 { margin-top: 2.25rem; }
.prose-wide {
    max-width: 1100px;
}
.lead { font-size: 1.2rem; color: var(--text-muted); }

/* ---------- 6. Components ---------- */

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .7rem 1.25rem;
  border: 0; border-radius: 999px;
  background: var(--nav-bg); color: #fff;
  font-weight: 600; text-decoration: none; line-height: 1.2;
  cursor: pointer;
  transition: transform .15s ease, background-color .2s ease;
}
.btn:hover { background: var(--nav-bg-2); transform: translateY(-1px); }
.btn--soft    { background: var(--button-bg); color: #1F2B28; }
.btn--soft:hover { background: #93B6AD; }
.btn--accent  { background: var(--accent); }
.btn--accent:hover { background: #64323B; }
.btn--ghost   { background: transparent; color: var(--nav-bg); box-shadow: inset 0 0 0 2px currentColor; }
.btn--ghost:hover { background: var(--surface-2); }

/* Card grid */
.cards {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  list-style: none; padding: 0;
}
.card {
  display: flex; flex-direction: column; gap: .5rem;
  padding: 1.4rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.card h3 { margin: 0; }
.card p { margin: 0; color: var(--text-muted); flex-grow: 1; }
.card .card-link { font-weight: 600; text-decoration: none; }
.card .card-link::after { content: " \2192"; }
.card:has(.card-link:hover) { border-color: var(--nav-bg); }

/* Callout / booking panel */
.callout {
  padding: 1.5rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--surface-2), #E5F0EC);
  border: 1px solid var(--border);
}
.callout .price { font-family: var(--font-head); font-size: 2rem; color: var(--accent); }
.callout ul { margin-block: .75rem 1.25rem; }

/* Two-column checklist */
.checklist {
  list-style: none; padding: 0;
  columns: 2 18rem; column-gap: 2rem;
}
.checklist li {
  break-inside: avoid;
  padding: .3rem 0 .3rem 1.75rem;
  position: relative;
}
.checklist li::before {
  content: ""; position: absolute; inset-inline-start: 0; top: .78rem;
  width: .7rem; height: .7rem; border-radius: 50%;
  background: var(--button-bg); box-shadow: 0 0 0 3px rgba(167, 196, 188, .35);
}

/* Testimonials */
.testimonials { display: grid; gap: 1rem; }
blockquote {
  padding: 1.25rem 1.5rem;
  background: var(--surface-2);
  border-inline-start: 4px solid var(--nav-bg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
}
blockquote footer, .testimonial-author { margin-top: .5rem; font-style: normal; font-weight: 600; color: var(--nav-bg); }

.pull-quote {
  font-family: var(--font-head); font-size: clamp(1.25rem, 1rem + 1vw, 1.6rem);
  color: var(--accent); border-inline-start-color: var(--accent);
}

/* Tables (also styles legacy database output) */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.content table { width: 100%; border-collapse: collapse; font-size: .98rem; }
.content caption {
  text-align: start; padding-bottom: .5rem;
  font-family: var(--font-head); font-size: 1.35rem; color: var(--nav-bg);
}
.content th, .content td { padding: .65rem .75rem; text-align: start; vertical-align: top; }
.content thead th, .content tr:first-child th {
  font-size: .8rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted); border-bottom: 2px solid var(--border);
}
.content tbody tr + tr td { border-top: 1px solid var(--border); }
.content tbody tr:hover td { background: rgba(167, 196, 188, .15); }

/* Book list */
.books { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); }
.book { display: flex; gap: 1rem; align-items: flex-start; }
.book img { width: 96px; flex: none; }

/* Footer */
.site-footer {
  margin-top: 2rem; padding: 1rem;
  text-align: center; font-size: .9rem; color: var(--text-muted);
}
.site-footer a { color: inherit; }
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem 1.25rem; margin-bottom: .5rem; }

/* ---------- 7. Page variants ---------- */

/* Article pages (formerly pop-ups) */
.article-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }

/* Photo-background pages (confidentiality, manual) */
.page--photo {
  background: var(--nav-bg-2) var(--page-image, none) center / cover no-repeat fixed;
}
.page--photo .content {
  background: rgba(250, 249, 246, .94);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.page--photo .brand { color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.5); }
.page--photo .site-footer, .page--photo .site-footer a { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
@media (hover: none) { .page--photo { background-attachment: scroll; } }

/* ---------- 8. Legacy include compatibility ----------
   Markup produced by the shared /include/*.inc files (header block,
   workshop table, old buttons) is given the new look here.          */
.content input[type="button"],
.content .btnBlue, .content .btnblue, .content .btngreen, .content .styled {
  display: inline-block; padding: .6rem 1.1rem; margin: .25rem .25rem .25rem 0;
  border: 0; border-radius: 999px; background: var(--nav-bg); color: #fff !important;
  font-weight: 600; cursor: pointer;
}
.content font { font-family: inherit; }

/* ---------- 9. Print ---------- */
@media print {
  .constellation, .site-nav, .skip-link, .article-actions, .site-footer nav { display: none !important; }
  body, .page--photo { background: #fff; }
  .content { box-shadow: none; padding: 0; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .8em; }
}

/* Definition list used on the training-manual page */
.manual-roles { display: grid; gap: .25rem 1.5rem; grid-template-columns: max-content 1fr; }
.manual-roles dt { font-family: var(--font-head); font-weight: 600; color: var(--nav-bg); }
.manual-roles dd { margin: 0 0 .75rem; }
@media (max-width: 36rem) { .manual-roles { grid-template-columns: 1fr; } }

/* Vertical rhythm inside articles */
.prose > * + * { margin-top: 1rem; }
.prose > h2 { margin-top: 2.25rem; }
.prose > h1 + h2, .prose > h1 + .lead { margin-top: 1.25rem; }
