/* Phase 8I.2 — responsive geometry + 8I.1 brand type */

.cn-brand-accent {
  color: #5eead4 !important;
}

.cn-brand-mark {
  white-space: nowrap;
}

/* Site-wide span { font-size: 15px } reset breaks H1 inheritance — force inherit */
.cn-hero-layout .hero-title .cn-brand-mark,
.cn-hero-layout .hero-title .cn-brand-accent,
.cn-lib-hero__title .cn-brand-accent {
  font-size: inherit !important;
  line-height: inherit !important;
  font-weight: inherit !important;
  letter-spacing: inherit;
}

.cn-brand-mark .cn-brand-accent {
  color: #5eead4 !important;
  text-shadow: 0 0 18px rgba(45, 212, 191, 0.35);
}

.cn-text-accent {
  color: #99f6e4 !important;
  font-weight: 600;
}

.cn-hero-layout {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(260px, 0.9fr);
  gap: 1.25rem 1.75rem;
  align-items: center;
  max-width: 1100px;
  margin: 0 auto;
  text-align: left;
}

.cn-hero-layout .hero-content {
  max-width: 34rem;
  margin: 0;
  color: #ffffff;
}

/* Desktop ~48–56px; wraps within max-width — no viewport-spanning single line */
.cn-hero-layout .hero-title {
  max-width: 680px;
  font-size: clamp(2.125rem, 1.55rem + 1.85vw, 3.5rem);
  margin-bottom: 0.7rem;
  letter-spacing: -0.03em;
  line-height: 1.08;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
  white-space: normal;
  overflow-wrap: break-word;
  color: #ffffff;
}

.cn-hero-layout .hero-subtitle {
  font-size: clamp(0.98rem, 1.2vw, 1.15rem);
  margin-bottom: 0.5rem;
  font-weight: 400;
  line-height: 1.45;
  opacity: 0.96;
}

.cn-hero-layout .hero-subtitle--secondary {
  font-size: clamp(0.9rem, 1.05vw, 1rem);
  margin-top: 0;
  margin-bottom: 0.4rem;
  opacity: 0.9;
  font-weight: 400;
}

.cn-hero-layout .hero-trust-subtext {
  font-size: 0.85rem;
  opacity: 0.9;
  margin-bottom: 0.9rem;
}

.cn-hero-layout .hero-search-box {
  max-width: 520px;
  margin: 0 0 0.85rem;
}

/* Square / low-radius professional search — not pill */
.cn-hero-layout .hero-search-box .form-control {
  padding: 0.6rem 0.95rem;
  font-size: 0.95rem;
  height: 50px;
  border-radius: 8px 0 0 8px !important;
}

.cn-hero-layout .hero-search-box .btn {
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  font-weight: 650;
  min-width: 104px;
  max-width: 120px;
  height: 50px;
  border-radius: 0 8px 8px 0 !important;
}

.cn-hero-layout .hero-cta-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-start;
  margin-top: 0.1rem;
  align-items: center;
}

.cn-hero-layout .hero-cta {
  padding: 0.55rem 1rem;
  font-size: 0.88rem;
  font-weight: 650;
  min-height: 44px;
  line-height: 1.2;
  border-radius: 10px !important;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14);
}

/* Explore Calculators — larger label, vertically centered in gold CTA */
.cn-hero-layout .hero-cta-group > .hero-cta:not(.hero-cta-secondary) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  line-height: 1.2;
  padding: 0.65rem 1.25rem;
  min-height: 48px;
  box-sizing: border-box;
  border: 2px solid transparent;
}

.cn-hero-layout .hero-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.cn-hero-layout .hero-badges-row {
  justify-content: flex-start;
  margin-top: 0.75rem;
  gap: 0.5rem 0.7rem;
}

.cn-hero-layout .hero-badge {
  font-size: 0.75rem;
  padding: 0.28rem 0.55rem;
  border-radius: 8px;
}

