/* ==========================================================
   Trainer theme. Colours come from the skin chosen in the admin
   (theme.json); the values below are the defaults.
   Grid: label column | content column, every section opened by
   a rule with a heavy leading segment.
   ========================================================== */
@import url("https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@400;500;600;700&display=swap");

:root {
  color-scheme: dark;
  --color-bg: #020e46;
  --color-deep: #010830;
  --color-text: #ffffff;
  --color-muted: #a9acbd;
  --color-faint: #c5cae0;
  --color-line: rgba(255, 255, 255, 0.16);
  --color-accent: #5473ff;
  --color-accent-press: #3a56e8;
  --color-accent-text: #ffffff;
  --photo-filter: brightness(0.9) contrast(1.04);

  --f-serif: "Instrument Serif", "Times New Roman", serif;
  --f-sans: "Inter", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --fs-display: clamp(4.2rem, 13.2vw, 14rem);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* The trainer's photo, in natural colour. Only its edges fade into the page. */
.hero-img { background-image: url("/themes/trainer-v1.0.1/assets/img/hero.jpg"); }
.dock-img { background-image: url("/themes/trainer-v1.0.1/assets/img/portrait.jpg"); }
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--color-bg); color: var(--color-text);
  font: 500 16px/1.4 var(--f-sans); letter-spacing: -0.02em;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
p { margin: 0; }
.wrap { padding-left: max(20px, 4vw); padding-right: max(20px, 4vw); }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 4px; }

/* ---------- Top bar ---------- */
.bar {
  position: fixed; inset: 0 0 auto; z-index: 40; display: flex; align-items: center; gap: 2.5rem;
  padding-top: 1.75rem; padding-bottom: 2.5rem; background: linear-gradient(180deg, var(--color-bg) 0%, color-mix(in srgb, var(--color-bg) 85%, transparent) 45%, transparent 100%);
}
.bar .name { margin-right: auto; }
.bar a, .bar button { font: inherit; letter-spacing: inherit; color: var(--color-text); background: none; border: 0; padding: 0; cursor: pointer; }
.link { position: relative; }
.link::after { content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: right; transition: transform 0.5s var(--ease); }
.link:hover::after { transform: scaleX(1); transform-origin: left; }

/* ---------- Menu overlay ---------- */
.menu {
  position: fixed; inset: 0; z-index: 30; background: var(--color-deep);
  display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: 4vw;
  clip-path: inset(0 0 100% 0); transition: clip-path 0.9s var(--ease); visibility: hidden;
}
.menu.is-open { clip-path: inset(0); visibility: visible; }
.menu a { display: flex; align-items: baseline; gap: 1.2rem; padding: 0.6rem 0; border-top: 1px solid var(--color-line); font-weight: 700; font-size: clamp(2.4rem, 7vw, 6rem); line-height: 1; letter-spacing: -0.06em; transition: padding 0.5s var(--ease), color 0.3s; }
.menu a:hover { padding-left: 1.5rem; color: var(--color-accent); }
.menu a sup { font: 500 0.9rem var(--f-sans); letter-spacing: -0.02em; color: var(--color-muted); }
.menu a em { font: italic 400 1em var(--f-serif); letter-spacing: -0.02em; }

/* ---------- Hero ---------- */
.hero { position: relative; min-height: 100svh; display: flex; flex-direction: column; overflow: hidden; isolation: isolate; }
.hero-media { position: absolute; inset: 0; z-index: -1; background: var(--color-deep); }
.hero-img {
  position: absolute; inset: 0 0 0 34%; background-position: var(--hero-pos, 38% 0%); background-size: cover; background-repeat: no-repeat;
  filter: var(--photo-filter, none);
  transform: scale(1.14); opacity: 0; transition: transform 2.8s var(--ease), opacity 1.6s ease;
  will-change: transform;
}
.is-loaded .hero-img { transform: scale(1.02); opacity: 1; }
/* fades into the page colour so text stays readable */
.hero-media::after {
  content: ""; position: absolute; inset: 0; z-index: 2;
  background:
    linear-gradient(90deg, var(--color-bg) 0%, var(--color-bg) 34%, color-mix(in srgb, var(--color-bg) 55%, transparent) 48%, transparent 66%),
    linear-gradient(0deg, var(--color-bg) 0%, color-mix(in srgb, var(--color-bg) 60%, transparent) 24%, transparent 50%);
}
.hero-inner { flex: 1; display: flex; flex-direction: column; justify-content: space-between; padding-top: 5.5rem; padding-bottom: 2rem; }

