/*
 * Marketing site only (Spec0066). Loaded by layouts/marketing.html.haml and
 * nowhere else.
 *
 * Layout, rhythm and surface treatment only. Every color, font, space,
 * radius and shadow value comes from shared-styles/tokens.css -- nothing
 * here defines or overrides a token. This file is exempt from the
 * "document it in both style guides" rule because it has no React twin and
 * never will (see Brand Colors and Styles.md, Working rule).
 *
 * Narrow screens are the first-class case here: the marketing site is the
 * first Cedarras surface a stranger sees, and they usually see it on a
 * phone (Spec0066 section 5).
 */

.m-nav,
.marketing,
.site-footer {
  --m-max: 70rem;
  --m-prose: 44rem;
  --m-band-y: clamp(3.25rem, 8vw, 6rem);

}

.marketing {
  width: 100%;
  flex: 1;
}

/* ---- Width ---- */

.m-wrap {
  width: 100%;
  max-width: var(--m-max);
  margin: 0 auto;
  padding-inline: var(--space-5);
}

.m-wrap--prose {
  max-width: var(--m-prose);
}

/* Reading width for a long single-column list (the Features page), wider than
 * prose because of the icon gutter beside each item. */
.m-wrap--read {
  max-width: 54rem;
}

@media (max-width: 30rem) {
  .m-wrap {
    padding-inline: var(--space-4);
  }
}

/* ---- Navigation ----
 * Sticky, translucent, and collapses to wordmark + one button under 48rem
 * with the page links wrapping below. No JavaScript, no hamburger. */

.m-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--color-page-bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--color-border);
}

.m-nav__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  max-width: var(--m-max);
  margin: 0 auto;
  padding: var(--space-3) var(--space-5);
}

.m-nav__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  margin-right: auto;
  text-decoration: none;
  color: var(--color-primary-hover);
}

.m-nav__brand img {
  display: block;
  width: 2rem;
  height: 2rem;
}

.m-nav__wordmark {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--font-size-xl);
  letter-spacing: -0.01em;
  line-height: 1;
}

.m-nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  flex-wrap: wrap;
}

.m-nav__links a {
  text-decoration: none;
  font-weight: 500;
  color: var(--color-text-muted);
  padding-block: var(--space-1);
}

.m-nav__links a:hover,
.m-nav__links a[aria-current="page"] {
  color: var(--color-primary-hover);
}

.m-nav__links a[aria-current="page"] {
  box-shadow: inset 0 -2px 0 var(--color-primary);
}

@media (max-width: 48rem) {
  .m-nav__inner {
    padding-inline: var(--space-4);
    row-gap: var(--space-3);
  }
  .m-nav__cta {
    order: 2;
  }
  .m-nav__links {
    order: 3;
    width: 100%;
    gap: var(--space-4);
    justify-content: space-between;
    font-size: var(--font-size-sm);
  }
}

/* ---- Bands ----
 * Every page is a stack of full-bleed bands; the wrap inside sets the
 * measure. Alternating surfaces give the page rhythm without rules. */

.m-band {
  padding-block: var(--m-band-y);
}

.m-band--surface {
  background: var(--color-surface);
  border-block: 1px solid var(--color-border);
}

.m-band--tint {
  background: linear-gradient(180deg, var(--color-primary-tint), var(--color-page-bg));
}

.m-band--dark {
  position: relative;
  overflow: hidden;
  background: var(--color-primary-hover);
  color: var(--color-surface);
}

.m-band--dark h2,
.m-band--dark h3 {
  color: var(--color-surface);
}

.m-band--dark p {
  color: color-mix(in srgb, var(--color-surface) 82%, transparent);
}

/* The mark, oversized and barely there, behind the closing call to action. */
.m-band__watermark {
  position: absolute;
  right: -3rem;
  bottom: -5rem;
  width: 22rem;
  max-width: 55%;
  opacity: 0.1;
  filter: brightness(0) invert(1);
  pointer-events: none;
}

.m-band__head {
  max-width: var(--m-prose);
  margin-bottom: var(--space-6);
}

.m-band__head p {
  color: var(--color-text-muted);
  font-size: var(--font-size-lg);
  margin: 0;
}

