:root {
  --cream: #faf7f2;
  --ink: #1a1a1a;
  --navy: #15284b;
  --pin-accent: #c0392b;
  --charcoal: rgba(26, 26, 26, 0.64);
  --charcoal-dim: rgba(26, 26, 26, 0.46);
  --line: rgba(21, 40, 75, 0.14);
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #e9e3d8;
  color: var(--ink);
  font-family: var(--sans);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body {
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.stage {
  width: 100%;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e9e3d8;
}

.viewport {
  position: relative;
  width: 100%;
  height: 100dvh;
  max-width: 420px;
  margin: 0 auto;
  overflow: hidden;
  background: var(--cream);
  display: flex;
  flex-direction: column;
  isolation: isolate;
}

.screens {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  touch-action: pan-y;
}

/* ---------- Footer (static, every frame) ---------- */
.site-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 34px;
  background: var(--cream);
  border-top: 1px solid var(--line);
  padding: 13px 16px max(13px, env(safe-area-inset-bottom));
}

.footer-link {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--navy);
  opacity: 0.82;
}

.footer-link:active {
  opacity: 1;
}

.site-footer.footer-hidden {
  visibility: hidden;
  pointer-events: none;
}

/* ---------- Progress bar ---------- */
.progress {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 10;
  display: flex;
  gap: 6px;
  box-sizing: border-box;
  padding: max(14px, env(safe-area-inset-top)) 16px 0;
}

.segment {
  flex: 1;
  height: 3px;
  border-radius: 3px;
  background: rgba(21, 40, 75, 0.14);
  overflow: hidden;
}

.segment .fill {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--navy);
  transition: width 0.3s ease;
}

.segment.done .fill,
.segment.active .fill {
  width: 100%;
}

/* ---------- Track / frames ---------- */
.track {
  display: flex;
  height: 100%;
  width: 100%;
  will-change: transform;
}

.frame {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: max(56px, calc(env(safe-area-inset-top) + 48px)) 28px max(28px, env(safe-area-inset-bottom));
  position: relative;
  overflow: hidden;
  user-select: none;
}

/* ---------- Frame 1: Cover ---------- */
.frame-cover {
  padding-top: 0 !important;
  padding-right: 0;
  padding-bottom: 0;
  padding-left: 0;
  margin-top: 0;
  justify-content: flex-start;
}

.cover-photo {
  position: relative;
  width: 100%;
  height: 66vh; /* fallback before app.js computes the exact value */
  flex: 0 0 auto;
  overflow: hidden;
  background: #ddd4c4;
}

.cover-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 25%;
  display: block;
}

.photo-fade {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42%;
  background: linear-gradient(to bottom, rgba(250, 247, 242, 0) 0%, var(--cream) 90%);
}

.cover-text {
  padding: 22px 28px 0;
}

.name {
  font-family: var(--serif);
  font-weight: 700;
  color: var(--navy);
  font-size: clamp(2.1rem, 9.5vw, 2.9rem);
  line-height: 1.05;
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}

.subtitle {
  font-size: 1.15rem;
  line-height: 1.55;
  color: var(--charcoal);
  margin: 0 0 8px;
  max-width: 340px;
}

.tap-hint {
  position: absolute;
  margin-top: 0;
  bottom: 80px; /* fallback; app.js sets this precisely to footer height + 12px */
  right: 24px;
  font-size: 0.78rem;
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.03em;
  color: var(--navy);
  opacity: 0.45;
  pointer-events: none;
}

/* ---------- Hero section titles (frames 2-4) ---------- */
.hero {
  font-family: var(--serif);
  font-weight: 700;
  color: var(--navy);
  font-size: clamp(2.8rem, 8vw, 3.5rem);
  line-height: 1.06;
  margin: 0;
  letter-spacing: -0.01em;
}

/* ---------- Frame 2: map ---------- */
.frame-map {
  justify-content: flex-start;
  padding-left: 0;
  padding-right: 0;
}

.frame-map-header {
  padding: 0 28px;
}

.map-subtitle {
  margin: 8px 0 0;
  font-size: 1.15rem;
  line-height: 1.55;
  color: var(--charcoal);
}

.map-intro {
  margin: 8px 0 0;
  font-size: 1.15rem;
  line-height: 1.4;
  color: var(--ink);
}

.map-wrap {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 24px;
}

.world-map {
  width: 100%;
  height: 100%;
  display: block;
}

.map-land {
  fill: none;
  stroke: var(--navy);
  stroke-width: 0.8;
  stroke-linejoin: round;
  opacity: 0.8;
}

