/* ============================================
   USAMA WAGIH PORTFOLIO
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Apple HIG palette */
  --color-bg: #ffffff;
  --color-surface: #f5f5f7;
  --color-text: #1d1d1f;
  --color-text-secondary: #6e6e73;
  --color-accent: #1d1d1f;
  --color-border: #d2d2d7;
  --color-placeholder: #e8e8ed;
  --color-tag-bg: #f5f5f7;
  /* Google Sans primary, SF Pro / system fallbacks */
  --font-heading: 'Google Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', Arial, sans-serif;
  --font-body: 'Google Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
  --max-width: 1200px;
  --max-width-narrow: 800px;
  --section-padding: 128px;
  /* Apple's signature ease used for sheets, buttons, animations */
  --ease-apple: cubic-bezier(0.16, 1, 0.3, 1);
  --transition: 0.35s var(--ease-apple);
}

/* --- Dark theme Apple dark mode palette --- */
[data-theme="dark"] {
  --color-bg: #000000;
  --color-surface: #1d1d1f;
  --color-text: #f5f5f7;
  --color-text-secondary: #86868b;
  --color-accent: #f5f5f7;
  --color-border: #424245;
  --color-placeholder: #2a2a2c;
  --color-tag-bg: #1d1d1f;
}

[data-theme="dark"] .nav {
  background: rgba(0, 0, 0, 0.55);
}
[data-theme="dark"] .nav--scrolled {
  background: rgba(0, 0, 0, 0.65);
}

[data-theme="dark"] .highlight {
  border-left-color: #f0f0f0;
  background: #161616;
}

[data-theme="dark"] .flow-branch__item--yes {
  border-color: #1e3a1e;
  background: #111d11;
  color: #a8d5a8;
}

[data-theme="dark"] .diagram-node--center .diagram-node__tag {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(240, 240, 240, 0.75);
}

[data-theme="dark"] .screenshot-guide__header {
  background: #1a1a1a;
}

[data-theme="dark"] .screenshot-guide__preview-label {
  background: #222;
}

[data-theme="dark"] .screenshot-guide__preview-code {
  background: #0a0a0a;
}

[data-theme="dark"] .screenshot-guide__num {
  background: #f0f0f0;
  color: #0f0f0f;
}

/* Theme transition smooth color changes */
html {
  transition: background-color 0.4s var(--ease-apple), color 0.4s var(--ease-apple);
}

*, *::before, *::after {
  transition-property: background-color, border-color, color;
  transition-duration: 0.35s;
  transition-timing-function: var(--ease-apple);
}

/* Re-override so existing transitions aren't affected */
.card, .nav, .nav__links a, .card__link, .contact-links a,
.cs-hero__back, .footer__links a {
  transition: all 0.4s var(--ease-apple);
}

/* Respect users who prefer reduced 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;
  }
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.47;
  font-size: 17px;
  letter-spacing: -0.01em;
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* --- Typography (Apple HIG) --- */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.07;
  letter-spacing: -0.025em;
  color: var(--color-text);
}

h1 {
  font-size: clamp(3rem, 6.5vw, 5.5rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
}
h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
}
h3 {
  font-size: clamp(1.4rem, 2.5vw, 1.75rem);
  letter-spacing: -0.022em;
  line-height: 1.15;
}
h4 {
  font-size: 1.15rem;
  letter-spacing: -0.018em;
  line-height: 1.25;
}

p {
  font-size: 1.0625rem;
  color: var(--color-text-secondary);
  max-width: 680px;
  line-height: 1.5;
  letter-spacing: -0.011em;
}

/* --- Layout --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 40px;
}

.container--narrow {
  max-width: var(--max-width-narrow);
}

section {
  padding: var(--section-padding) 0;
}

/* --- Navigation (Apple-style frosted bar) --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 18px 0;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: saturate(200%) blur(36px);
  -webkit-backdrop-filter: saturate(200%) blur(36px);
  transition: background 0.4s var(--ease-apple), padding 0.4s var(--ease-apple);
}

.nav--scrolled {
  background: rgba(255, 255, 255, 0.65);
  padding: 14px 0;
}

.nav__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav__logo {
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
}

.nav__links {
  display: flex;
  gap: 32px;
  list-style: none;
  margin-left: auto;
  margin-right: 24px;
}

.nav__links a {
  position: relative;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  transition: color var(--transition);
}

.nav__links a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav__links a:hover {
  color: var(--color-text);
}

.nav__links a:hover::after {
  transform: scaleX(1);
}

.nav__toggle {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 100px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: border-color 0.3s ease, color 0.3s ease, background 0.3s ease;
  flex-shrink: 0;
}

.nav__toggle:hover {
  border-color: var(--color-text);
  color: var(--color-text);
}

.nav__toggle:active {
  transform: scale(0.94);
}

.nav__toggle svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav__toggle:hover svg {
  transform: rotate(-18deg);
}

/* Show/hide icon based on current theme */
.icon-sun { display: none; }
.icon-moon { display: block; }