.display { margin: 0; font-size: var(--fs-display); font-weight: 400; }
.display .line { display: block; overflow: hidden; }
.display .line > span { display: inline-block; transform: translateY(105%); transition: transform 1.5s var(--ease); }
.is-loaded .display .line > span { transform: none; }
.is-loaded .display .line:nth-child(2) > span { transition-delay: 0.12s; }
.display .serif { font-family: var(--f-serif); font-style: italic; letter-spacing: -0.02em; line-height: 0.86; padding: 0.06em 0.08em 0 0; }
.display .bold { font-family: var(--f-sans); font-weight: 700; letter-spacing: -0.065em; line-height: 0.92; padding-right: 0.06em; }

.hero-foot { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.25fr) minmax(0, 1.7fr); column-gap: 2rem; row-gap: 1.25rem; align-items: start; }
.hero-rule { grid-column: 1 / 3; height: 4px; background: var(--color-text); transform: scaleX(0); transform-origin: left; transition: transform 1.6s var(--ease) 0.5s; }
.is-loaded .hero-rule { transform: none; }
.hero-foot .spacer { grid-column: 3; }
.hero-side { white-space: nowrap; display: flex; justify-content: flex-end; align-items: end; gap: 2.5rem; align-self: end; }

.rise { opacity: 0; transform: translateY(14px); transition: opacity 1.2s ease 0.9s, transform 1.2s var(--ease) 0.9s; }
.is-loaded .rise { opacity: 1; transform: none; }

/* Section label: index + serif italic title */
.label { display: flex; align-items: flex-start; gap: 0.6rem; color: var(--color-muted); }
.label sup { font: 500 1rem/1.4 var(--f-sans); letter-spacing: -0.02em; }
.label span { font: italic 400 2.5rem/1 var(--f-serif); letter-spacing: 0.02em; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 0.6rem; height: 3rem; padding: 0 1.4rem; border-radius: 999px; background: var(--color-accent); color: var(--color-accent-text); font-weight: 600; transition: background 0.3s, transform 0.5s var(--ease); white-space: nowrap; }
.btn:hover { background: var(--color-accent-press); transform: translateY(-2px); }
.btn i { font-style: normal; transition: transform 0.5s var(--ease); }
.btn:hover i { transform: translateX(4px); }

/* ---------- Sections ---------- */
.sec { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.25fr); column-gap: 2rem; padding-top: 1.5rem; padding-bottom: 6.5rem; position: relative; border-top: 1px solid var(--color-line); }
.sec::before { content: ""; position: absolute; left: 0; top: -2px; height: 4px; width: 23%; min-width: 72px; background: var(--color-text); transform: scaleX(0); transform-origin: left; transition: transform 1.4s var(--ease); }
.sec.is-in::before { transform: none; }
.sec .label { position: sticky; top: 5.5rem; align-self: start; }
.sec-body { display: grid; gap: 3rem; max-width: 27rem; }
.sec-body > * { opacity: 0; transform: translateY(18px); transition: opacity 1s ease, transform 1s var(--ease); }
.sec.is-in .sec-body > * { opacity: 1; transform: none; }
.sec.is-in .sec-body > *:nth-child(2) { transition-delay: 0.1s; }
.sec.is-in .sec-body > *:nth-child(3) { transition-delay: 0.2s; }
.sec.is-in .sec-body > *:nth-child(4) { transition-delay: 0.3s; }

