/* ==========================================================================
   IMMERSION — base
   Element defaults and the components shared across every screen.

   Every value here comes from tokens.css. No raw hex.

   Note for anyone porting the Phase 1 child-theme CSS: the `html body` /
   `html h1` prefixes that file carried existed only to out-specify Talemy's
   customizer output. There is no parent theme here, so plain selectors are
   correct and the prefixes have been removed deliberately.
   ========================================================================== */

/* --- Reset ---------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--imm-font-ui);
  font-size: 16px;
  line-height: 1.6;
  color: var(--imm-body);
  background-color: var(--imm-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* LearnDash renders inline icons and sized images inside its own layouts.
   `display: block` breaks them out of the line they belong on, and `height:
   auto` collapses ones it sizes explicitly — so the reset is withdrawn inside
   LearnDash markup rather than imposed on it. */
.learndash-wrapper img,
.learndash-wrapper svg,
.learndash-wrapper picture {
  display: revert;
  height: revert;
}

/* `font: inherit` is safe — it only unifies the family. `color: inherit` was
   NOT: LearnDash buttons set a coloured background and rely on their own text
   colour, so inheriting body colour put dark text on a dark button. Only the
   family and size are inherited now. */
button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

/* --- Headings ------------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--imm-s-3);
  font-weight: 800;
  line-height: 1.25;
  color: var(--imm-ink);
  letter-spacing: var(--imm-track-h1);
}

h1 { font-size: 29px; }
h2 { font-size: 24px; }
h3 { font-size: 19px; }

h4, h5, h6 {
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: normal;
}

p { margin: 0 0 var(--imm-s-5); }

/* --- Links ---------------------------------------------------------------- */

a {
  color: var(--imm-teal);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color var(--imm-t-btn);
}

a:hover,
a:focus { color: var(--imm-teal-hover); }

/* --- Accessibility -------------------------------------------------------- */

.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.imm-skip-link:focus {
  position: fixed;
  top: var(--imm-s-3);
  left: var(--imm-s-3);
  z-index: 1000;
  width: auto;
  height: auto;
  padding: var(--imm-s-3) var(--imm-s-5);
  clip: auto;
  clip-path: none;
  background: var(--imm-ink);
  color: #fff;
  border-radius: var(--imm-r-nav);
}

:focus-visible {
  outline: 2px solid var(--imm-teal);
  outline-offset: 2px;
}

/* --- Type utilities ------------------------------------------------------- */

.imm-eyebrow {
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: var(--imm-track-eyebrow);
  text-transform: uppercase;
  color: var(--imm-faint);
}

.imm-eyebrow--on-dark { color: var(--imm-faint-dark); }

.imm-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: var(--imm-track-label);
  text-transform: uppercase;
  color: var(--imm-faint);
}

/* Screenplay. Line height is set per context: 1.8 in the drill, 1.85 in the
   reader — see the phase that owns each. */
.imm-script {
  font-family: var(--imm-font-script);
  font-variant-ligatures: none;
}

/* Editorial serif — marketing pull quotes only, never UI. */
.imm-editorial { font-family: var(--imm-font-serif); }

.imm-prose {
  max-width: var(--imm-prose-max);
  font-size: 16.5px;
  line-height: 1.7;
}

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

.imm-page-title {
  font-size: 34px;
  letter-spacing: var(--imm-track-h1);
}

/* --- Layout --------------------------------------------------------------- */

.imm-wrap {
  width: 100%;
  max-width: var(--imm-reading-max);
  margin-inline: auto;
  padding: var(--imm-s-11) var(--imm-s-12) var(--imm-s-13);
}

.imm-wrap--wide { max-width: var(--imm-content-max); }

/* --- Buttons -------------------------------------------------------------- */

.imm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--imm-s-2);
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: var(--imm-r-btn);
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--imm-t-btn),
              border-color var(--imm-t-btn),
              color var(--imm-t-btn);
}

.imm-btn--primary { background-color: var(--imm-red); color: #fff; }
.imm-btn--primary:hover { background-color: #d81f3f; color: #fff; }

.imm-btn--secondary { background-color: var(--imm-teal); color: #fff; }
.imm-btn--secondary:hover { background-color: var(--imm-teal-hover); color: #fff; }

.imm-btn--quiet {
  background-color: var(--imm-paper);
  border-color: var(--imm-line);
  border-radius: var(--imm-r-nav);
  color: var(--imm-ink);
}
.imm-btn--quiet:hover { border-color: var(--imm-line-2); color: var(--imm-ink); }

.imm-btn--on-dark {
  background-color: transparent;
  border-color: var(--imm-ink-line-3);
  color: var(--imm-on-dark);
}
.imm-btn--on-dark:hover { border-color: var(--imm-on-dark-2); color: #fff; }

.imm-btn--primary:focus-visible   { outline-color: var(--imm-red); }
.imm-btn--secondary:focus-visible { outline-color: var(--imm-teal); }

@media (forced-colors: active) {
  .imm-btn:focus-visible,
  a:focus-visible { outline: 2px solid CanvasText; }
}

/* --- Chips ---------------------------------------------------------------
   Shared: the checkpoint chip on the course page and the free-sample chip on
   step pages. Lives here rather than in course.css because lesson and topic
   screens do not load that file.
   -------------------------------------------------------------------------- */

.imm-chip {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--imm-r-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* --- Cards ---------------------------------------------------------------- */

.imm-card {
  padding: var(--imm-s-7);
  background: var(--imm-paper);
  border: 1px solid var(--imm-line);
  border-radius: var(--imm-r-panel);
}

.imm-card__title {
  margin-bottom: var(--imm-s-2);
  font-size: 17.5px;
}

.imm-card__title a { color: var(--imm-ink); text-decoration: none; }
.imm-card__title a:hover { color: var(--imm-teal); }

.imm-card__excerpt { color: var(--imm-muted); font-size: 14.5px; }

.imm-list {
  display: grid;
  gap: var(--imm-s-4);
}

/* --- Progress ------------------------------------------------------------- */

.imm-progress {
  height: 8px;
  border-radius: var(--imm-r-pill);
  background-color: var(--imm-progress-track);
  overflow: hidden;
}

.imm-progress__fill {
  height: 100%;
  border-radius: inherit;
  background: var(--imm-progress-fill);
  transition: width var(--imm-t-progress);
}

/* --- Forms ---------------------------------------------------------------- */

.imm-search { display: flex; gap: var(--imm-s-2); }

.imm-search__field,
input[type="text"],
input[type="email"],
input[type="search"],
input[type="password"],
textarea {
  padding: 12px 14px;
  background: var(--imm-paper);
  border: 1px solid var(--imm-line-2);
  border-radius: var(--imm-r-input);
  font-size: 15px;
  color: var(--imm-ink);
}

textarea { width: 100%; line-height: 1.6; }

/* --- Misc ----------------------------------------------------------------- */

.imm-empty { color: var(--imm-faint); }

.imm-pagination {
  margin-top: var(--imm-s-9);
  font-size: 14.5px;
}

/* --- Touch targets --------------------------------------------------------
   Handoff § Phase 12: minimum hit target 44px. Set once here rather than per
   screen — .imm-btn's own padding computes to about 40px, which is under the
   line on every screen that uses it.
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .imm-btn,
  button,
  input[type="submit"],
  input[type="button"] {
    min-height: 44px;
  }

  input[type="text"],
  input[type="email"],
  input[type="search"],
  input[type="password"],
  select {
    min-height: 44px;
  }
}

/* --- Motion --------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