[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* Hamburger button hidden on desktop, shown on mobile */
.nav__menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 100px;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: 12px;
  flex-shrink: 0;
  transition: border-color 0.3s ease;
}
.nav__menu-btn:hover { border-color: var(--color-text); }
.nav__menu-btn:active { transform: scale(0.94); }
.nav__menu-btn__bars {
  position: relative;
  width: 16px;
  height: 12px;
}
.nav__menu-btn__bars span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 1.5px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform 0.35s var(--ease-apple), opacity 0.25s var(--ease-apple), top 0.35s var(--ease-apple);
}
.nav__menu-btn__bars span:nth-child(1) { top: 1px; }
.nav__menu-btn__bars span:nth-child(2) { top: 5.25px; }
.nav__menu-btn__bars span:nth-child(3) { top: 9.5px; }
.nav__menu-btn.is-open .nav__menu-btn__bars span:nth-child(1) {
  top: 5.25px;
  transform: rotate(45deg);
}
.nav__menu-btn.is-open .nav__menu-btn__bars span:nth-child(2) { opacity: 0; }
.nav__menu-btn.is-open .nav__menu-btn__bars span:nth-child(3) {
  top: 5.25px;
  transform: rotate(-45deg);
}

/* --- Hero (Homepage) --- */
.hero {
  padding-top: 180px;
  padding-bottom: var(--section-padding);
  min-height: 80vh;
  display: flex;
  align-items: center;
}

.hero__content {
  max-width: 960px;
}

.hero__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -0.011em;
  color: var(--color-text);
  margin-bottom: 24px;
}
.hero__wave {
  display: inline-block;
  font-size: 1.05rem;
  transform-origin: 70% 70%;
  animation: heroWave 2.6s var(--ease-apple) 0.6s 2;
}
@keyframes heroWave {
  0% { transform: rotate(0deg); }
  10% { transform: rotate(14deg); }
  20% { transform: rotate(-8deg); }
  30% { transform: rotate(14deg); }
  40% { transform: rotate(-4deg); }
  50% { transform: rotate(10deg); }
  60% { transform: rotate(0deg); }
  100% { transform: rotate(0deg); }
}
@media (prefers-reduced-motion: reduce) {
  .hero__wave { animation: none; }
}

.hero__title {
  margin-bottom: 24px;
  max-width: 820px;
  font-size: clamp(2.5rem, 5vw, 4.25rem);
}
.hero__title em {
  font-style: italic;
  font-weight: 500;
  color: var(--color-text);
}
.hero__underline {
  position: relative;
  display: inline-block;
  white-space: nowrap;
}
.hero__underline::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.06em;
  height: 0.08em;
  background: currentColor;
  opacity: 0.9;
}
.hero__description em {
  font-style: italic;
  color: var(--color-text);
}


.hero__description {
  font-size: 1.2rem;
  line-height: 1.8;
  margin-bottom: 40px;
  max-width: 720px;
}

.hero__meta {
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
}

.hero__meta-item {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.hero__meta-item strong {
  display: block;
  font-size: 0.95rem;
  color: var(--color-text);
  margin-bottom: 2px;
}

/* --- Hero "Previously at" line --- */
.hero__previously {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  letter-spacing: -0.011em;
  margin-top: -8px;
  margin-bottom: 32px;
}
.hero__previously span {
  color: var(--color-text);
  font-weight: 600;
  margin-right: 4px;
}

/* --- Hero CTA buttons --- */
.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}
.hero__cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 980px;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: -0.011em;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  background: transparent;
  transition: transform 0.3s var(--ease-apple), background 0.3s var(--ease-apple), border-color 0.3s var(--ease-apple), color 0.3s var(--ease-apple), opacity 0.3s var(--ease-apple);
}
.hero__cta-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.hero__cta-btn svg[fill="currentColor"] {
  fill: currentColor;
  stroke: none;
}
.hero__cta-btn:hover {
  border-color: var(--color-text);
  transform: scale(1.02);
}
.hero__cta-btn:active {
  transform: scale(0.97);
}
.hero__cta-btn--primary {
  background: var(--color-text);
  color: var(--color-bg);
  border-color: var(--color-text);
}
.hero__cta-btn--primary:hover {
  opacity: 0.88;
  border-color: var(--color-text);
}

/* --- Case Study Cards --- */
.work {
  background: transparent;
}

.work__header {
  margin-bottom: 60px;
}

.work__subtitle {
  margin-top: 12px;
  font-size: 1.15rem;
  color: var(--color-text-secondary);
  max-width: 640px;
}

