/* ═══════════════════════════════════════════════════════
   ALFABE Portal — Penguin Animation & Page Styles
   ═══════════════════════════════════════════════════════ */

:root {
  --bg-1: #f4f8ff; --bg-2: #e8fff5; --ink: #224261;
  --muted: #6586a7; --primary: #7fa7ff;
  --card: #ffffff; --shadow: 0 18px 30px rgba(34,66,97,.16);
  --penguin-dark: #1a1a2e;
  --penguin-light: #f0f0f5;
  --penguin-yellow: #f5c518;
  --penguin-yellow-stroke: #d4a800;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: Fredoka, sans-serif;
  color: var(--ink); min-height: 100vh; overflow-x: hidden;
  background: radial-gradient(circle at 15% 12%, #fff 5%, var(--bg-1) 45%, var(--bg-2) 100%);
}

/* ── SAHNE ─────────────────────────────────────────── */
.scene {
  position: relative; width: min(1200px,96vw);
  margin: 28px auto 0; height: 270px;
}
.ice-ground {
  position: absolute; left: 2%; right: 2%; bottom: 10px;
  height: 30px; border-radius: 99px;
  background: linear-gradient(90deg,#d8ebff,#c4ffe7);
}
.path-message {
  text-align: center;
  font-size: clamp(10px, 1.4vw, 13px);
  color: #4a5568;
  background: rgba(255,255,255,0.95);
  padding: 12px 20px;
  margin: 20px auto;
  max-width: 800px;
  border-radius: 12px;
  line-height: 1.4;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.path-message strong {
  color: #2d3748;
}

/* ── KAPI ──────────────────────────────────────────── */
/* Z-index stack (no isolation — shared stacking context with penguin):
   door-inside: 1  |  door-glow: 2  |  penguin(walking): 10
   penguin(entering): 5  |  door-leaf: 15  |  door-frame: 20  |  door-brand: 25 */
.door {
  position: absolute; right: 6%; bottom: 36px;
  width: 148px; height: 174px;
  border-radius: 18px 18px 5px 5px;
  background: linear-gradient(180deg,#8faeff,#6f8fe8);
  box-shadow: var(--shadow); overflow: visible;
}
.door-inside {
  position: absolute; inset: 12px; border-radius: 10px;
  background: radial-gradient(circle at 55% 35%,#8fc2ff,#274780 72%);
  opacity: .82; z-index: 1;
}
.door-test {
  position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center;
  font-size: 22px; font-weight: 900; letter-spacing: 3px;
  color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,.5);
  opacity: 0;
  animation: door-test-fade 12s ease-in-out forwards;
}
.door-brand {
  position: absolute; left: 0; right: 0; top: 18px; z-index: 25;
  text-align: center; font-weight: 800; letter-spacing: .5px;
  color: rgba(255,255,255,.92); text-shadow: 0 1px 0 rgba(0,0,0,.15);
}
.door-frame {
  position: absolute; inset: 10px; border-radius: 12px;
  border: 2px dashed rgba(255,255,255,.68); z-index: 20;
}
.door-leaf {
  position: absolute; inset: 12px; border-radius: 11px;
  background: linear-gradient(180deg,#7396f1,#597ed8);
  transform-origin: right center;
  animation: door-open 12s ease-in-out forwards; z-index: 15;
}
.door-knob {
  position: absolute; left: 22px; top: 76px;
  width: 12px; height: 12px; border-radius: 50%; background: #ffe8ad;
}
.door-glow {
  position: absolute; inset: 20px; border-radius: 8px;
  background: radial-gradient(circle, rgba(143,194,255,.6), rgba(39,71,128,.3));
  opacity: 0;
  animation: door-glow-pulse 12s ease-in-out forwards;
  z-index: 2;
}

/* ── PENGUEN ───────────────────────────────────────── */
.owl {
  position: absolute; bottom: 23px; left: -170px;
  width: 140px; height: 180px;
  z-index: 10;  /* above door while walking */
  animation: owl-fly 12s linear forwards;
}
.owl-inner {
  position: relative; width: 100%; height: 100%;
  animation: body-bob 0.5s ease-in-out infinite;
}

/* SVG penguin character */
.owl-svg {
  width: 100%; height: 100%;
  overflow: visible;
}

/* SVG part animations */
.owl-svg .p-foot-l {
  transform-box: fill-box;
  transform-origin: center top;
  animation: foot-lift-l 0.5s ease-in-out infinite;
}
.owl-svg .p-foot-r {
  transform-box: fill-box;
  transform-origin: center top;
  animation: foot-lift-r 0.5s ease-in-out infinite;
}
.owl-svg .p-wing-l-g {
  transform-box: fill-box;
  transform-origin: 80% 10%;
  animation: wing-carry 12s ease-in-out forwards;
}
.owl-svg .p-wing-r-g {
  transform-box: fill-box;
  transform-origin: 20% 10%;
  animation: wing-swing 12s ease-in-out infinite;
}

/* ── FLOATING EMAIL ENVELOPES ──────────────────────── */
.owl .mail-swarm {
  position: absolute; left: -24px; top: 12px; z-index: 6;
  width: 90px; height: 110px;
  animation: mail-swarm-carry 12s ease-in-out forwards;
  pointer-events: none;
}
.owl .ew {
  position: absolute;
  animation-timing-function: ease-in-out;
  animation-fill-mode: forwards;
}
/* Scatter directions: each envelope flies outward from the swarm center */
.owl .ew.w1 { top: -4px;  left: 0;   animation: env-scatter1 12s ease-in-out forwards; }
.owl .ew.w2 { top: 24px;  left: 38px; animation: env-scatter2 12s ease-in-out forwards; }
.owl .ew.w3 { top: 50px;  left: -4px; animation: env-scatter3 12s ease-in-out forwards; }
.owl .ew.w4 { top: 10px;  left: 50px; animation: env-scatter4 12s ease-in-out forwards; }
.owl .ew.w5 { top: 62px;  left: 32px; animation: env-scatter5 12s ease-in-out forwards; }

/* Envelope base style */
.owl .env {
  position: absolute;
  border-radius: 4px;
  border: 2px solid;
  overflow: hidden;
}
.owl .env::before {
  content: ''; position: absolute;
  left: 1px; right: 1px; top: 1px; height: 0;
  border-top: 6px solid;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
}
.owl .env::after {
  content: ''; position: absolute;
  bottom: 2px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%;
}

/* Envelope 1 — blue */
.owl .env.e1 {
  width: 28px; height: 19px; background: #dde8ff; border-color: #8ca2c8;
  animation: env-flutter1 1.2s ease-in-out infinite;
}
.owl .env.e1::before { border-top-color: #c4d6f7; }
.owl .env.e1::after  { background: #5e8df7; }

/* Envelope 2 — pink */
.owl .env.e2 {
  width: 24px; height: 16px; background: #ffe4f0; border-color: #e8a0bf;
  animation: env-flutter2 1.5s ease-in-out infinite;
}
.owl .env.e2::before { border-top-color: #ffd0e4; }
.owl .env.e2::after  { background: #e879a8; }

/* Envelope 3 — green */
.owl .env.e3 {
  width: 26px; height: 18px; background: #dfffec; border-color: #7ec8a4;
  animation: env-flutter3 1.0s ease-in-out infinite;
}
.owl .env.e3::before { border-top-color: #c4f5dc; }
.owl .env.e3::after  { background: #34a853; }

/* Envelope 4 — yellow */
.owl .env.e4 {
  width: 22px; height: 15px; background: #fff8d6; border-color: #d4b94e;
  animation: env-flutter4 1.8s ease-in-out infinite;
}
.owl .env.e4::before { border-top-color: #fff0a8; }
.owl .env.e4::after  { background: #f59e0b; }

/* Envelope 5 — purple */
.owl .env.e5 {
  width: 25px; height: 17px; background: #f0e6ff; border-color: #b48ee0;
  animation: env-flutter5 1.3s ease-in-out infinite;
}
.owl .env.e5::before { border-top-color: #e4d0ff; }
.owl .env.e5::after  { background: #a142f4; }

/* ── KEYFRAME ANIMATIONS ───────────────────────────── */

/*
  Timeline (12s total, plays once with forwards fill):
    0-45%   : Walk toward door, emails flutter
    45-52%  : Approach door, slow down
    52-70%  : Door opens (proximity-triggered, starts early)
    58-64%  : Envelopes scatter outward + fade
    60-66%  : Arrive near door, son bakış (look back) while door opens
    66-68%  : Turn back toward now-fully-open door
    68-100% : Penguin enters door — shrinks + fades (depth effect)

  Door center = calc(94% - 74px)  (right:6%, width:148px, center at 74px from left edge)
  Penguin center aligned = calc(94% - 144px)  (penguin width:140px, center at 70px)
*/
@keyframes owl-fly {
  0%   { left: -170px; transform: scaleX(1) scale(1); opacity: 1; z-index: 10; }
  45%  { left: calc(94% - 280px); transform: scaleX(1) scale(1); opacity: 1; z-index: 10; }
  52%  { left: calc(94% - 200px); transform: scaleX(1) scale(1); opacity: 1; z-index: 10; }
  60%  { left: calc(94% - 160px); transform: scaleX(1) scale(1); opacity: 1; z-index: 10; }
  /* Son bakış — door is opening (already 50%+ open) */
  64%  { left: calc(94% - 158px); transform: scaleX(-1) scale(0.98); opacity: 1; z-index: 10; }
  66%  { left: calc(94% - 158px); transform: scaleX(1) scale(0.97); opacity: 1; z-index: 10; }
  /* Kapıya giriş — door fully open, penguin enters */
  70%  { left: calc(94% - 150px); transform: scaleX(1) scale(0.85); opacity: 0.85; z-index: 5; }
  78%  { left: calc(94% - 146px); transform: scaleX(1) scale(0.6);  opacity: 0.55; z-index: 5; }
  88%  { left: calc(94% - 144px); transform: scaleX(1) scale(0.35); opacity: 0.2;  z-index: 5; }
  100% { left: calc(94% - 144px); transform: scaleX(1) scale(0.2); opacity: 0;    z-index: 5; }
}

/* Waddle bob — natural walking bounce */

  25%      { transform: translateY(-2px) rotate(1.5deg); }
  50%      { transform: translateY(0) rotate(0deg); }
  75%      { transform: translateY(-2px) rotate(-1.5deg); }
}

/* Alternating feet — waddle lift */
@keyframes foot-lift-l {
  0%, 50%, 100% { transform: translateY(0); }
  25%           { transform: translateY(-5px); }
}
@keyframes foot-lift-r {
  0%, 50%, 100% { transform: translateY(0); }
  75%           { transform: translateY(-5px); }
}

/* Door opens from right hinge (transform-origin: right center) — swings inward
   Proximity-based: starts opening early (52%), 50% open by ~61%, fully open by 70% */
@keyframes door-open {
  0%, 35%   { transform: perspective(500px) rotateY(0deg); }
  50%       { transform: perspective(500px) rotateY(39deg); }
  62%, 100% { transform: perspective(500px) rotateY(78deg); }
}

@keyframes door-glow-pulse {
  0%, 35%  { opacity: 0; }
  55%      { opacity: 0.7; }
  80%      { opacity: 0.5; }
  100%     { opacity: 0; }
}

@keyframes door-test-fade {
  0%, 68%  { opacity: 0; }
  78%, 100% { opacity: 1; }
}

/* Left wing — carrying position, releases on look-back */
@keyframes wing-carry {
  0%, 60%  { transform: rotate(-40deg); }
  64%      { transform: rotate(-15deg); }
  66%      { transform: rotate(-25deg); }
  74%, 100%{ transform: rotate(-40deg); }
}

/* Right wing — gentle swing while walking */
@keyframes wing-swing {
  0%, 100% { transform: rotate(8deg); }
  50%      { transform: rotate(-4deg); }
}

/* Mail swarm — envelopes scatter outward and dissolve into air
   Scatter begins as penguin approaches door (58%) */
@keyframes mail-swarm-carry {
  0%, 58%  { opacity: 1; transform: translate(0,0) scale(1); }
  64%      { opacity: 0.7; transform: translate(0,0) scale(1.05); }
  70%      { opacity: 0.2; transform: translate(0,0) scale(1.1); }
  74%, 100%{ opacity: 0; transform: translate(0,0) scale(1.12); }
}

/* Envelope flutter (per-envelope rhythm) */
@keyframes env-flutter1 {
  0%, 100% { transform: rotate(-8deg) translateY(0); }
  30%      { transform: rotate(-4deg) translateY(-5px); }
  60%      { transform: rotate(-12deg) translateY(-2px); }
}
@keyframes env-flutter2 {
  0%, 100% { transform: rotate(6deg) translateY(0); }
  40%      { transform: rotate(2deg) translateY(-6px); }
  70%      { transform: rotate(10deg) translateY(-3px); }
}
@keyframes env-flutter3 {
  0%, 100% { transform: rotate(-3deg) translateY(0); }
  25%      { transform: rotate(2deg) translateY(-7px); }
  55%      { transform: rotate(-7deg) translateY(-2px); }
}
@keyframes env-flutter4 {
  0%, 100% { transform: rotate(5deg) translateY(0); }
  35%      { transform: rotate(0deg) translateY(-4px); }
  65%      { transform: rotate(9deg) translateY(-6px); }
}
@keyframes env-flutter5 {
  0%, 100% { transform: rotate(-5deg) translateY(0); }
  50%      { transform: rotate(3deg) translateY(-5px); }
}

/* Envelope scatter — each envelope flies OUTWARD from swarm center,
   dissolving into air while still fluttering. No envelopes enter the door.
   Scatter begins as penguin approaches door (58%). */
@keyframes env-scatter1 {
  0%, 58%  { left: 0; top: -4px; opacity: 1; }
  64%      { left: -18px; top: -28px; opacity: 0.65; }
  70%      { left: -34px; top: -48px; opacity: 0.2; }
  74%, 100%{ left: -42px; top: -58px; opacity: 0; }
}
@keyframes env-scatter2 {
  0%, 58%  { left: 38px; top: 24px; opacity: 1; }
  64%      { left: 62px; top: -8px; opacity: 0.65; }
  70%      { left: 86px; top: -32px; opacity: 0.2; }
  74%, 100%{ left: 98px; top: -44px; opacity: 0; }
}
@keyframes env-scatter3 {
  0%, 58%  { left: -4px; top: 50px; opacity: 1; }
  64%      { left: -24px; top: 72px; opacity: 0.65; }
  70%      { left: -40px; top: 96px; opacity: 0.2; }
  74%, 100%{ left: -50px; top: 110px; opacity: 0; }
}
@keyframes env-scatter4 {
  0%, 58%  { left: 50px; top: 10px; opacity: 1; }
  64%      { left: 76px; top: 4px; opacity: 0.65; }
  70%      { left: 100px; top: -8px; opacity: 0.2; }
  74%, 100%{ left: 114px; top: -14px; opacity: 0; }
}
@keyframes env-scatter5 {
  0%, 58%  { left: 32px; top: 62px; opacity: 1; }
  64%      { left: 56px; top: 82px; opacity: 0.65; }
  70%      { left: 78px; top: 106px; opacity: 0.2; }
  74%, 100%{ left: 90px; top: 120px; opacity: 0; }
}

/* Card floating */
@keyframes floaty {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-6px); }
}
@keyframes pulse-glow {
  0%,100% { box-shadow: 0 0 0 0 rgba(94,141,247,.35); }
  50%     { box-shadow: 0 0 26px 8px rgba(94,141,247,.45); }
}
@keyframes student-cta-bounce {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-4px); }
}

/* CTA text fade-in after penguin disappears */
@keyframes cta-fadein {
  0%   { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Alfabe logo fade-in after penguin enters door */
@keyframes logo-fadein {
  0%   { opacity: 0; transform: translateX(-20px); }
  100% { opacity: 1; transform: translateX(0); }
}

/* ── CTA TRAIL TEXT ─────────────────────────────────── */
.cta-trail {
  position: absolute;
  left: 0; right: 0;
  bottom: 90px;
  text-align: center;
  opacity: 0;
  animation: cta-fadein 2.5s ease-out 10s forwards;
  pointer-events: none;
  z-index: 8;
}
.cta-trail span {
  display: inline-block;
  font-size: clamp(15px, 2.2vw, 24px);
  font-weight: 700;
  color: var(--primary);
  text-shadow: 0 2px 10px rgba(127,167,255,.3);
  background: rgba(255,255,255,.65);
  backdrop-filter: blur(6px);
  padding: 10px 24px;
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(127,167,255,.18);
}

/* ── ALFABE LOGO ────────────────────────────────────── */
.alfabe-logo {
  position: absolute;
  left: 6%;
  bottom: 36px;
  height: 174px;          /* same height as door */
  width: auto;
  opacity: 0;
  animation: logo-fadein 2s ease-out 10s forwards;
  z-index: 8;
  filter: drop-shadow(0 4px 16px rgba(127,167,255,.25));
  pointer-events: none;
}

/* ── KARTLAR ───────────────────────────────────────── */
.entry { width: min(1200px,96vw); margin: 14px auto 38px; text-align: center; }
h1 { margin: 0; font-size: clamp(24px,4vw,42px); }
.sub { margin: 8px 0 22px; color: var(--muted); }
.grid {
  display: grid;
  grid-template-columns: 1fr minmax(300px,1.2fr) 1fr;
  gap: 16px; align-items: stretch;
}
.card {
  border-radius: 20px; background: var(--card);
  box-shadow: var(--shadow); padding: 18px;
  position: relative; overflow: hidden;
  animation: floaty 3s ease-in-out infinite;
}
.card::before {
  content: ''; position: absolute;
  inset: -70% auto auto -30%; width: 180%; height: 180%;
  background: radial-gradient(circle,rgba(255,255,255,.36),transparent 63%);
}
.card h2 { margin: 0 0 8px; position: relative; }
.card p  { margin: 0 0 14px; color: var(--muted); position: relative; }
.card button {
  border: none; border-radius: 999px; padding: 10px 16px;
  font-weight: 700; cursor: pointer; position: relative;
}

.student {
  background: linear-gradient(150deg,#9bc9ff,#cde4ff);
  transform: scale(1.06); animation-delay: .2s;
  animation: floaty 3s ease-in-out infinite, pulse-glow 2s ease-in-out infinite;
  display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
}
.student button {
  background: #5e8df7; color: #fff; font-size: 20px;
  padding: 16px 24px; width: min(92%,330px); margin: 14px auto 0;
  display: block; animation: student-cta-bounce 1.8s ease-in-out infinite;
}
.manager { background: linear-gradient(150deg,#dbe9ff,#eef4ff); }
.manager button { background: #4285F4; color: #fff; }
.teacher { background: linear-gradient(150deg,#ffe2de,#ffeceb); animation-delay: .4s; }
.teacher button { background: #EA4335; color: #fff; }
.parent  { background: linear-gradient(150deg,#dff6e6,#edfbf1); animation-delay: .6s; }
.parent button { background: #34A853; color: #fff; }
.portal-info { background: linear-gradient(150deg,#f0e6ff,#f8f2ff); }
.portal-info button { background: #FF8C00; color: #fff; }
.left-col,.right-col { display: grid; gap: 16px; }

/* ── FOOTER ────────────────────────────────────────── */
.footer { margin-top: 36px; background: #112642; color: #e8f0ff; padding: 34px 0; }
.footer-wrap {
  width: min(1200px,96vw); margin: 0 auto;
  display: grid; grid-template-columns: repeat(4,1fr);
  gap: 18px; text-align: left;
}
.footer h3 { margin: 0 0 10px; font-size: 18px; }
.footer p,.footer a,.footer li { color: #d1deff; font-size: 14px; line-height: 1.55; text-decoration: none; }
.footer ul { margin: 0; padding-left: 16px; }
.socials { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.socials a {
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px; padding: 4px 10px;
}

/* ── SPONSOR MARQUEE ────────────────────────────────── */
.sponsors {
  background: #f4f7fc;
  padding: 20px 0 18px;
  overflow: hidden;
  text-align: center;
}
.marquee-wrap {
  overflow: hidden;
  width: 100%;
  mask-image: linear-gradient(to right, transparent 0%, #000 8%, #000 92%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 8%, #000 92%, transparent 100%);
}
.marquee-track {
  display: flex;
  gap: 36px;
  width: max-content;
  animation: marquee-scroll 30s linear infinite;
}
.sponsors:hover .marquee-track {
  animation-play-state: paused;
}
.sponsor-circle {
  flex-shrink: 0;
  width: clamp(56px, 8vw, 90px);
  height: clamp(56px, 8vw, 90px);
  border-radius: 50%;
  background: #d8e2f0;
  border: 2px solid #c4d2e8;
  box-shadow: 0 2px 8px rgba(127,167,255,.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.sc-emoji {
  font-size: clamp(18px, 3vw, 28px);
  line-height: 1;
}
.sc-label {
  font-size: clamp(7px, 1.2vw, 10px);
  font-weight: 600;
  color: #6b7fa3;
  line-height: 1;
}
@keyframes marquee-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-16.66%); }
}

/* ── BMC (Buy Me a Coffee) ─────────────────────────── */
.bmc-section {
  background: #ffffff;
  text-align: center;
  padding: 22px 0 18px;
}
.bmc-section div { display: flex; justify-content: center; }

.copyright-bar {
  text-align: center;
  padding: 10px 0;
  background: #ffffff;
  color: #9aa8c0;
  font-size: 12px;
}

/* ── Mail Counter Banner ──────────────────────────── */
.mail-counter-banner {
  position: absolute; left: 6%; bottom: 224px;
  width: fit-content; max-width: 500px;
  background: linear-gradient(135deg,#fff3e0,#ffe0b2);
  border: 2px solid #ffcc80; border-radius: 999px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 8px 20px;
  font-size: 13px; color: #e65100; box-shadow: 0 4px 12px rgba(255,152,0,.2);
  z-index: 10;
  animation: mailBannerIn .6s ease-out;
  white-space: nowrap;
}
.mail-counter-banner button {
  background: none; border: none; font-size: 22px; cursor: pointer;
  color: #e65100; opacity: .5; line-height: 1; padding: 0 4px;
}
.mail-counter-banner button:hover { opacity: 1; }
@keyframes mailBannerIn {
  from { opacity: 0; transform: translateY(-20px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 920px) {
  .grid { grid-template-columns: 1fr; }
  .footer-wrap { grid-template-columns: 1fr; }
}

@keyframes body-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-15px); }
}
.owl-wing-l {
  transform-origin: 30px 110px;
  animation: flap-l 0.3s ease-in-out infinite alternate;
}
.owl-wing-r {
  transform-origin: 110px 110px;
  animation: flap-r 0.3s ease-in-out infinite alternate;
}
@keyframes flap-l {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(-40deg); }
}
@keyframes flap-r {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(40deg); }
}
.owl-svg .p-shadow {
  animation: shadow-pulse 0.5s ease-in-out infinite alternate;
}
@keyframes shadow-pulse {
  0% { transform: scale(1); opacity: 0.18; }
  100% { transform: scale(0.6); opacity: 0.05; }
}