/* Homepage hero padding */
.hero-section:has(.cn-hero-layout) {
  padding: 56px 20px 56px;
  min-height: 0;
}

/* Calculators library compact hero */
.cn-lib-hero {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  padding: 1.5rem 1.5rem;
  margin-bottom: 1.75rem;
  background: linear-gradient(135deg, #2962FF 0%, #1A237E 55%, #0D47A1 100%);
  color: #fff;
  border: 1px solid transparent;
}

.cn-lib-hero__layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(200px, 0.72fr);
  gap: 1.15rem 1.5rem;
  align-items: center;
}

.cn-lib-hero__eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.9;
  margin-bottom: 0.45rem;
}

.cn-lib-hero__title {
  font-size: clamp(1.9rem, 1.05rem + 2.3vw, 3.25rem); /* ~30–52px */
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 0.55rem;
  color: #fff;
}

.cn-lib-hero__lead {
  font-size: 0.98rem;
  line-height: 1.5;
  opacity: 0.94;
  margin: 0 0 1rem;
  max-width: 34rem;
}

.cn-lib-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.cn-lib-hero__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.55rem 1.05rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
  border: none;
}

.cn-lib-hero__btn--primary {
  background: #FF6B00;
  color: #FFFFFF;
}

.cn-lib-hero__btn--primary:hover {
  background: #E85F00;
  color: #FFFFFF;
}

.cn-lib-hero__btn--secondary {
  background: #D4A017;
  color: #1A1A1A;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.cn-lib-hero__btn--secondary:hover {
  background: #EAB308;
  color: #1A1A1A;
}

/* Visual stage — reduced footprint */
.cn-hero-visual {
  position: relative;
  width: 100%;
  max-width: 400px;
  min-height: 265px;
  margin-left: auto;
  pointer-events: none;
  user-select: none;
}

.cn-hero-visual--compact {
  max-width: 300px;
  min-height: 200px;
}

.cn-hero-visual__glow {
  position: absolute;
  inset: 18% 14%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 201, 167, 0.22) 0%, rgba(41, 98, 255, 0.1) 45%, transparent 70%);
  filter: blur(6px);
}

.cn-hero-visual__stage {
  position: relative;
  height: 100%;
  min-height: inherit;
}

.cn-hero-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -48%);
  width: min(100%, 176px);
  padding: 0.65rem 0.7rem 0.75rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.18);
  color: #0f172a;
  z-index: 3;
}

.cn-hero-visual--compact .cn-hero-panel {
  width: min(100%, 156px);
}

.cn-hero-panel__chrome {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0.45rem;
}

.cn-hero-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #cbd5e1;
}

