/* ============================================================
   MONOONO — stylesheet
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:          #000000;
  --ink:         #ffffff;
  --footer-text: #666666;
  --border-color:#222222;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Prevent scrolling during intro animation */
  transition: background-color 0.8s ease;
}

/* Page states */
body.animation-loaded {
  overflow-y: auto; /* Enable scrolling when content loads */
}

/* ── Header ───────────────────────────────────────────────── */

.app-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 2rem 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  transition: background-color 0.5s ease, backdrop-filter 0.5s ease, border-bottom 0.5s ease;
  pointer-events: none; /* Let clicks pass through until anim is complete */
}

body.animation-loaded .app-header {
  pointer-events: auto;
  backdrop-filter: blur(10px);
  background-color: rgba(0, 0, 0, 0.7);
}

.logo-container {
  position: absolute;
  left: 50%;
  top: 50vh;
  transform: translate(-50%, -50%);
  /* Parabolic track setup: X-axis (left) and Y-axis (top) transition with different curves.
     Transition time is twice as fast (0.6s). 
     Y-axis transition has a back-out/spring curve (cubic-bezier(0.175, 0.885, 0.32, 1.275)) to add the bounce at the end. */
  transition: 
    left 0.6s cubic-bezier(0.25, 1, 0.5, 1),
    top 0.6s cubic-bezier(0.3, 0.5, 0.7, 0.8),
    transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

body.animation-loaded .logo-container {
  position: relative;
  left: 0;
  top: 0;
  transform: translate(0, 0);
}

/* ── Main and Hero Content ──────────────────────────────────── */

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  padding-top: 8rem; /* Space for the fixed header */
}

.hero-container {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 4rem 2rem;
  text-align: left;
}

/* Staggered Build In Animation Setup */
.hero-title,
.hero-subtitle,
#about,
#contacts,
footer {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 1s cubic-bezier(0.25, 1, 0.5, 1), transform 1s cubic-bezier(0.25, 1, 0.5, 1);
}

/* 1. Hero Title: starts after logo completes movement (0.6s) */
body.animation-loaded .hero-title {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.6s;
}

/* 2. Hero Subtitle */
body.animation-loaded .hero-subtitle {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.9s;
}

/* 3. About Section */
body.animation-loaded #about {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 1.2s;
}

/* 4. Contacts Section */
body.animation-loaded #contacts {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 1.5s;
}

/* 5. Footer: loaded lastly */
body.animation-loaded footer {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 1.8s;
}

.hero-title {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 1.5rem;
  color: var(--ink);
  font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Monaco, Consolas, monospace;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: #888888;
  max-width: 600px;
  margin: 0 0 4rem 0;
  line-height: 1.6;
}

/* Content Sections */
#contentSections {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
}

.content-section {
  padding: 4rem 0;
  text-align: left;
}

.content-section h2 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  letter-spacing: -0.01em;
  font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Monaco, Consolas, monospace;
}