.meta { font-size: 0.625rem; line-height: 1.2; letter-spacing: 0.02em; text-transform: uppercase; color: var(--color-muted); margin-bottom: 0.75rem; }
.entry h3 { margin: 0 0 1rem; font-size: 1.25rem; line-height: 1.3; font-weight: 700; letter-spacing: -0.01em; }
.entry p { color: var(--color-muted); }
.entry p + p { margin-top: 0.9rem; }
.entry .more { display: inline-block; margin-top: 1rem; font-size: 0.625rem; letter-spacing: 0.02em; text-transform: uppercase; color: var(--color-text); }
.plain { display: grid; gap: 0.35rem; }
.plain a, .plain span { font-weight: 600; }
.lede { font-size: 1.25rem; line-height: 1.35; font-weight: 600; letter-spacing: -0.02em; }

/* ---------- Footer ---------- */
.foot { display: flex; justify-content: space-between; gap: 2rem; padding-top: 1.25rem; padding-bottom: 2rem; border-top: 4px solid var(--color-text); margin-top: 2rem; }

/* ---------- Small screens ---------- */
@media (max-width: 860px) {
  .bar .hide-s { display: none; }
  .hero-foot { grid-template-columns: 1fr; }
  .hero-rule, .hero-foot .spacer { grid-column: 1; }
  .hero-foot .spacer { display: none; }
  .hero-side { justify-content: flex-start; margin-top: 0.5rem; }
  .hero-img { inset: 0 0 22% 0; background-position: 42% 0; }
  .hero-inner { justify-content: flex-end; gap: 1.75rem; }
  .hero-side { justify-content: flex-start; }
  .hero-side .link { display: none; }
  .hero-media::after { background: linear-gradient(0deg, var(--color-bg) 22%, color-mix(in srgb, var(--color-bg) 70%, transparent) 45%, transparent 75%); }
  .sec { grid-template-columns: 1fr; row-gap: 2rem; padding-bottom: 4.5rem; }
  .sec .label { position: static; }
  .sec::before { width: 90px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .hero-img, .rise, .sec-body > *, .display .line > span, .hero-rule, .sec::before { opacity: 1; transform: none; }
}

/* ==========================================================
   Inner pages
   ========================================================== */
.hero.plain { min-height: 0; }
.hero.plain .hero-inner { padding-top: 9rem; gap: 4.5rem; }
.hero.plain .hero-media { display: none; }
.display.sm { font-size: clamp(2.6rem, 7.2vw, 7.5rem); }
.display.sm .line { overflow: visible; }
.display.sm .line > span { transform: none; opacity: 0; transition: opacity 1.2s ease; }
.is-loaded .display.sm .line > span { opacity: 1; }
.display.sm .bold { line-height: 0.98; letter-spacing: -0.055em; text-wrap: balance; display: block; max-width: 16ch; }
.display.sm .serif { font-size: 0.6em; line-height: 1.1; color: var(--color-muted); }

.page { padding-top: 6rem; }
.page .sec { grid-template-columns: minmax(0, 1.05fr) minmax(0, 2.95fr); }
.page .sec-body { max-width: none; gap: 0; }
.page .sec-body.narrow { max-width: 34rem; gap: 2.5rem; }

/* list rows: content | aside */
.row { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1.7fr); column-gap: 2rem; row-gap: 1rem; padding: 0 0 2.5rem; margin-bottom: 2.5rem; border-bottom: 1px solid var(--color-line); align-items: start; }
.row:last-child { border-bottom: 0; margin-bottom: 0; }
.row h3 { margin: 0 0 0.75rem; font-size: 1.5rem; line-height: 1.2; font-weight: 700; letter-spacing: -0.03em; }
.row h3 a { background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size 0.5s var(--ease); }
.row h3 a:hover { background-size: 100% 1px; }
.row p { color: var(--color-muted); max-width: 30rem; }
.row-aside { display: flex; justify-content: flex-end; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.price { font-weight: 700; font-size: 1.25rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.price small { display: block; font-size: 0.625rem; font-weight: 500; letter-spacing: 0.02em; text-transform: uppercase; color: var(--color-muted); text-align: right; }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--color-line); color: var(--color-text); }
.btn.ghost:hover { background: var(--color-text); color: var(--color-bg); }
button.btn { border: 0; font: inherit; font-weight: 600; letter-spacing: inherit; cursor: pointer; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

/* lessons */
.lessons { list-style: none; margin: 0; padding: 0; counter-reset: l; }
.lessons li { counter-increment: l; display: grid; grid-template-columns: 2.5rem minmax(0, 1fr) auto; gap: 1rem; align-items: baseline; padding: 1.1rem 0; border-bottom: 1px solid var(--color-line); }
.lessons li::before { content: counter(l, decimal-leading-zero); color: var(--color-muted); font-variant-numeric: tabular-nums; }
.lessons strong { font-weight: 700; display: block; }
.lessons span { color: var(--color-muted); }
.lessons .tag { font-size: 0.625rem; letter-spacing: 0.02em; text-transform: uppercase; color: var(--color-muted); white-space: nowrap; }
.lessons a.tag { color: var(--color-text); }
.lessons li.done::before { content: "✓"; color: var(--color-accent); }
.lessons li.current strong { color: var(--color-accent); }

/* progress bar (Profiler skill bars) */
.bar-line { display: grid; grid-template-columns: minmax(0, 1fr) 2.5rem; gap: 1rem; align-items: center; margin-top: 1rem; max-width: 30rem; }
.bar-line i { height: 4px; border-radius: 2px; background: var(--color-line); position: relative; overflow: hidden; }
.bar-line i::after { content: ""; position: absolute; inset: 0; background: var(--color-text); transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform 1.4s var(--ease); }
.bar-line b { font-weight: 500; color: var(--color-muted); font-variant-numeric: tabular-nums; text-align: right; }

/* prose */
.prose { max-width: 38rem; display: grid; gap: 1.25rem; font-size: 1.125rem; line-height: 1.6; font-weight: 400; letter-spacing: -0.01em; color: var(--color-faint); }
.prose p:first-child { color: var(--color-text); font-size: 1.375rem; line-height: 1.45; font-weight: 500; letter-spacing: -0.02em; }
.video { aspect-ratio: 16 / 9; width: 100%; max-width: 48rem; border: 0; background: var(--color-deep); margin-bottom: 2rem; }

/* forms */
.form { display: grid; gap: 1.75rem; max-width: 34rem; }
.field { display: grid; gap: 0.5rem; }
.field label { font-size: 0.625rem; letter-spacing: 0.02em; text-transform: uppercase; color: var(--color-muted); }
.field input, .field textarea { font: inherit; letter-spacing: inherit; color: var(--color-text); background: transparent; border: 0; border-bottom: 1px solid var(--color-line); padding: 0.5rem 0 0.75rem; border-radius: 0; width: 100%; transition: border-color 0.3s; }
.field textarea { min-height: 7rem; resize: vertical; }
.field input:focus, .field textarea:focus { outline: 0; border-bottom-color: var(--color-text); }
.field input::placeholder, .field textarea::placeholder { color: color-mix(in srgb, var(--color-muted) 55%, transparent); }
.note { color: var(--color-muted); min-height: 1.4em; }
.note.ok { color: var(--color-text); }
.note.bad { color: #ff8f8f; }
.tabs { display: flex; gap: 1.5rem; margin-bottom: 2.5rem; }
.tabs button { font: italic 400 2.5rem/1 var(--f-serif); letter-spacing: 0.02em; background: none; border: 0; padding: 0; color: var(--color-muted); opacity: 0.45; cursor: pointer; transition: opacity 0.3s; }
.tabs button[aria-selected="true"] { opacity: 1; color: var(--color-text); }
.empty { color: var(--color-muted); padding-bottom: 2rem; }
.back { display: inline-block; margin-bottom: 2rem; font-size: 0.625rem; letter-spacing: 0.02em; text-transform: uppercase; color: var(--color-muted); }

@media (max-width: 860px) {
  .hero.plain .hero-inner { padding-top: 7rem; gap: 2.5rem; }
  .page { padding-top: 4rem; }
  .page .sec { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; }
  .row-aside { justify-content: flex-start; }
  .price small { text-align: left; }
  .lessons li { grid-template-columns: 2rem minmax(0, 1fr); }
  .lessons .tag { grid-column: 2; }
}

/* ---------- Home and About: content left, portrait docked right ---------- */
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.split-main { padding-top: 7rem; }
.dock { position: sticky; top: 0; height: 100vh; overflow: hidden; background: var(--color-deep); }
.dock-img { position: absolute; inset: -6% 0; background-position: 50% 0; background-size: cover; background-repeat: no-repeat; filter: var(--photo-filter, none); }
.dock::after { content: ""; position: absolute; inset: 0; z-index: 2; background: linear-gradient(90deg, var(--color-bg) 0%, transparent 30%), linear-gradient(0deg, var(--color-bg) 0%, transparent 35%); }
.dock-cap { position: absolute; z-index: 3; left: 2rem; right: 2rem; bottom: 2rem; display: flex; justify-content: space-between; gap: 1rem; }
.letter { margin-left: calc((100% - 2rem) * 1.05 / 2.3 + 2rem); max-width: 22rem; display: grid; gap: 1.5rem; color: var(--color-muted); padding: 1rem 0 5rem; opacity: 0; transition: opacity 1.4s ease; }
.letter.is-in { opacity: 1; }
.sign { font: italic 400 3.2rem/1 var(--f-serif); color: var(--color-text); letter-spacing: 0; transform: rotate(-4deg); transform-origin: left; margin-top: 0.5rem; }
.more { display: inline-block; font-size: 0.625rem; letter-spacing: 0.02em; text-transform: uppercase; color: var(--color-text); }
.entry h3 a { background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size 0.5s var(--ease); }
.entry h3 a:hover { background-size: 100% 1px; }

/* ---------- Menu extras ---------- */
.menu a.is-current { font: italic 400 clamp(2.6rem, 7.6vw, 6.5rem)/0.92 var(--f-serif); letter-spacing: -0.02em; }
.menu a.is-current sup { font: 500 0.9rem var(--f-sans); }
.menu-foot { display: flex; gap: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--color-line); color: var(--color-muted); }
.menu .menu-foot a { display: inline; padding: 0; border: 0; font: inherit; letter-spacing: inherit; color: var(--color-text); }
.menu .menu-foot a:hover { padding: 0; color: var(--color-accent); }

/* ---------- Inner page extras ---------- */
.display.xs { font-size: clamp(2.1rem, 4.8vw, 4.75rem); }
.display.xs .bold { max-width: 22ch; line-height: 1.02; letter-spacing: -0.045em; }
.display.sm .serif:empty, .display.sm .bold:empty { min-height: 1em; display: block; }
.part { padding-bottom: 3rem; margin-bottom: 3rem; border-bottom: 1px solid var(--color-line); }
.part:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.part h3 { margin: 0 0 0.5rem; font-size: 1.5rem; line-height: 1.2; font-weight: 700; letter-spacing: -0.03em; }
.part .lessons { max-width: 44rem; }
.part .lessons li:last-child { border-bottom: 0; }
.prose h2, .prose h3 { margin: 1rem 0 0; color: var(--color-text); font-size: 1.375rem; line-height: 1.3; font-weight: 700; letter-spacing: -0.02em; }
.prose ul, .prose ol { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.4rem; }
.prose a { color: var(--color-text); text-decoration: underline; text-underline-offset: 3px; }
.prose img { max-width: 100%; height: auto; }
.prose blockquote { margin: 0; padding-left: 1.25rem; border-left: 4px solid var(--color-text); font: italic 400 1.6rem/1.3 var(--f-serif); color: var(--color-text); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.foot button { font: inherit; letter-spacing: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.page .foot { margin-top: 0; }

@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .dock { display: none; }
  .split-main { padding-top: 4rem; }
  .letter { margin-left: 0; }
  .menu-foot { flex-wrap: wrap; gap: 1rem 2rem; }
}
