@import url("tokens.css");

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

html {
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--surface-0);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent-hover);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

h1,
h2,
h3,
h4 {
  font-weight: 550;
  line-height: var(--lh-tight);
  letter-spacing: -0.02em;
  margin: 0 0 var(--space-4);
}

p {
  margin: 0 0 var(--space-4);
}

p:last-child {
  margin-bottom: 0;
}

ul {
  margin: 0 0 var(--space-4);
  padding-left: 1.2em;
}

/* —— Layout —— */
.wrap {
  width: min(100% - 2 * var(--gutter), var(--wrap));
  margin-inline: auto;
}

.wrap--narrow {
  width: min(100% - 2 * var(--gutter), var(--wrap-narrow));
}

.site-main {
  min-height: 60vh;
}

.section {
  padding: var(--space-8) 0;
}

.section--tight {
  padding: var(--space-7) 0;
}

.section--muted {
  background: var(--section-fade);
}

.eyebrow {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-3);
}

.lede {
  font-size: var(--fs-md);
  color: var(--ink-soft);
  max-width: 40rem;
}

.tm {
  font-size: 0.55em;
  vertical-align: super;
  line-height: 0;
  font-weight: 500;
}

/* —— Nav —— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  background: rgba(244, 246, 248, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(18, 23, 28, 0.06);
}

.nav {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.nav__brand {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: var(--tracking-brand);
  color: var(--ink);
  text-decoration: none;
}

.nav__brand:hover {
  color: var(--ink);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav__links a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: var(--fs-sm);
  font-weight: 500;
}

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

.nav__dropdown {
  position: relative;
}

.nav__dropdown summary {
  list-style: none;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  font-weight: 500;
}

.nav__dropdown summary::-webkit-details-marker {
  display: none;
}

.nav__dropdown summary:hover {
  color: var(--ink);
}

.nav__menu {
  position: absolute;
  top: calc(100% + 0.6rem);
  left: 0;
  min-width: 14rem;
  padding: var(--space-2);
  background: #fff;
  border: 1px solid rgba(18, 23, 28, 0.08);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  list-style: none;
  margin: 0;
}

.nav__menu a {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
}

.nav__menu a:hover {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.nav__cta {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--ink-on-dark) !important;
  text-decoration: none !important;
  font-size: var(--fs-sm);
  font-weight: 600;
}

.nav__cta:hover {
  background: var(--accent-hover);
}

.nav__toggle {
  display: none;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.nav__toggle span {
  display: block;
  width: 1.35rem;
  height: 2px;
  margin: 0.28rem auto;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 200ms var(--ease-out), opacity 200ms;
}

.nav__toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}

.nav__toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav__toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

@media (max-width: 820px) {
  .nav__toggle {
    display: block;
  }

  .nav__panel {
    position: fixed;
    inset: var(--nav-h) 0 auto 0;
    background: rgba(244, 246, 248, 0.98);
    border-bottom: 1px solid rgba(18, 23, 28, 0.08);
    padding: var(--space-5) var(--gutter) var(--space-6);
    transform: translateY(-120%);
    opacity: 0;
    pointer-events: none;
    transition: transform 280ms var(--ease-out), opacity 280ms;
  }

  .nav__panel.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav__links {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
  }

  .nav__dropdown {
    width: 100%;
  }

  .nav__menu {
    position: static;
    box-shadow: none;
    border: 0;
    background: transparent;
    padding: var(--space-2) 0 0 var(--space-3);
  }
}

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.85rem;
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 180ms, color 180ms, border-color 180ms, transform 180ms;
}

.btn:hover {
  text-decoration: none;
}

.btn--primary {
  background: var(--accent);
  color: var(--ink-on-dark);
}

.btn--primary:hover {
  background: var(--accent-hover);
  color: var(--ink-on-dark);
}

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: rgba(18, 23, 28, 0.18);
}

.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
  background: var(--accent-soft);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

/* —— Hero —— */
.hero {
  position: relative;
  min-height: calc(100vh - var(--nav-h));
  display: flex;
  align-items: center;
  padding: var(--space-8) 0 var(--space-7);
  background: var(--hero-wash);
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--hero-glow);
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(
      rgba(18, 23, 28, 0.035) 1px,
      transparent 1px
    );
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 85%);
  pointer-events: none;
}

.hero__inner {
  position: relative;
  z-index: 1;
  max-width: 40rem;
}

.hero__brand {
  font-size: var(--fs-3xl);
  font-weight: 600;
  letter-spacing: var(--tracking-brand);
  margin: 0 0 var(--space-5);
  color: var(--ink);
}

.hero__promise {
  font-family: var(--font-serif);
  font-size: var(--fs-promise);
  font-weight: 450;
  font-style: italic;
  line-height: var(--lh-snug);
  margin: 0 0 var(--space-5);
  color: var(--ink);
}