.map-pin {
  cursor: pointer;
}

.map-pin .pin-hit {
  fill: transparent;
}

.map-pin .pin-dot {
  fill: var(--pin-accent);
  stroke: var(--cream);
  stroke-width: 0.6;
  transition: transform 0.15s ease;
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
  translate: 0 -16px;
}

.map-pin .pin-label {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 7.5px;
  fill: var(--navy);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

@keyframes pin-drop {
  from {
    opacity: 0;
    translate: 0 -16px;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}

.map-pin.pin-dropped .pin-dot {
  animation: pin-drop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.map-pin.pin-dropped .pin-label {
  opacity: 1;
}

.map-pin:hover .pin-dot,
.map-pin.pin-active .pin-dot {
  transform: scale(1.35);
}

.map-pin:hover .pin-label,
.map-pin.pin-active .pin-label {
  opacity: 1;
}

/* ---------- Frame 3: proof / logo cards ---------- */
.frame-proof {
  justify-content: flex-start;
}

.proof-cards {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.proof-card {
  display: flex;
  align-items: center;
  gap: 16px;
}

.proof-logo {
  flex: 0 0 auto;
  width: 84px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.proof-logo img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.proof-logo-taiba {
  height: 70px;
}

.proof-logo-taiba img {
  height: 70px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.proof-caption {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--charcoal);
}

/* ---------- Frame 4: stat list ---------- */
.frame-fluent {
  justify-content: flex-start;
}

.stat-list {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stat-list li {
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--ink);
  padding-left: 18px;
  position: relative;
}

.stat-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--navy);
}

.word-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
  text-align: left;
}

.word-stack-item {
  font-family: var(--serif);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  line-height: 1.1;
  font-size: clamp(2rem, 9.2vw, 2.9rem);
}

.word-blue { color: #2e86c1; }
.word-amber { color: #e67e22; }
.word-red { color: var(--pin-accent); }

/* ---------- Frame 5: let's work together ---------- */
.frame-work {
  justify-content: flex-start;
}

.work-tagline {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  color: var(--navy);
  font-size: 1.15rem;
  line-height: 1.4;
  margin: 10px 0 0;
}

.work-body {
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--charcoal);
  margin: 16px 0 0;
}

/* ---------- Frame 6: credentials ---------- */
.frame-last {
  justify-content: flex-start;
}

.label-lg {
  font-family: var(--serif);
  font-weight: 700;
  color: var(--navy);
  font-size: clamp(2rem, 7.5vw, 2.5rem);
  margin: 0;
}

.cred-cards {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cred-card {
  display: flex;
  align-items: center;
  gap: 13px;
}

.cred-logo {
  flex: 0 0 auto;
  width: 62px;
  height: 60px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
}

.cred-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left center;
}

.cred-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cred-degree {
  font-weight: 700;
  color: var(--navy);
  font-size: 1.1rem;
  line-height: 1.3;
}

.cred-program {
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--charcoal-dim);
}

.contact-section {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.connect-cta {
  font-family: var(--serif);
  font-weight: 700;
  color: var(--navy);
  font-size: 1.1rem;
  margin: 0 0 12px;
  text-align: left;
}

.contact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--navy);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
}

.contact-link svg {
  flex-shrink: 0;
  opacity: 0.85;
}

/* ---------- Desktop phone-frame presentation ---------- */
@media (min-width: 681px) {
  .stage {
    padding: 40px 0;
    background: #e9e3d8;
  }

  .viewport {
    width: 420px;
    height: 890px;
    max-height: 92dvh;
    border-radius: 44px;
    border: 1px solid rgba(21, 40, 75, 0.14);
    box-shadow: 0 30px 70px rgba(21, 40, 75, 0.18), 0 0 0 10px #050708, 0 0 0 11px rgba(21, 40, 75, 0.12);
  }
}

@media (max-height: 720px) {
  .frame:not(.frame-cover) { padding-top: max(50px, calc(env(safe-area-inset-top) + 42px)); }
  .name { font-size: clamp(1.9rem, 8.5vw, 2.5rem); margin-bottom: 10px; }
  .subtitle { font-size: 1.02rem; }
  .cover-text { padding-top: 16px; }
  .hero { font-size: clamp(2.3rem, 7.4vw, 3rem); }
  .word-stack-item { font-size: clamp(1.7rem, 8vw, 2.3rem); }
  .map-intro,
  .proof-caption,
  .stat-list li { font-size: 1.05rem; }
}