.m-band--dark .m-band__head p {
  color: color-mix(in srgb, var(--color-surface) 82%, transparent);
}

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

.m-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-secondary);
  margin: 0 0 var(--space-4);
}

.m-display {
  font-family: var(--font-heading);
  font-size: clamp(2.25rem, 6.2vw, 4rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--color-primary-hover);
  margin: 0 0 var(--space-5);
  text-wrap: balance;
}

.m-title {
  font-size: clamp(1.75rem, 3.6vw, 2.5rem);
  margin: 0 0 var(--space-4);
  text-wrap: balance;
}

.m-lede {
  font-size: var(--font-size-lg);
  line-height: 1.55;
  color: var(--color-text-muted);
  max-width: 38rem;
  margin: 0 0 var(--space-6);
}

.m-note {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.marketing p {
  max-width: var(--m-prose);
}

/* ---- Hero ---- */

.m-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(170deg, var(--color-primary-tint) 0%, var(--color-page-bg) 58%);
  padding-top: clamp(2.5rem, 7vw, 4.5rem);
  padding-bottom: clamp(8.5rem, 15vw, 12.5rem);
  text-align: center;
}

.m-hero__mark {
  width: clamp(4.5rem, 11vw, 6.5rem);
  height: auto;
  margin: 0 auto var(--space-5);
  display: block;
}

.m-hero .m-display {
  margin-inline: auto;
  max-width: 18ch;
}

.m-hero .m-lede {
  margin-inline: auto;
  text-align: center;
}

.m-hero .m-eyebrow {
  justify-content: center;
}

.m-hero__proof {
  margin: var(--space-6) auto 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2) var(--space-5);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  max-width: 40rem;
}

.m-hero__proof span {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.m-hero__proof span::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-radius: var(--radius-pill);
  background: var(--color-secondary);
}

/* ---- Landscape motif ---- */

.m-landscape {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: clamp(8rem, 15vw, 12.5rem);
  display: block;
}

.m-landscape__ridge-far {
  fill: var(--color-secondary);
  opacity: 0.18;
}
.m-landscape__ridge-near {
  fill: var(--color-primary);
  opacity: 0.3;
}
.m-landscape__trees {
  fill: var(--color-primary);
  opacity: 0.5;
}
/* The river bed erases the land under the river, so the tint above it is not
 * a second wash over the ridge (which read as a shadow rather than water). */
.m-landscape__river-bed {
  fill: var(--color-page-bg);
}
/* The river and the ocean are one body of water, so they share a fill. */
.m-landscape__river,
.m-landscape__ocean {
  fill: var(--color-secondary);
  opacity: 0.34;
}
.m-landscape__waves {
  fill: none;
  stroke: var(--color-page-bg);
  stroke-width: 3;
  stroke-linecap: round;
  opacity: 0.8;
}

/* ---- Calls to action ---- */

.m-cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
}

.m-hero .m-cta-row {
  justify-content: center;
}

/* Buttons are links here, so the inherited underline has to go everywhere,
 * not just inside a call-to-action row. */
a.btn {
  text-decoration: none;
}

.m-textlink {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
  text-decoration: none;
}

.m-textlink:hover {
  text-decoration: underline;
}

.m-textlink::after {
  content: "\2192";
  transition: transform 0.15s ease;
}

.m-textlink:hover::after {
  transform: translateX(2px);
}

.m-band--dark .m-textlink {
  color: var(--color-surface);
}

.m-band--dark .btn--primary {
  background: var(--color-surface);
  color: var(--color-primary-hover);
}

.m-band--dark .btn--primary:hover:not(:disabled) {
  background: var(--color-primary-tint);
}

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

.m-cards {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
}

.m-cards--two {
  grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr));
}

.m-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius-default) * 2);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.m-band--surface .m-card {
  background: var(--color-page-bg);
}

.m-card h3 {
  font-size: var(--font-size-lg);
  margin: 0 0 var(--space-2);
}

.m-card p {
  margin: 0 0 var(--space-3);
  color: var(--color-text-muted);
}

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