/* Pinterest-style 2-column masonry (grid keeps cards 1 & 2 on top row) */
.work__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 96px;
  row-gap: 64px;
  align-items: start;
}

.card {
  display: block;
  background: transparent;
  transition: opacity 0.4s var(--ease-apple);
}

.card:nth-child(1) .card__image { aspect-ratio: 4 / 5; }
.card:nth-child(2) .card__image { aspect-ratio: 3 / 2; }
.card:nth-child(3) .card__image { aspect-ratio: 1 / 1; }
.card:nth-child(4) .card__image { aspect-ratio: 3 / 2; }
.card:nth-child(5) .card__image { aspect-ratio: 4 / 5; }

@media (max-width: 1024px) {
  .work__grid { column-gap: 48px; row-gap: 48px; }
}

@media (max-width: 600px) {
  .work__grid { grid-template-columns: 1fr; column-gap: 0; row-gap: 48px; }
  .card:nth-child(n) .card__image { aspect-ratio: 4 / 3; }
}

.card__image {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--color-placeholder);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  overflow: hidden;
  margin-bottom: 24px;
  transition: transform 0.6s var(--ease-apple), box-shadow 0.6s var(--ease-apple);
}

.card__image > img,
.card__image > video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.1s cubic-bezier(0.22, 1, 0.36, 1),
              filter 0.6s var(--ease-apple);
  will-change: transform;
}

.card__image > .card__image-logo {
  width: clamp(120px, 40%, 220px);
  height: auto;
  object-fit: contain;
}

.card:hover .card__image {
  transform: translateY(-4px);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.18),
              0 8px 20px -10px rgba(0, 0, 0, 0.12);
}

.card:hover .card__image > img:not(.card__image-logo),
.card:hover .card__image > video {
  transform: scale(1.04);
  filter: saturate(1.05);
}

[data-theme="dark"] .card:hover .card__image {
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.6),
              0 8px 20px -10px rgba(0, 0, 0, 0.5);
}

@media (prefers-reduced-motion: reduce) {
  .card__image, .card__image img, .card__image::after {
    transition: none;
  }
  .card:hover .card__image,
  .card:hover .card__image img {
    transform: none;
  }
}

.card__body {
  padding: 0;
  max-width: 720px;
}

.card__tags {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tag {
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0;
  background: transparent;
  color: var(--color-text-secondary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.tag + .tag::before {
  content: '·';
  margin-right: 10px;
  color: var(--color-text-secondary);
}

.card__title {
  margin-bottom: 10px;
  transition: color var(--transition);
}

.card:hover .card__title {
  color: var(--color-accent, var(--color-text));
}

.card__description {
  font-size: 1rem;
  margin-bottom: 16px;
  color: var(--color-text-secondary);
}

.card__link {
  position: relative;
  font-size: 0.9rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: gap var(--transition), color var(--transition);
}

.card__link::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.card:hover .card__link {
  gap: 12px;
  color: var(--color-text);
}

.card:hover .card__link::after {
  transform: scaleX(1);
}

.card--coming-soon {
  pointer-events: none;
  opacity: 0.5;
}

.card--coming-soon .card__image::after {
  content: 'Coming Soon';
  inset: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  opacity: 1;
  transform: none;
}

/* --- Case Study Hero --- */
.cs-hero {
  padding-top: 160px;
  padding-bottom: 32px;
}

.cs-hero__back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-bottom: 48px;
  transition: color var(--transition), gap var(--transition);
}

.cs-hero__back:hover {
  color: var(--color-text);
  gap: 12px;
}

.cs-hero__tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.cs-hero__title {
  margin-bottom: 16px;
  font-size: clamp(2rem, 4vw, 3.25rem);
}

.cs-hero__subtitle {
  font-size: 1.3rem;
  color: var(--color-text-secondary);
  max-width: 640px;
  line-height: 1.6;
}

.cs-hero__company {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}

.cs-hero__company-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.cs-hero__company-sep {
  width: 1px;
  height: 16px;
  background: var(--color-border);
  display: inline-block;
}

.cs-hero__company-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.cs-hero__company-link:hover {
  opacity: 0.7;
}

.cs-hero__company-arrow {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease;
}

.cs-hero__company-link:hover .cs-hero__company-arrow {
  transform: translate(2px, -2px);
}

.cs-hero__company-desc {
  margin-top: 8px;
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
  max-width: none;
}

.cs-hero__company-platforms {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.cs-hero__platform {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 5px 11px 5px 9px;
  border-radius: 100px;
  background: var(--color-tag-bg);
  color: var(--color-text);
  letter-spacing: 0.01em;
}

.cs-hero__platform svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.cs-hero__platform svg.icon-stroke {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cs-hero__platform svg.icon-fill {
  fill: currentColor;
}

.cs-hero__company-markets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.cs-hero__market {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 100px;
  background: var(--color-tag-bg);
  color: var(--color-text-secondary);
  letter-spacing: 0.01em;
}

/* --- Case Study Overview --- */
.cs-overview {
  padding: 80px 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

/* Overview inside the hero compact, no borders, tighter spacing */
.cs-hero .cs-overview {
  padding: 0;
  border: 0;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--color-border);
}

.cs-overview__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 40px;
}

.cs-overview__item {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.cs-overview__item strong {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text);
  margin-bottom: 8px;
}

/* --- Case Study Content --- */
.cs-section {
  padding: 100px 0;
}

.cs-section__label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-secondary);
  margin-bottom: 16px;
}

.cs-section__title {
  margin-bottom: 24px;
}

.cs-section__text {
  margin-bottom: 24px;
}

.cs-section__text:last-of-type {
  margin-bottom: 0;
}

.cs-section + .cs-section {
  border-top: 1px solid var(--color-border);
}

/* --- Image Placeholder --- */
.cs-hero__image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
}