.cn-hero-dot:nth-child(1) { background: #f87171; }
.cn-hero-dot:nth-child(2) { background: #fbbf24; }
.cn-hero-dot:nth-child(3) { background: #34d399; }

.cn-hero-panel__label {
  margin-left: auto;
  font-size: 0.58rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

.cn-hero-panel__display {
  display: grid;
  gap: 0.1rem;
  padding: 0.5rem 0.6rem;
  border-radius: 10px;
  background: linear-gradient(180deg, #f8fafc, #eef2ff);
  border: 1px solid #e2e8f0;
  margin-bottom: 0.55rem;
}

.cn-hero-panel__eyebrow {
  font-size: 0.58rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
}

.cn-hero-panel__value {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #1A237E;
  line-height: 1.1;
}

.cn-hero-panel__unit {
  font-size: 0.62rem;
  color: #94a3b8;
}

.cn-hero-keys {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.28rem;
  margin-bottom: 0.4rem;
}

.cn-hero-keys span {
  height: 14px;
  border-radius: 5px;
  background: #e2e8f0;
}

.cn-hero-keys__accent { background: #ff6b35; }
.cn-hero-keys__mint { background: #00C9A7; }

.cn-hero-spark {
  width: 100%;
  height: 22px;
  color: #2962FF;
  opacity: 0.85;
}

.cn-hero-card {
  position: absolute;
  z-index: 4;
  width: 120px;
  min-width: 120px;
  max-width: 150px;
  padding: 0.42rem 0.55rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.14);
  display: grid;
  gap: 0.05rem;
  box-sizing: border-box;
}

.cn-hero-card__domain {
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}

.cn-hero-card__title {
  font-size: 0.7rem;
  font-weight: 700;
  color: #334155;
}

.cn-hero-card__result {
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.cn-hero-card--finance { border-left: 3px solid #ff6b35; left: 0; top: 8%; transform: rotate(-5deg); }
.cn-hero-card--math { border-left: 3px solid #2962FF; right: 0; top: 4%; transform: rotate(4deg); }
.cn-hero-card--physics { border-left: 3px solid #7c3aed; left: 0; bottom: 10%; transform: rotate(3deg); }
.cn-hero-card--health { border-left: 3px solid #00C9A7; right: 2%; bottom: 16%; transform: rotate(-3deg); }
.cn-hero-card--util { border-left: 3px solid #0ea5e9; left: 36%; bottom: 0; transform: rotate(2deg); }

.cn-hero-visual--compact .cn-hero-card--finance { left: 0; top: 6%; }
.cn-hero-visual--compact .cn-hero-card--math { right: 0; top: 2%; }
.cn-hero-visual--compact .cn-hero-card--physics { left: 6%; bottom: 4%; }
.cn-hero-visual--compact .cn-hero-card--health { right: 0; bottom: 8%; }

@keyframes cn-hero-float-a {
  0%, 100% { transform: rotate(-5deg) translateY(0); }
  50% { transform: rotate(-5deg) translateY(-4px); }
}
@keyframes cn-hero-float-b {
  0%, 100% { transform: rotate(4deg) translateY(0); }
  50% { transform: rotate(4deg) translateY(3px); }
}
@keyframes cn-hero-float-c {
  0%, 100% { transform: rotate(3deg) translateY(0); }
  50% { transform: rotate(3deg) translateY(-3px); }
}
@keyframes cn-hero-float-d {
  0%, 100% { transform: rotate(-3deg) translateY(0); }
  50% { transform: rotate(-3deg) translateY(4px); }
}
@keyframes cn-hero-float-e {
  0%, 100% { transform: rotate(2deg) translateY(0); }
  50% { transform: rotate(2deg) translateY(-2px); }
}

.cn-hero-float-a { animation: cn-hero-float-a 5.5s ease-in-out infinite; }
.cn-hero-float-b { animation: cn-hero-float-b 6.2s ease-in-out infinite 0.3s; }
.cn-hero-float-c { animation: cn-hero-float-c 5.8s ease-in-out infinite 0.6s; }
.cn-hero-float-d { animation: cn-hero-float-d 6.8s ease-in-out infinite 0.2s; }
.cn-hero-float-e { animation: cn-hero-float-e 5.2s ease-in-out infinite 0.5s; }

@media (prefers-reduced-motion: reduce) {
  .cn-hero-float-a,
  .cn-hero-float-b,
  .cn-hero-float-c,
  .cn-hero-float-d,
  .cn-hero-float-e {
    animation: none !important;
  }
}

/* Dark mode cards */
[data-theme="dark"] .cn-hero-panel {
  background: rgba(22, 27, 34, 0.96);
  border-color: rgba(0, 229, 255, 0.35);
  box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.08), 0 14px 30px rgba(0, 0, 0, 0.45);
  color: #e2e8f0;
}

[data-theme="dark"] .cn-hero-panel__display {
  background: linear-gradient(180deg, #0E1117, #161B22);
  border-color: rgba(0, 229, 255, 0.25);
}

[data-theme="dark"] .cn-hero-panel__value { color: #7dd3fc; }
[data-theme="dark"] .cn-hero-panel__eyebrow,
[data-theme="dark"] .cn-hero-panel__label,
[data-theme="dark"] .cn-hero-panel__unit { color: #94a3b8; }
[data-theme="dark"] .cn-hero-keys span { background: #334155; }
[data-theme="dark"] .cn-hero-spark { color: #22d3ee; }

[data-theme="dark"] .cn-hero-card {
  background: rgba(22, 27, 34, 0.95);
  border-color: rgba(0, 229, 255, 0.28);
  box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.06), 0 10px 22px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .cn-hero-card__domain { color: #94a3b8; }
[data-theme="dark"] .cn-hero-card__title { color: #cbd5e1; }
[data-theme="dark"] .cn-hero-card__result { color: #f8fafc; }

[data-theme="dark"] .cn-lib-hero {
  background: linear-gradient(135deg, #0A1628 0%, #1A237E 50%, #0D3B66 100%);
  border-color: rgba(0, 229, 255, 0.35);
  box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.08), 0 12px 28px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .hero-section {
  background: linear-gradient(135deg, #0A1628 0%, #1A237E 48%, #0D3B66 100%) !important;
}

[data-theme="dark"] .cn-brand-accent {
  color: #67e8f9 !important;
  text-shadow: 0 0 16px rgba(34, 211, 238, 0.35);
}

[data-theme="dark"] .cn-text-accent {
  color: #99f6e4 !important;
}

/* Tablet / mid */
@media (max-width: 1199.98px) {
  .cn-hero-layout .hero-title {
    font-size: clamp(2.35rem, 1.2rem + 1.6vw, 3rem); /* ~40–48px */
  }

  .cn-hero-layout .hero-search-box {
    max-width: 480px;
  }

  .cn-hero-layout .hero-search-box .form-control,
  .cn-hero-layout .hero-search-box .btn {
    height: 48px;
  }
}

@media (max-width: 1024px) {
  .cn-hero-layout {
    grid-template-columns: minmax(0, 1.1fr) minmax(200px, 0.72fr);
    gap: 1rem 1.15rem;
  }

  .cn-hero-layout .hero-search-box {
    max-width: 440px;
  }

  .cn-hero-visual {
    max-width: 280px;
    min-height: 210px;
  }

  .cn-hero-card {
    width: 105px;
    min-width: 105px;
    max-width: 120px;
  }

  .cn-hero-card--util {
    display: none;
  }
}

@media (max-width: 900px) {
  .cn-hero-layout,
  .cn-lib-hero__layout {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .cn-hero-layout .hero-content {
    max-width: 36rem;
    margin: 0 auto;
  }

  .cn-hero-layout .hero-search-box {
    max-width: min(480px, calc(100% - 1.5rem));
    margin-left: auto;
    margin-right: auto;
  }

  .cn-hero-layout .hero-cta-group {
    justify-content: flex-start;
  }

  .cn-hero-layout .hero-badges-row,
  .cn-lib-hero__actions {
    justify-content: center;
  }

  .cn-lib-hero__lead {
    margin-left: auto;
    margin-right: auto;
  }

  .cn-hero-visual,
  .cn-hero-visual--compact {
    margin: 0.25rem auto 0;
    max-width: 260px;
    min-height: 190px;
  }

  .cn-hero-card--health {
    display: none;
  }
}

/* Mobile stacked: heading → copy → search → CTA → badges → visual */
@media (max-width: 768px) {
  .hero-section:has(.cn-hero-layout) {
    padding: 36px 14px 28px;
  }

  .cn-hero-layout {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
  }

  .cn-hero-layout .hero-title {
    font-size: clamp(2.125rem, 5.2vw, 2.45rem); /* ~34–39px */
    margin-bottom: 0.45rem;
    max-width: 100%;
  }

  .cn-hero-layout .hero-subtitle {
    margin-bottom: 0.35rem;
    font-size: 0.98rem;
  }

  .cn-hero-layout .hero-subtitle--secondary {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
  }

  .cn-hero-layout .hero-trust-subtext {
    margin-bottom: 0.65rem;
    font-size: 0.82rem;
  }

  .cn-hero-layout .hero-search-box {
    width: calc(100% - 8px);
    max-width: 420px;
    margin: 0 auto 0.55rem;
  }

  .cn-hero-layout .hero-search-box .form-control,
  .cn-hero-layout .hero-search-box .btn {
    height: 46px;
    font-size: 0.88rem;
  }

  .cn-hero-layout .hero-search-box .btn {
    min-width: 92px;
    max-width: 108px;
    padding: 0.45rem 0.75rem;
  }

  .cn-hero-layout .hero-cta-group {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0.45rem;
    width: calc(100% - 8px);
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
  }

  .cn-hero-layout .hero-cta {
    min-width: 0;
    flex: 0 1 auto;
    padding: 0.45rem 0.85rem;
    min-height: 44px;
    font-size: 0.84rem;
    text-align: center;
  }

  .cn-hero-layout .hero-cta-group > .hero-cta:not(.hero-cta-secondary) {
    font-size: 1.05rem;
    line-height: 1.2;
    padding: 0.6rem 1.1rem;
    min-height: 48px;
  }

  .cn-hero-layout .hero-badges-row {
    margin-top: 0.35rem;
    margin-bottom: 0.35rem;
    justify-content: center;
  }

  .cn-hero-visual {
    order: 7;
    max-width: 230px;
    min-height: 165px;
    margin-top: 0.65rem;
  }

  .cn-hero-card {
    width: 88px;
    min-width: 88px;
    max-width: 100px;
    padding: 0.32rem 0.4rem;
  }

  .cn-hero-card--physics,
  .cn-hero-card--util,
  .cn-hero-card--health {
    display: none;
  }

  .cn-lib-hero {
    padding: 1.1rem 0.9rem;
    margin-bottom: 1.15rem;
  }

  .cn-lib-hero__title {
    font-size: clamp(1.7rem, 5vw, 2rem);
  }

  .cn-lib-hero__layout {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  /* Tablet/mobile: space between CTA actions and floating calculator visual */
  .cn-lib-hero__actions {
    margin-bottom: 0.75rem;
  }

  .cn-lib-hero .cn-hero-visual {
    order: 3;
    max-width: 210px;
    min-height: 155px;
    margin: 2.5rem auto 0;
  }

  .cn-lib-hero__btn {
    min-height: 42px;
    padding: 0.45rem 0.9rem;
    font-size: 0.85rem;
  }
}

@media (max-width: 576px) {
  .cn-hero-layout .hero-cta-group {
    flex-direction: column;
    align-items: flex-start;
    max-width: 280px;
  }

  .cn-hero-layout .hero-cta {
    width: 100%;
    max-width: 280px;
  }
}

@media (max-width: 375px) {
  .cn-hero-layout .hero-title {
    font-size: clamp(1.9rem, 7.2vw, 2.2rem); /* ~30–35px */
  }

  .cn-hero-layout .hero-search-box {
    width: calc(100% - 16px);
  }

  .cn-hero-visual {
    max-width: 200px;
    min-height: 150px;
  }

  .cn-hero-card {
    width: 78px;
    min-width: 78px;
    max-width: 90px;
  }

  .cn-hero-panel {
    width: min(100%, 140px);
  }
}

@media (max-width: 320px) {
  .hero-section:has(.cn-hero-layout) {
    padding: 28px 12px 22px;
  }

  .cn-hero-layout .hero-title {
    font-size: 1.9rem;
  }

  .cn-hero-visual {
    max-width: 180px;
    min-height: 140px;
  }

  .cn-hero-card--math {
    display: none;
  }

  .cn-hero-panel {
    width: min(100%, 132px);
  }
}