.m-icon {
  width: 1.5rem;
  height: 1.5rem;
}

.m-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-default);
  background: var(--color-primary-tint);
  color: var(--color-primary);
  margin-bottom: var(--space-4);
}

/* ---- Two-column split (the "second list" contrast) ---- */

.m-split {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  align-items: stretch;
}

.m-compare {
  border-radius: calc(var(--radius-default) * 2);
  padding: var(--space-5);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.m-compare--them {
  color: var(--color-text-muted);
}

.m-compare--us {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
}

.m-compare h3 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-3);
}

.m-compare--them h3 {
  color: var(--color-text-muted);
}

.m-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-3);
}

.m-list li {
  display: grid;
  grid-template-columns: 1.25rem 1fr;
  gap: var(--space-3);
  align-items: start;
  line-height: 1.5;
}

.m-list li::before {
  content: "\2713";
  color: var(--color-primary);
  font-weight: 700;
  line-height: 1.4;
}

.m-list--plain li::before {
  content: "\2022";
  color: var(--color-border-strong);
}

/* ---- The Kit round trip ----
 * The river, stated as a product flow: out of Kit, through the course, and
 * back into Kit. */

.m-flow {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  counter-reset: m-flow;
}

.m-flow__step {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius-default) * 2);
  padding: var(--space-5) var(--space-4) var(--space-4);
}

.m-flow__step::before {
  counter-increment: m-flow;
  content: counter(m-flow);
  position: absolute;
  top: calc(var(--space-4) * -1);
  left: var(--space-4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
  color: var(--color-text-on-primary);
  font-size: var(--font-size-sm);
  font-weight: 700;
}

.m-flow__step h3 {
  font-size: var(--font-size-base);
  font-family: var(--font-body);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-secondary);
  margin: 0 0 var(--space-2);
}

.m-flow__step p {
  margin: 0;
  color: var(--color-text-muted);
}

/* ---- Feature sections (Features page) ---- */

.m-feature {
  display: grid;
  grid-template-columns: 2.75rem 1fr;
  gap: var(--space-4) var(--space-5);
  padding-block: var(--space-5);
  border-top: 1px solid var(--color-border);
}

.m-feature:first-of-type {
  border-top: 0;
}

.m-feature__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-default);
  background: var(--color-primary-tint);
  color: var(--color-primary);
}

.m-feature h2 {
  font-size: var(--font-size-xl);
  margin: 0 0 var(--space-3);
}

.m-feature p {
  margin: 0 0 var(--space-3);
}

.m-feature p:last-child {
  margin-bottom: 0;
}

@media (max-width: 34rem) {
  .m-feature {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
}

/* ---- Pricing ---- */

.m-plans {
  display: grid;
  gap: var(--space-5);
  /* One column per visible plan (set inline by the pricing page). */
  grid-template-columns: repeat(var(--plan-count, 4), 1fr);
}

@media (max-width: 72rem) {
  .m-plans {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 40rem) {
  .m-plans {
    grid-template-columns: 1fr;
    max-width: 26rem;
    margin-inline: auto;
  }
}

.m-plan {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius-default) * 2);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  height: 100%;
}

/* Each card spans four rows of the plans grid (head, limits, features,
 * button) and shares them via subgrid, so every card's price block is as
 * tall as the tallest in its row and the first rule lines up across. */
@supports (grid-template-rows: subgrid) {
  .m-plan {
    display: grid;
    grid-row: span 4;
    grid-template-rows: subgrid;
    row-gap: var(--space-4);
  }
}

.m-plan__head {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.m-plan--featured {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
}

.m-plan h2 {
  font-size: var(--font-size-xl);
  margin: 0;
}

.m-plan p {
  margin: 0;
  color: var(--color-text-muted);
}

.m-plan__price {
  font-family: var(--font-heading);
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--color-text-muted);
  line-height: 1.1;
}

.m-plan__limits {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-2);
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-4);
}

.m-plan__limits li {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  font-size: var(--font-size-sm);
}

.m-plan__limits li > span:first-child {
  color: var(--color-text-muted);
}