.hero__support {
  font-size: var(--fs-md);
  color: var(--ink-soft);
  max-width: 34rem;
  margin: 0;
}

.page-hero {
  padding: var(--space-8) 0 var(--space-6);
  background: var(--hero-wash);
  position: relative;
  overflow: hidden;
}

.page-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--hero-glow);
  pointer-events: none;
}

.page-hero .wrap {
  position: relative;
  z-index: 1;
}

.page-hero h1 {
  font-size: var(--fs-2xl);
  margin-bottom: var(--space-3);
}

.page-hero .lede {
  margin-bottom: 0;
}

.status-line {
  display: inline-block;
  margin-top: var(--space-4);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-size: var(--fs-sm);
  font-weight: 500;
}

/* —— Motion —— */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--dur) var(--ease-out),
    transform var(--dur) var(--ease-out);
}

.reveal.is-in {
  opacity: 1;
  transform: none;
}

.hero .reveal--hero {
  opacity: 0;
  animation: heroFade 900ms var(--ease-out) forwards;
}

.hero .reveal--hero:nth-child(2) {
  animation-delay: 120ms;
}

.hero .reveal--hero:nth-child(3) {
  animation-delay: 220ms;
}

.hero .cta-row.reveal--hero {
  animation-delay: 320ms;
}

.promise-hold {
  animation: promiseHold 1.4s var(--ease-out) 0.35s both;
}

@keyframes heroFade {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes promiseHold {
  0% {
    opacity: 0;
    letter-spacing: 0.01em;
  }
  55% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    letter-spacing: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero .reveal--hero,
  .promise-hold {
    animation: none;
    opacity: 1;
  }
}

/* —— Product cards (not in hero) —— */
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
  margin-top: var(--space-6);
}

@media (max-width: 900px) {
  .product-grid {
    grid-template-columns: 1fr;
  }
}

.product-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(18, 23, 28, 0.07);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  color: inherit;
  transition: transform 220ms var(--ease-out), border-color 220ms;
}

.product-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-line);
  color: inherit;
}

.product-card__visual {
  height: 8.5rem;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  overflow: hidden;
  background: var(--surface-1);
}

.product-card__visual svg {
  width: 100%;
  height: 100%;
}

.product-card h3 {
  font-size: var(--fs-lg);
  margin-bottom: var(--space-2);
}

.product-card p {
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  flex: 1;
}

.product-card__status {
  font-size: var(--fs-xs);
  color: var(--accent-hover);
  font-weight: 600;
  margin: var(--space-3) 0;
}

.product-card__cta {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--accent);
}

/* —— Method list —— */
.method-list {
  list-style: none;
  padding: 0;
  margin: var(--space-6) 0 0;
  display: grid;
  gap: var(--space-5);
}

.method-list li {
  max-width: 36rem;
  padding-left: var(--space-5);
  border-left: 2px solid var(--accent-line);
}

.method-list strong {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--fs-md);
}

.method-list span {
  color: var(--ink-soft);
}

/* —— Forms —— */
.form {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-5);
}

.form label {
  display: grid;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  font-weight: 550;
  color: var(--ink-soft);
}

.form input,
.form select,
.form textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(18, 23, 28, 0.16);
  border-radius: var(--radius-sm);
  background: #fff;
  font: inherit;
  color: var(--ink);
}

.form textarea {
  min-height: 8rem;
  resize: vertical;
}

.form input:focus,
.form select:focus,
.form textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}

.hp {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  width: 0;
  overflow: hidden;
}

.form-note {
  font-size: var(--fs-xs);
  color: var(--ink-muted);
  margin-top: var(--space-3);
}

.form-status {
  margin-top: var(--space-3);
  font-size: var(--fs-sm);
  min-height: 1.4em;
}

.form-status.is-ok {
  color: var(--accent-hover);
}

.form-status.is-err {
  color: #8a2f2f;
}

/* —— Footer —— */
.site-footer {
  margin-top: var(--space-8);
  padding: var(--space-7) 0 var(--space-6);
  background: var(--surface-ink);
  color: rgba(244, 246, 248, 0.82);
}

.site-footer a {
  color: rgba(244, 246, 248, 0.88);
  text-decoration: none;
}

.site-footer a:hover {
  color: #fff;
}

.footer__brand {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: #fff;
  letter-spacing: var(--tracking-brand);
}

.footer__promise {
  font-family: var(--font-serif);
  font-style: italic;
  margin: var(--space-2) 0 var(--space-5);
  color: rgba(244, 246, 248, 0.7);
}

.footer__grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

@media (max-width: 800px) {
  .footer__grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .footer__grid {
    grid-template-columns: 1fr;
  }
}

.footer__col h4 {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: rgba(244, 246, 248, 0.5);
  margin-bottom: var(--space-3);
}