.cs-hero__media {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
}

/* Lifestyle photo mockup real hand-held iPhone with overlaid app screen */
.lifestyle-mockup {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: 12px;
  background: #1a1410;
}

.lifestyle-mockup__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lifestyle-mockup__screen {
  position: absolute;
  top: 31%;
  left: 39%;
  width: 23.3%;
  height: 48%;
  object-fit: cover;
  object-position: top center;
  transform: rotate(2deg);
  transform-origin: center center;
  border-radius: 6% / 3%;
  z-index: 2;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
}

.card__image .lifestyle-mockup {
  border-radius: 0;
  aspect-ratio: auto;
  height: 100%;
}

/* Floward lifestyle backdrop warm ambient light + soft vignette */
.cs-hero__media--floward,
.card__image--floward {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 0;
  aspect-ratio: auto;
  background:
    radial-gradient(120% 80% at 70% 20%, #fbf3e4 0%, #eee2cc 45%, #d9c7a8 100%),
    #e8dcc3;
  overflow: hidden;
  isolation: isolate;
}

.cs-hero__media--floward { aspect-ratio: 16 / 10; }

/* Soft side light + floor glow */
.cs-hero__media--floward::before,
.card__image--floward::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 40% at 50% 100%, rgba(170, 130, 80, 0.28) 0%, transparent 70%),
    radial-gradient(80% 60% at 10% 10%, rgba(255, 245, 220, 0.6) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* iPhone 17 mockup */
.iphone-mockup {
  --radius: 42px;
  position: relative;
  width: 260px;
  aspect-ratio: 9 / 19.5;
  background: #0b0b0d;
  border-radius: var(--radius);
  padding: 10px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.08) inset,
    0 0 0 1px rgba(0,0,0,0.3),
    0 24px 60px -20px rgba(0,0,0,0.35),
    0 10px 24px -10px rgba(0,0,0,0.2);
}

.iphone-mockup__screen {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: calc(var(--radius) - 10px);
  overflow: hidden;
  background: #fff;
}

.iphone-mockup__screen img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.iphone-mockup__island {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: 88px;
  height: 24px;
  background: #0b0b0d;
  border-radius: 999px;
  z-index: 2;
}

.cs-hero__media--floward .iphone-mockup,
.card__image--floward .iphone-mockup {
  position: relative;
  z-index: 1;
  transform: perspective(1400px) rotateY(-8deg) rotateX(2deg) rotate(-3deg);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.08) inset,
    0 0 0 1px rgba(0,0,0,0.3),
    -30px 50px 80px -30px rgba(60, 40, 10, 0.4),
    0 40px 60px -20px rgba(80, 55, 20, 0.35),
    0 20px 40px -15px rgba(0, 0, 0, 0.25);
}

/* Floor contact shadow beneath phone */
.cs-hero__media--floward .iphone-mockup::after,
.card__image--floward .iphone-mockup::after {
  content: '';
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: -28px;
  height: 40px;
  background: radial-gradient(50% 50% at 50% 50%, rgba(40, 25, 5, 0.35) 0%, transparent 70%);
  filter: blur(6px);
  z-index: -1;
}

.cs-hero__media--floward .iphone-mockup {
  width: min(32%, 320px);
}

.iphone-mockup--tile {
  width: min(58%, 260px);
}

@media (max-width: 768px) {
  .cs-hero__media--floward .iphone-mockup { width: min(55%, 240px); }
  .iphone-mockup--tile { width: min(65%, 220px); }
  .cs-hero__media--floward { padding: 32px 0; }
}

.cs-hero__media .cs-hero__image {
  border-radius: 0;
}

.cs-hero__media-logo,
.card__image-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  height: auto;
  filter: brightness(0) invert(1);
  pointer-events: none;
  z-index: 2;
}