/* Row label plus its tooltip (CED-16). CSS only -- the marketing site sends
 * no JavaScript. The text shows on hover, on keyboard focus, and on tap
 * (which focuses the button), and spans the whole row above it so it never
 * runs off the card. */
.m-plan__label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.m-tip {
  display: inline-flex;
}

.m-tip__btn {
  display: inline-grid;
  place-items: center;
  inline-size: 1.05rem;
  block-size: 1.05rem;
  padding: 0;
  border: 1px solid currentColor;
  border-radius: var(--radius-pill);
  background: none;
  color: inherit;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  cursor: help;
}

.m-tip__btn:hover,
.m-tip__btn:focus-visible {
  color: var(--color-primary);
}

.m-tip__btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.m-tip__text {
  display: none;
  position: absolute;
  z-index: 10;
  left: 0;
  right: 0;
  bottom: calc(100% + var(--space-2));
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-default);
  background: var(--color-text);
  color: var(--color-surface);
  box-shadow: var(--shadow-md);
  font-size: var(--font-size-sm);
  font-weight: 400;
  line-height: 1.45;
  text-align: left;
}

/* Bridges the gap to the button, so the pointer can move onto the text
 * without it closing. */
.m-tip__text::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: var(--space-2);
}

.m-tip:hover .m-tip__text,
.m-tip__btn:focus + .m-tip__text {
  display: block;
}

/* iOS Safari leaves :hover stuck on the last tapped element and only moves
 * it when the next tap lands on something it treats as clickable. A pointer
 * cursor makes the whole page count, so tapping anywhere closes an open
 * tooltip. Touch-only, so desktop cursors are unchanged. */
@media (hover: none) {
  body:has(.m-tip) {
    cursor: pointer;
  }
}

.m-plan .btn {
  text-decoration: none;
  margin-top: auto;
}

.m-plan--featured .m-plan__price {
  color: var(--color-primary);
}

.m-plan__per {
  font-size: var(--font-size-base);
  font-weight: 400;
}

.m-plan p.m-plan__annual {
  margin-top: calc(var(--space-3) * -1);
  font-size: var(--font-size-sm);
}

/* Dimmed by color, not opacity, so a row's tooltip stays fully opaque. */
.m-plan__limits li.m-plan__off > span:first-child {
  color: color-mix(in srgb, var(--color-text-muted) 55%, transparent);
}

.m-plan__limits li.m-plan__off > span:last-child {
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}

/* ---- About ---- */

.m-quote {
  margin: 0;
  text-align: center;
  font-family: var(--font-heading);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--color-primary-hover);
}

.m-quote::before,
.m-quote::after {
  content: "";
  display: block;
  width: 3rem;
  height: 2px;
  margin: var(--space-5) auto;
  background: var(--color-primary);
  opacity: 0.4;
}

.m-quote p {
  margin: 0;
  max-width: none;
}

.m-mark-inline {
  width: 3.5rem;
  height: 3.5rem;
  display: block;
  margin-bottom: var(--space-4);
}

.m-contact {
  display: inline-block;
  font-size: var(--font-size-lg);
  font-weight: 600;
}

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

@media (prefers-reduced-motion: reduce) {
  .m-textlink::after {
    transition: none;
  }
}

/* ---- Small utilities ---- */

.m-pad-top {
  margin-top: var(--space-6);
}

.m-list li strong {
  color: var(--color-text);
}

/* ---- Help (CED-18) ----
 * Creator help: the index's article cards are whole-card links, and an
 * article is the shared .markdown prose inside .m-wrap--prose. Student
 * help has its own copy of these in application.css (learn layout). */
.help-card {
  display: block;
  color: inherit;
  text-decoration: none;
}
.help-card h2 {
  font-size: var(--font-size-lg);
  margin: 0 0 var(--space-2);
  color: var(--color-primary);
}
.help-card:hover h2,
.help-card:focus-visible h2 {
  text-decoration: underline;
}
.help-breadcrumb {
  font-size: var(--font-size-sm, 0.875rem);
  margin-bottom: var(--space-3);
}
.help-breadcrumb a {
  color: var(--color-text-muted);
}
.help-article__footer {
  margin-top: var(--space-6);
  color: var(--color-text-muted);
}