.content-section p {
  color: #a0a0a0;
  line-height: 1.7;
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

.email-btn-wrapper {
  margin-top: 1rem;
}

.contact-email {
  background: none;
  border: none;
  padding: 0;
  font-family: ui-monospace, monospace;
  color: var(--ink);
  font-size: 1.2rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  outline: none;
  display: inline-flex;
  align-items: center;
  position: relative;
}

.contact-email:hover .email-text {
  text-decoration: underline;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

.contact-email .copied-msg {
  display: none;
  color: #666666;
  font-size: 1.2rem;
  letter-spacing: 0.05em;
}

.contact-email.copied .email-text {
  display: none;
}

.contact-email.copied .copied-msg {
  display: inline;
  animation: fadeInOut 2s forwards;
}

@keyframes fadeInOut {
  0% { opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { opacity: 0; }
}

@media (min-width: 768px) {
  #contentSections {
    flex-direction: row;
    gap: 4rem;
    align-items: flex-start;
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
  }
  .content-section {
    flex: 1;
    padding: 2rem 0;
  }
}

/* ── Logo Animation ───────────────────────────────────────── */

.logo-wrap {
  position: relative;
  width: 200px;
  max-width: 40vw;
  aspect-ratio: 54 / 26;
  transition: width 0.8s ease;
}

body.animation-loaded .logo-wrap {
  width: 108px;
}

.logo-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.layer-b { mix-blend-mode: screen; z-index: 17; opacity: 0; }
.layer-g { mix-blend-mode: screen; z-index: 18; opacity: 0; }
.layer-r { mix-blend-mode: screen; z-index: 19; opacity: 0; }
.layer-main { z-index: 20; }

.logo-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.char {
  opacity: 0;
  animation: charAppear 0s forwards;
}

/* Organic Typing Sequence (Starts after 2s delay) */
.char-1 { animation-delay: 2.0s; }
.char-2 { animation-delay: 2.25s; }
.char-3 { animation-delay: 2.4s; }
.char-4 { animation-delay: 2.75s; }

/* 0.75s pause with 1 blink at the end of line 1 */
.char-5 { animation-delay: 3.7s; }
.char-6 { animation-delay: 3.95s; }
.char-7 { animation-delay: 4.2s; }

@keyframes charAppear {
  to { opacity: 1; }
}

.cursor-wrapper {
  animation: 
    cursorMove 4.5s steps(1) forwards,
    cursorState 4.5s forwards;
}

@keyframes cursorMove {
  0%    { transform: translate(-42px, -14px); } /* 0s: Start Row 1 */
  44.4% { transform: translate(-28px, -14px); } /* 2.0s: After M */
  50.0% { transform: translate(-14px, -14px); } /* 2.25s: After O */
  53.3% { transform: translate(0px, -14px); }   /* 2.4s: After N */
  61.1% { transform: translate(14px, -14px); }  /* 2.75s: Right of O (STAYS for blink) */
  77.8% { transform: translate(-42px, 0px); }   /* 3.5s: Moves to Row 2 */
  82.2% { transform: translate(-28px, 0px); }   /* 3.7s: After O */
  87.8% { transform: translate(-14px, 0px); }   /* 3.95s: After N */
  93.3% { transform: translate(0px, 0px); }     /* 4.2s: After O (final) */
}

@keyframes cursorState {
  /* Initial 2 blinks (0-2s) */
  0%, 22%, 44% { opacity: 1; }
  11%, 33%      { opacity: 0; }
  
  /* Typing Row 1 (2-2.75s) */
  45%, 61% { opacity: 1; }
  
  /* Single blink at end of Row 1 (2.75-3.5s) */
  69% { opacity: 0; }
  77% { opacity: 1; }
  
  /* Typing Row 2 (3.5-4.5s) */
  78%, 100% { opacity: 1; }
}

/* ── Instant Load Session Bypass Styles ────────────────────── */

body.instant-load,
body.instant-load * {
  animation-duration: 0s !important;
  animation-delay: 0s !important;
  transition-duration: 0s !important;
  transition-delay: 0s !important;
}

body.instant-load .logo-container {
  position: relative !important;
  left: 0 !important;
  top: 0 !important;
  transform: translate(0, 0) !important;
}

body.instant-load .logo-wrap {
  width: 108px !important;
}

body.instant-load .char {
  opacity: 1 !important;
}

body.instant-load .cursor-wrapper {
  opacity: 1 !important;
  transform: translate(0px, 0px) !important;
}

body.instant-load .hero-title,
body.instant-load .hero-subtitle,
body.instant-load #about,
body.instant-load #contacts,
body.instant-load footer {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

/* ── Footer ────────────────────────────────────────────────── */

footer {
  width: 100%;
  padding: 2rem 3rem;
  background-color: #050505;
}

.footer-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

footer small {
  color: var(--footer-text);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Monaco, Consolas, monospace;
}

footer a {
  color: var(--footer-text);
  text-decoration: none;
  transition: color 0.2s ease;
}

footer a:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* AEGENTI text hover exception */
footer .footer-right a {
  transition: color 0.2s ease;
}

footer .footer-right a .aegenti-text {
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

footer .footer-right a:hover {
  text-decoration: none; /* remove default underline on the container link */
  color: var(--footer-text); /* keep "Powered by " text un-highlighted */
}

footer .footer-right a:hover .aegenti-text {
  color: var(--ink);
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
  text-decoration: underline;
}

@media (max-width: 768px) {
  .app-header {
    padding: 1.5rem 2rem;
  }
  .hero-container {
    text-align: left;
    padding: 3rem 1.5rem;
  }
  .hero-title {
    font-size: 2.25rem;
  }
  .hero-subtitle {
    margin-left: 0;
    margin-right: 0;
  }
  .footer-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    text-align: left;
  }
  footer {
    padding: 2rem 1.5rem;
  }
}