.cs-hero__media-logo {
  width: clamp(220px, 32%, 380px);
}

.card__image-logo {
  width: clamp(120px, 40%, 220px);
}

@media (max-width: 768px) {
  .cs-hero__media-logo {
    width: clamp(160px, 50%, 240px);
  }
  .card__image-logo {
    width: clamp(120px, 50%, 200px);
  }
}

.image-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--color-placeholder);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 48px 0;
  position: relative;
}

.image-placeholder__label {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  text-align: center;
  padding: 20px;
}

.image-placeholder--full {
  border-radius: 0;
  margin-left: calc(-50vw + 50%);
  margin-right: calc(-50vw + 50%);
  width: 100vw;
  max-width: 100vw;
}

/* --- Comparison Table --- */
.comparison-table {
  width: 100%;
  margin: 40px 0;
  border-collapse: collapse;
}

.comparison-table th,
.comparison-table td {
  text-align: left;
  padding: 16px 20px;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--color-border);
}

.comparison-table th {
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
}

.comparison-table td:first-child {
  color: var(--color-text-secondary);
}

.comparison-table td:last-child {
  font-weight: 500;
  color: var(--color-text);
}

/* --- Highlight Quote --- */
.highlight {
  padding: 48px;
  background: var(--color-surface);
  border-left: 3px solid var(--color-text);
  border-radius: 0 12px 12px 0;
  margin: 48px 0;
}

.highlight p {
  font-size: 1.2rem;
  font-style: italic;
  color: var(--color-text);
  max-width: 100%;
  line-height: 1.8;
}

/* --- Process List --- */
.process-list {
  list-style: none;
  margin: 32px 0;
}

.process-list li {
  position: relative;
  padding: 16px 0 16px 32px;
  font-size: 1rem;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
}

.process-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 24px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-text);
}

/* --- Outcome Grid --- */
.outcome-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 32px;
  margin-top: 40px;
}

.outcome-card {
  padding: 32px;
  background: var(--color-surface);
  border-radius: 12px;
  border: 1px solid var(--color-border);
}

.outcome-card__metric {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.outcome-card__label {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

/* --- Ordered Steps --- */
.steps {
  margin: 40px 0;
  counter-reset: step;
}

.step {
  display: flex;
  gap: 24px;
  padding: 24px 0;
  border-bottom: 1px solid var(--color-border);
}

.step::before {
  counter-increment: step;
  content: counter(step);
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-text);
  color: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
}

.step__content p {
  font-size: 0.95rem;
}

/* --- Footer --- */
.footer {
  padding: 60px 0;
  border-top: 1px solid var(--color-border);
}

.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.footer__text {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.footer__links {
  display: flex;
  gap: 24px;
  list-style: none;
}

.footer__links a {
  position: relative;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  transition: color var(--transition);
}

.footer__links a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.footer__links a:hover {
  color: var(--color-text);
}

.footer__links a:hover::after {
  transform: scaleX(1);
}

/* --- Diagram: Framework (3-column) --- */
.diagram-framework {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 0;
  margin: 48px 0;
  padding: 56px 48px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
}

.diagram-framework__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  color: var(--color-border);
  font-size: 1.5rem;
}

.diagram-node {
  padding: 24px;
  text-align: center;
}

.diagram-node__label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-secondary);
  margin-bottom: 10px;
}

.diagram-node__title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.diagram-node--center .diagram-node__title {
  font-size: 1.4rem;
}

.diagram-node__tags {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.diagram-node__tag {
  font-size: 0.8rem;
  padding: 4px 14px;
  border-radius: 100px;
  background: var(--color-tag-bg);
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.diagram-node--center {
  background: var(--color-text);
  border-radius: 12px;
  padding: 28px 32px;
}

.diagram-node--center .diagram-node__label,
.diagram-node--center .diagram-node__title {
  color: var(--color-bg);
}

.diagram-node--center .diagram-node__tag {
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.85);
}

@media (max-width: 768px) {
  .diagram-framework {
    grid-template-columns: 1fr;
    padding: 32px 24px;
    gap: 8px;
  }
  .diagram-framework__arrow {
    transform: rotate(90deg);
    padding: 8px 0;
  }
  .diagram-node--center {
    order: 2;
  }
}

/* --- Diagram: Fallback Flow --- */
.diagram-flow {
  margin: 48px 0;
  padding: 48px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
}

.flow-step {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  position: relative;
}

.flow-step + .flow-step {
  margin-top: 0;
}

.flow-step__line {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 36px;
}

.flow-step__dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 1;
}