.footer__col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.45rem;
  font-size: var(--fs-sm);
}

.footer__meta {
  padding-top: var(--space-5);
  border-top: 1px solid rgba(244, 246, 248, 0.1);
  font-size: var(--fs-xs);
  color: rgba(244, 246, 248, 0.5);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: space-between;
}

.footer__meta a {
  color: rgba(244, 246, 248, 0.65);
}

/* —— Content pages —— */
.prose {
  max-width: 42rem;
}

.prose h2 {
  font-size: var(--fs-xl);
  margin-top: var(--space-7);
}

.prose h3 {
  font-size: var(--fs-lg);
  margin-top: var(--space-6);
}

.prose .promise-block {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--fs-xl);
  margin: var(--space-5) 0;
  padding-left: var(--space-4);
  border-left: 2px solid var(--accent-line);
}

.split-cta {
  margin-top: var(--space-7);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  background: var(--hero-wash);
  border: 1px solid rgba(18, 23, 28, 0.06);
}

.split-cta h2 {
  font-size: var(--fs-xl);
  margin-bottom: var(--space-2);
}

/* —— 404 —— */
.error-page {
  min-height: calc(100vh - var(--nav-h) - 12rem);
  display: grid;
  place-content: center;
  text-align: center;
  padding: var(--space-8) var(--gutter);
}

.error-page h1 {
  font-size: var(--fs-3xl);
}

/* —— Product page visuals —— */
.product-plate {
  margin: var(--space-6) 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-width: 36rem;
  border: 1px solid rgba(18, 23, 28, 0.06);
}

.product-plate svg {
  width: 100%;
  height: auto;
}

.honesty {
  margin: var(--space-6) 0;
  padding: var(--space-5);
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
}

.honesty p {
  margin: 0;
  color: var(--ink-soft);
}

/* —— Cognissimo Math soft launch (/math/) —— */
.math-hero {
  position: relative;
  overflow: hidden;
  padding: var(--space-8) 0 var(--space-7);
  background: var(--hero-wash);
}

.math-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--hero-glow);
  pointer-events: none;
}

/* Soft Option B landscape accent — house Clarissimo stays primary */
.math-hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42%;
  pointer-events: none;
  opacity: 0.55;
  background:
    radial-gradient(ellipse 80% 60% at 18% 100%, rgba(47, 111, 118, 0.1), transparent 70%),
    radial-gradient(ellipse 70% 50% at 78% 100%, rgba(18, 23, 28, 0.05), transparent 65%);
  border-bottom: 1px solid rgba(47, 111, 118, 0.12);
  mask-image: linear-gradient(180deg, transparent, #000 40%);
}

.math-hero__inner {
  position: relative;
  z-index: 1;
  max-width: 40rem;
}

.math-hero__title {
  font-size: var(--fs-2xl);
  font-weight: 600;
  letter-spacing: var(--tracking-brand);
  margin: 0 0 var(--space-4);
}

.math-hero__promise {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 3.5vw, 2.25rem);
  font-weight: 450;
  font-style: italic;
  line-height: var(--lh-snug);
  margin: 0 0 var(--space-4);
  color: var(--ink);
}

.math-hero__support {
  font-size: var(--fs-md);
  color: var(--ink-soft);
  max-width: 34rem;
  margin: 0;
}

.math-hero .cta-row {
  margin-top: var(--space-5);
}

.math-hero .reveal--hero {
  opacity: 0;
  animation: heroFade 900ms var(--ease-out) forwards;
}

.math-hero .reveal--hero:nth-child(2) {
  animation-delay: 80ms;
}

.math-hero .reveal--hero:nth-child(3) {
  animation-delay: 160ms;
}

.math-hero .reveal--hero:nth-child(4) {
  animation-delay: 240ms;
}

.math-hero .reveal--hero:nth-child(5) {
  animation-delay: 300ms;
}

.math-hero .cta-row.reveal--hero {
  animation-delay: 380ms;
}

.math-plate {
  margin: var(--space-6) 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-width: 36rem;
  border: 1px solid rgba(18, 23, 28, 0.06);
  box-shadow: var(--shadow-soft);
}

.math-plate img {
  width: 100%;
  height: auto;
}

.offer-list {
  list-style: none;
  padding: 0;
  margin: var(--space-6) 0 0;
  display: grid;
  gap: var(--space-5);
  max-width: 40rem;
}

.offer-list li {
  padding-left: var(--space-5);
  border-left: 2px solid var(--accent-line);
}

.offer-list strong {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--fs-md);
}

.offer-list span {
  color: var(--ink-soft);
  font-size: var(--fs-sm);
}

@media (prefers-reduced-motion: reduce) {
  .math-hero .reveal--hero {
    animation: none;
    opacity: 1;
  }
}