.flow-step__dot svg {
  width: 16px;
  height: 16px;
  stroke: var(--color-bg);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.flow-step__dot--muted {
  background: var(--color-placeholder);
}

.flow-step__dot--muted svg {
  stroke: var(--color-text-secondary);
}

.flow-step__connector {
  width: 2px;
  flex: 1;
  min-height: 32px;
  background: var(--color-border);
  margin: 4px 0;
}

.flow-step__connector--dashed {
  background: repeating-linear-gradient(
    to bottom,
    var(--color-border) 0px,
    var(--color-border) 6px,
    transparent 6px,
    transparent 12px
  );
}

.flow-step__content {
  padding-top: 6px;
  padding-bottom: 32px;
  flex: 1;
}

.flow-step__content:last-of-type {
  padding-bottom: 0;
}

.flow-step__title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--color-text);
}

.flow-step__desc {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
  max-width: 100%;
}

.flow-branch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 16px 0 0;
}

.flow-branch__item {
  padding: 16px 20px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  font-size: 0.85rem;
}

.flow-branch__item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
}

.flow-branch__item--yes {
  border-color: #c8e6c9;
  background: #f1f8f1;
}

.flow-branch__item--no {
  border-color: var(--color-border);
  background: var(--color-bg);
}

@media (max-width: 640px) {
  .diagram-flow {
    padding: 32px 20px;
  }
  .flow-branch {
    grid-template-columns: 1fr;
  }
}

/* --- Real screenshot image classes --- */
.cs-image {
  width: 100%;
  border-radius: 12px;
  display: block;
  margin: 48px 0;
}

.cs-image-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 48px 0;
}

.cs-image-pair img {
  width: 100%;
  border-radius: 12px;
  display: block;
}

.cs-image-screens {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin: 48px 0;
  flex-wrap: wrap;
}

.cs-image-screens img {
  width: calc(33.333% - 12px);
  min-width: 180px;
  border-radius: 20px;
  display: block;
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
}

@media (max-width: 640px) {
  .cs-image-pair {
    grid-template-columns: 1fr;
  }
  .cs-image-screens img {
    width: calc(50% - 8px);
  }
}

/* --- Screenshot replacement guide --- */
.screenshot-guide {
  margin: 48px 0;
  border: 1.5px dashed #c0c0c0;
  border-radius: 12px;
  overflow: hidden;
}

.screenshot-guide__header {
  background: #f5f5f5;
  padding: 12px 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
}

.screenshot-guide__body {
  padding: 24px;
}

.screenshot-guide__step {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}

.screenshot-guide__step:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.screenshot-guide__num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-text);
  color: var(--color-bg);
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.screenshot-guide__text {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
  max-width: 100%;
}

.screenshot-guide__text code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.8rem;
  background: #f0f0f0;
  padding: 2px 7px;
  border-radius: 4px;
  color: var(--color-text);
}

.screenshot-guide__preview {
  margin-top: 16px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.screenshot-guide__preview-label {
  background: #1a1a1a;
  padding: 8px 16px;
  font-size: 0.7rem;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  color: #9ca3af;
  letter-spacing: 0.02em;
}

.screenshot-guide__preview-code {
  background: #111;
  padding: 16px;
  font-size: 0.8rem;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  color: #e5e7eb;
  line-height: 1.8;
  overflow-x: auto;
  white-space: pre;
}

.code-keyword { color: #c792ea; }
.code-attr { color: #80cbc4; }
.code-string { color: #c3e88d; }
.code-comment { color: #546e7a; font-style: italic; }

/* --- Two Column Option Cards --- */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin: 48px 0;
}

.option-card {
  padding: 40px 32px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.option-card--highlight {
  background: var(--color-text);
  border-color: var(--color-text);
  color: var(--color-bg);
}

.option-card__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
  opacity: 0.6;
}

.option-card__title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.option-card--highlight .option-card__title {
  color: var(--color-bg);
}

.option-card__text {
  font-size: 0.9rem;
  line-height: 1.7;
  max-width: 100%;
}

.option-card--highlight .option-card__text {
  color: rgba(250, 250, 250, 0.7);
}

@media (max-width: 640px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}

/* --- Case Study Sidebar TOC --- */
.cs-toc {
  position: fixed;
  left: 32px;
  top: 100px;
  width: 220px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.07), 0 0 0 1px rgba(0,0,0,0.04);
  z-index: 50;
  /* Only on very wide screens so it never overlaps content */
  display: none;
}

[data-theme="dark"] .cs-toc {
  background: rgba(18,18,18,0.88);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.06);
}

@media (min-width: 1500px) {
  .cs-toc { display: block; }
}

/* --- Notion-style TOC --- */
.cs-toc__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-secondary);
  margin-bottom: 10px;
  padding-left: 14px;
}

.cs-toc__nav {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-left: 1px solid var(--color-border);
}

.cs-toc__link {
  display: block;
  padding: 6px 12px 6px 14px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  font-size: 13px;
  font-weight: 400;
  color: var(--color-text-secondary);
  text-decoration: none;
  line-height: 1.5;
  transition: color 0.15s, border-color 0.15s;
  background: transparent;
}

.cs-toc__link:hover {
  color: var(--color-text);
  background: transparent;
}

.cs-toc__link.toc-active {
  color: var(--color-text);
  font-weight: 500;
  border-left-color: var(--color-text);
  background: transparent;
}

/* Dots no longer used in Notion style */
.cs-toc__dot {
  display: none;
}

.cs-toc__children {
  margin: 0;
  padding-left: 0;
  border-left: none;
  display: flex;
  flex-direction: column;
}

.cs-toc__child {
  display: block;
  padding: 5px 12px 5px 28px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--color-text-secondary);
  text-decoration: none;
  line-height: 1.5;
  transition: color 0.15s, border-color 0.15s;
  background: transparent;
}

.cs-toc__child:hover {
  color: var(--color-text);
  background: transparent;
}

.cs-toc__child.toc-active,
.cs-toc__child.toc-active:hover {
  color: var(--color-text);
  font-weight: 500;
  border-left-color: var(--color-text);
  background: transparent;
}

.cs-toc__link.toc-active:hover {
  color: var(--color-text);
  border-left-color: var(--color-text);
}

/* --- TOC Mobile FAB (< 1500px) --- */
.cs-toc-fab {
  position: fixed;
  left: 32px;
  top: 100px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px 9px 11px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 100px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

[data-theme="dark"] .cs-toc-fab {
  background: rgba(18,18,18,0.88);
  box-shadow: 0 4px 16px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.06);
}

.cs-toc-fab:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.cs-toc-fab svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

/* Show FAB only on smaller screens */
@media (min-width: 1500px) {
  .cs-toc-fab { display: none; }
}

/* Icon swap */
.cs-toc-fab .fab-icon-close { display: none; }
.cs-toc-fab .fab-icon-open { display: block; }
.cs-toc-fab.is-open .fab-icon-open { display: none; }
.cs-toc-fab.is-open .fab-icon-close { display: block; }

/* --- TOC Scrim overlay --- */
.cs-toc-overlay {
  position: fixed;
  inset: 0;
  z-index: 48;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

[data-theme="dark"] .cs-toc-overlay {
  background: rgba(0, 0, 0, 0.55);
}

.cs-toc-overlay.is-open {
  opacity: 1;
  pointer-events: all;
}

@media (min-width: 1500px) {
  .cs-toc-overlay { display: none; }
}

/* --- TOC Dropdown panel (mobile) --- Notion-style: no card, just a panel with the vertical guide line */
.cs-toc-dropdown {
  position: fixed;
  left: 24px;
  top: 100px;
  width: 240px;
  z-index: 49;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 14px 12px 14px 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.06);
  transform-origin: top left;
  transform: scale(0.96) translateY(-4px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s cubic-bezier(0.16,1,0.3,1), opacity 0.18s ease;
  /* Always hidden on very wide screens the persistent sidebar takes over */
  display: none;
}

[data-theme="dark"] .cs-toc-dropdown {
  background: var(--color-surface);
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

@media (max-width: 1499px) {
  .cs-toc-dropdown { display: block; }
}

.cs-toc-dropdown.is-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Dropdown uses same link styles as persistent sidebar */
.cs-toc-dropdown .cs-toc__label,
.cs-toc-dropdown .cs-toc__nav,
.cs-toc-dropdown .cs-toc__link,
.cs-toc-dropdown .cs-toc__dot,
.cs-toc-dropdown .cs-toc__children,
.cs-toc-dropdown .cs-toc__child { /* inherit */ }

/* ============================================
   STICKY IN-LAYOUT TOC v2 variant
   Used by floward-*-v2.html pages.
   TOC is a proper grid column, position:sticky.
   ============================================ */

.cs-page-wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 56px 40px 100px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 64px;
  align-items: start;
}

/* Sticky TOC column */
.cs-toc-sticky {
  position: sticky;
  top: 96px; /* nav 72px + 24px breathing room */
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 4px 0;
  scrollbar-width: none;
}

.cs-toc-sticky::-webkit-scrollbar { display: none; }

/* Right content column */
.cs-page-body {
  min-width: 0;
}

/* Inner containers: no side padding needed grid provides the gutter */
.cs-page-body .container {
  padding-left: 0;
  padding-right: 0;
  max-width: none;
}

.cs-page-body .container--narrow {
  max-width: 680px;
}

/* Mobile: collapse to single column, hide TOC */
@media (max-width: 900px) {
  .cs-page-wrap {
    grid-template-columns: 1fr;
    padding: 32px 24px 60px;
    gap: 0;
  }
  .cs-toc-sticky {
    display: none;
  }
}

/* --- Animations --- */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in--visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.stagger > .fade-in:nth-child(1) { transition-delay: 0s; }
.stagger > .fade-in:nth-child(2) { transition-delay: 0.1s; }
.stagger > .fade-in:nth-child(3) { transition-delay: 0.2s; }
.stagger > .fade-in:nth-child(4) { transition-delay: 0.3s; }
.stagger > .fade-in:nth-child(5) { transition-delay: 0.4s; }

/* Above-the-fold entrance: drive hero fade-ins via CSS (no JS wait) */
@keyframes heroEnter {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}
.hero .fade-in,
.cs-hero .fade-in,
.about-hero .fade-in {
  animation: heroEnter 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
  opacity: 1;
  transform: none;
  transition: none;
}
.hero .fade-in:nth-child(1),
.cs-hero .fade-in:nth-child(1),
.about-hero .fade-in:nth-child(1) { animation-delay: 0.02s; }
.hero .fade-in:nth-child(2),
.cs-hero .fade-in:nth-child(2),
.about-hero .fade-in:nth-child(2) { animation-delay: 0.08s; }
.hero .fade-in:nth-child(3),
.cs-hero .fade-in:nth-child(3),
.about-hero .fade-in:nth-child(3) { animation-delay: 0.14s; }
.hero .fade-in:nth-child(4),
.cs-hero .fade-in:nth-child(4),
.about-hero .fade-in:nth-child(4) { animation-delay: 0.20s; }
.hero .fade-in:nth-child(5),
.cs-hero .fade-in:nth-child(5),
.about-hero .fade-in:nth-child(5) { animation-delay: 0.26s; }

@media (prefers-reduced-motion: reduce) {
  .hero .fade-in,
  .cs-hero .fade-in,
  .about-hero .fade-in {
    animation: none;
  }
}

/* --- Responsive --- */
@media (max-width: 768px) {
  :root {
    --section-padding: 80px;
  }

  .container {
    padding: 0 24px;
  }

  .hero {
    padding-top: 140px;
    min-height: auto;
  }

  .hero__meta {
    gap: 24px;
  }

  .nav__links {
    gap: 20px;
  }

  .card__body {
    padding: 24px;
  }

  .cs-hero {
    padding-top: 120px;
    padding-bottom: 20px;
  }

  .cs-overview__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .highlight {
    padding: 32px 24px;
  }

  .outcome-grid {
    grid-template-columns: 1fr 1fr;
  }

  .step {
    gap: 16px;
  }

  .comparison-table {
    font-size: 0.85rem;
  }

  .comparison-table th,
  .comparison-table td {
    padding: 12px;
  }
}

@media (max-width: 640px) {
  .nav__menu-btn {
    display: inline-flex;
    margin-left: auto;
    position: relative;
    z-index: 2;
  }
  .nav__logo,
  .nav__toggle {
    position: relative;
    z-index: 2;
  }

  .nav__links {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    padding: 96px 32px 48px;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    overflow-y: auto;
    background: var(--color-bg);
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.4s var(--ease-apple), opacity 0.3s var(--ease-apple);
  }
  .nav__links.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .nav__links li {
    border-bottom: 1px solid var(--color-border);
  }
  .nav__links li:last-child {
    border-bottom: none;
  }
  .nav__links a {
    display: block;
    padding: 18px 4px;
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--color-text);
    letter-spacing: -0.018em;
  }
  .nav__links a::after { display: none; }
}

@media (max-width: 480px) {

  .cs-overview__grid {
    grid-template-columns: 1fr;
  }

  .outcome-grid {
    grid-template-columns: 1fr;
  }

  .hero__description {
    font-size: 1.05rem;
  }

  .footer__inner {
    flex-direction: column;
    text-align: center;
  }
}

/* --- Case Study Password Gate --- */
#cs-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: heroEnter 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.cs-gate__card {
  width: 100%;
  max-width: 420px;
  text-align: left;
}
.cs-gate__label {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: 16px;
}
.cs-gate__title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 28px;
  color: var(--color-text);
}
.cs-gate__form {
  display: flex;
  gap: 8px;
}
.cs-gate__input {
  flex: 1;
  font: inherit;
  font-size: 1rem;
  padding: 12px 16px;
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 100px;
  outline: none;
  transition: border-color var(--transition);
}
.cs-gate__input:focus {
  border-color: var(--color-text);
}
.cs-gate__btn {
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  padding: 12px 24px;
  background: var(--color-text);
  color: var(--color-bg);
  border: 1px solid var(--color-text);
  border-radius: 100px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.cs-gate__btn:hover {
  background: var(--color-text);
  border-color: var(--color-text);
  color: #fff;
}
.cs-gate__error {
  font-size: 0.85rem;
  color: #e00;
  margin-top: 12px;
  min-height: 1.2em;
}

