/* ── DESIGN TOKENS (Spacing & Sizing System) ────────────────── */

:root {
  /* Spacing scale (rem = 16px base) */
  --space-xs: 0.25rem;   /* 4px */
  --space-sm: 0.5rem;    /* 8px */
  --space-md: 1rem;      /* 16px */
  --space-lg: 1.5rem;    /* 24px */
  --space-xl: 2rem;      /* 32px */
  --space-2xl: 3rem;     /* 48px */
  --space-3xl: 4rem;     /* 64px */
  
  /* Container widths */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  
  /* Border radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 20px rgba(82, 111, 198, 0.32);
  
  /* Colors */
  --bg-dark: #0f0f18;
  --bg-darker: #16161D;
  --accent-blue: #285995;
  --accent-blue-light: #2f6bc2;
  --accent-blue-lighter: #3B82F6;
  --text-light: #F9F9F9;
  --text-gray: rgb(211, 205, 205);
}

/* ── iOS / Safari GLOBAL FIXES ───────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
  -webkit-text-size-adjust: 100%;
}

html {
  height: 100%;
  background: var(--bg-dark);
}

body {
  min-height: 100%;
  background: linear-gradient(135deg, var(--bg-dark), var(--bg-darker));
  background-color: var(--bg-dark);
  font-family: 'Poppins', Helvetica, sans-serif;
  overflow-x: hidden;
  touch-action: manipulation;
}

/* ── MARQUEE ─────────────────────────────────────────────────── */
.taghead {
  display: flex;
  justify-content: center;
}

.card3 .marquee:nth-of-type(1) .marquee-track { animation-duration: 60s; }
.card3 .marquee:nth-of-type(2) .marquee-track { animation-duration: 95s; }
.card3 .marquee:nth-of-type(3) .marquee-track { animation-duration: 50s; }
.card3 .marquee:nth-of-type(4) .marquee-track { animation-duration: 60s; }
.card3 .marquee:nth-of-type(5) .marquee-track { animation-duration: 80s; }

.card3 {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-md);
  box-sizing: border-box;
}

.marquee {
  overflow: hidden;
  width: 100%;
  padding: var(--space-sm) 0;
}

.marquee-track {
  display: flex;
  width: max-content;
  animation: scroll-left var(--marquee-speed, 20s) linear infinite;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

.group {
  display: flex;
  gap: var(--space-md);
  flex-shrink: 0;
}

@keyframes scroll-left {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ── CARDS GRID ──────────────────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-rows: auto auto;
  grid-template-areas:
    "about skills"
    "interests skills";
  gap: var(--space-md);
  padding: 5vh;
}

.card1 { grid-area: about; }
.card2 { grid-area: skills; }
.card3 { grid-area: interests; }

.card2 {
  display: flex;
  flex-direction: column;
}

.card2-image {
  margin-top: auto;
  width: 100%;
}

.card2-image img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.card1,
.card2,
.card3 {
  border: solid 3px var(--accent-blue);
  color: var(--text-gray);
  border-radius: var(--radius-lg);
  padding: var(--space-sm);
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.02);
}

@media (hover: hover) and (pointer: fine) {
  .card1,
  .card2,
  .card3 {
    transition: transform 0.2s ease;
  }

  .card1:hover,
  .card2:hover,
  .card3:hover {
    border: solid 3px #E5E7EB;
    color: white;
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
  }
}

/* ── SPLASH ──────────────────────────────────────────────────── */
#splash {
  position: fixed;
  inset: 0;
  background: var(--bg-dark);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99999;
  flex-direction: column;
  padding: 0 var(--space-lg);
  opacity: 0;
  transform: scale(1.02);
  visibility: hidden;
  transition: opacity 0.8s ease, transform 0.8s ease, visibility 0.8s;
}

#submit:disabled {
  background-color: #AAB4C0 !important;
  color: #E5E7EB !important;
  border: 1px solid #AAB4C0 !important;
  opacity: 0.6 !important;
}

#splash.show {
  opacity: 1;
  transform: scale(1);
  visibility: visible;
}

#splash.hide {
  opacity: 0;
  transform: scale(1.05);
  visibility: hidden;
}

g-recaptcha{
  width: 100%;
}

 .splash-title {
    font-size: 4rem;
    letter-spacing: 0.5px;
    padding: 0 var(--space-lg);
    color: #3271ca;
    font-weight: 900;
  }

  .splash-sub{
    font-size: 2rem;
  }

@keyframes textIn {
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
  .splash-title {
    font-size: 2rem;
    letter-spacing: 0.5px;
    padding: 0 var(--space-lg);
    color: #3271ca;
    font-weight: 900;
  }
    .splash-sub{
    font-size: 1rem;
  }
}

/* ── GLOBAL ELEMENTS ─────────────────────────────────────────── */
img {
  max-width: 100%;
  height: auto;
}

h2 { margin: 0; padding: 0; }

a, li, ul {
  text-decoration: none;
  list-style-type: none;
  color: inherit;
  font-family: 'Poppins', Helvetica, sans-serif;
  font-weight: 400;
}

a:hover { color: var(--accent-blue-lighter); }

/* ── NAVIGATION ───────────────────────────────────────────────── */
.navtop {
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-blue-light));
  display: flex;
  box-shadow: var(--shadow-md);
}

.pfpcont { padding: var(--space-md); }

.pfp {
  width: 8rem;
  height: 8rem;
  border-radius: 50%;
  object-fit: cover;
  border: 0.2rem solid white;
  display: block;
}

.welcome { display: flex; flex-direction: row; }

.bighero {
  padding: var(--space-2xl);
  font-weight: 500;
  color: white;
}

.herocont {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding-left: var(--space-sm);
}

.hero,
.hero2 {
  padding: var(--space-xs);
  font-weight: 500;
  color: white;
}

.nav-cont {
  display: flex;
  min-height: 6rem;
  background: linear-gradient(180deg, #111827, #1e293b);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  width: 100%;
  justify-content: center;
  align-items: center;
  overflow: visible;
  position: relative;
  z-index: 50;
}

nav {
  background: #F9F9F9;
  width: 50%;
  margin-left: auto;
  min-height: 6rem;
}

.list {
  display: flex;
  flex-direction: row;
  gap: var(--space-md);
  justify-content: space-between;
  padding: var(--space-md);
  font-size: large;
}

nav a { transition: 0.3s ease; }
nav a:hover { color: var(--accent-blue); transform: translateY(-2px); }

.menu-toggle { display: none; }

/* ── MAIN LAYOUT ─────────────────────────────────────────────── */
.maindiv {
  display: flex;
  flex-direction: row;
  background: linear-gradient(135deg, var(--bg-dark), var(--bg-darker));
  min-height: calc(100dvh - 6rem);
  padding-bottom: var(--space-3xl);
  overflow: visible;
}

.wrapper {
  flex: 1;
  min-width: 0;
  color: var(--text-light);
  background: transparent;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.maintop { padding-top: var(--space-sm); }

.mainmiddle {
  padding-top: var(--space-2xl);
  padding-left: var(--space-sm);
  padding-right: var(--space-md);
  width: 100%;
  max-width: 100%;
}

.mainmiddle p,
.mainmiddle li {
  margin-bottom: var(--space-md);
}

/* Typing animation */
.mainmiddle .sentence1,
.mainmiddle .sentence2,
.mainmiddle .sentence3,
.mainmiddle .sentence4,
.mainmiddle .sentence5,
.mainmiddle .sentence6 {
  display: inline-block;
  white-space: nowrap;
  overflow: hidden;
  opacity: 1;
  clip-path: inset(0 100% 0 0);
  animation: typing 1.8s steps(50, end) forwards;
}

.mainmiddle .sentence1 { animation: typing 2s steps(70, end) 0s forwards; }
.mainmiddle .sentence2 { animation: typing 2s steps(70, end) 2.2s forwards; }
.mainmiddle .sentence3 { animation: typing 2s steps(70, end) 4.4s forwards; }
.mainmiddle .sentence4 { animation: typing 2s steps(70, end) 6.6s forwards; }
.mainmiddle .sentence5 { animation: typing 2s steps(70, end) 8.8s forwards; }
.mainmiddle .sentence6 { animation: typing 2s steps(70, end) 11s forwards; }

.mainmiddle .sentence4::after {
  content: "█";
  display: inline-block;
  margin-left: 4px;
  animation: blink 0.8s step-end infinite;
}

.mainmiddle i {
  margin-right: var(--space-sm);
  width: 20px;
  text-align: center;
  font-size: 1.1rem;
}

/* ── SIDEBAR ─────────────────────────────────────────────────── */
.side {
  width: 30%;
  min-width: 320px;
  color: var(--text-light);
  background: transparent;
  transition: 0.3s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.side-panel {
  background: linear-gradient(180deg, #1f3f70, var(--accent-blue));
  padding: var(--space-2xl);
  padding-bottom: var(--space-3xl);
  border-radius: var(--radius-lg);
  color: white;
  min-height: 100%;
  height: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.side-panel form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  max-width: 100%;
}

.side-panel input,
.side-panel textarea {
  padding: var(--space-sm);
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  width: 100%;
  font-size: 16px;
}

.side-panel textarea {
  min-height: 90px;
  resize: vertical;
}

.side-panel button {
  padding: var(--space-sm);
  border: none;
  border-radius: var(--radius-sm);
  background: white;
  color: var(--accent-blue);
  font-weight: bold;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ── FOOTER ──────────────────────────────────────────────────── */
.foot {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: black;
  color: var(--text-light);
  padding: var(--space-md);
  padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom));
  text-align: center;
  z-index: 999;
}

/* ── SENTENCENULL ────────────────────────────────────────────── */
.sentencenull {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  width: auto;
  animation: typing 2s steps(70, end) 0s forwards;
  color: var(--text-light);
  
}

.sentencenull::after {
  content: "█";
  margin-left: 6px;
  display: inline-block;
  animation: blink 0.75s step-end infinite;
}

/* ── GAME ────────────────────────────────────────────────────── */
.game {
  opacity: 0;
  -webkit-animation: fadeIn 1.5s ease forwards;
  animation: fadeIn 1.5s ease forwards;
}

.game-frame {
  width: 100%;
  max-width: 430px;
  aspect-ratio: 430 / 460;
  border: none;
  border-radius: var(--radius-md);
  display: block;
}

/* ── PROJECTS ────────────────────────────────────────────────── */
img[src$=".svg"] {
  filter: brightness(0) invert(1);
}

.project-card {
  margin-bottom: var(--space-md);
  border-radius: var(--radius-md);
  background: var(--text-light);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  width: 75%;
  margin-left: 6vh;
}

.project-card summary {
  padding: var(--space-md);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  background: #1f3f70;
  color: white;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: var(--space-sm);
  -webkit-tap-highlight-color: transparent;
}

.project-summary {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
}

.project-justify ul { list-style: disc !important; padding-left: 20px; color: var(--accent-blue-light) !important; }
.project-justify p { padding-left: 20px; color: var(--accent-blue-light) !important; }
.project-justify h3 { padding-left: 20px; color: var(--accent-blue-light) !important; }
.project-justify li { list-style: disc !important; }

.project-desc li { margin-bottom: 6px; }

.project-summary img {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  filter: brightness(0) invert(1);
}

.project-iframe {
  width: 100%;
  max-width: 430px;
  aspect-ratio: 430 / 460;
  border: none;
  border-radius: var(--radius-md);
  display: block;
}

.project-content {
  padding: var(--space-md);
  color: #245191;
}

.side-toggle { display: none; }

/* ── CV CONTAINER ────────────────────────────────────────────── */
.cv-container {
  width: 100%;
  height: calc(100vh - 140px);
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: stretch;
}

.cv-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.resume-header {
  padding: var(--space-lg);
}

/* ── CONTACT TYPING SYSTEM ───────────────────────────────────── */
.contact1,
.contact2,
.contact3,
.contact4,
.contact5,
.contact6 {
  display: inline-block;
  opacity: 0;
  white-space: wrap;
  overflow: auto;
  clip-path: inset(0 100% 0 0);
  animation: contactTyping 0.8s forwards;
}

.contact1 { animation-delay: 0s; }
.contact2 { animation-delay: 0.6s; }
.contact3 { animation-delay: 1.2s; }
.contact4 { animation-delay: 1.8s; }
.contact5 { animation-delay: 2.4s; }
.contact6 { animation-delay: 3s; }

.contact6::after {
  content: "█";
  margin-left: 6px;
  display: inline-block;
  animation: blink 0.8s step-end infinite;
}

/* ── KEYFRAMES ───────────────────────────────────────────────── */
@keyframes typing {
  from {
    clip-path: inset(0 100% 0 0);
    opacity: 1;
  }
  to {
    clip-path: inset(0 0 0 0);
    opacity: 1;
  }
}

@keyframes blink { 50% { opacity: 0; } }

@keyframes fadeInMobile {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes contactTyping {
  from {
    opacity: 0;
    clip-path: inset(0 100% 0 0);
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    clip-path: inset(0 0 0 0);
    transform: translateY(0);
  }
}

/* ── TABLET (≤768px) ─────────────────────────────────────────── */
@media (max-width: 768px) {
  nav { width: 60%; }
  .list { gap: var(--space-xs); font-size: medium; }

  .side { width: 35%; min-width: 260px; border-radius: var(--radius-sm); }
  .mainmiddle { padding-top: var(--space-2xl); }
  .herocont { min-width: 0; }

  .cards {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas: "about" "interests" "skills";
    gap: var(--radius-md);
    padding: var(--radius-md);
    width: 100%;
    box-sizing: border-box;
  }

  .card1, .card2, .card3 {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  .flexlist { flex-direction: column; gap: var(--space-sm); }
  .skills-list, .softskills { padding: var(--space-sm); width: 100%; }

  p { font-size: 0.95rem; line-height: 1.6; }
  h3 { font-size: 1.1rem; }
  
  .cv-container {
    height: calc(100dvh - 120px);
  }
}

/* ── MOBILE (≤480px) ─────────────────────────────────────────── */
@media (max-width: 480px) {
  body {
    overflow-y: auto;
    overflow-x: hidden;
  }

  input, textarea, select {
    font-size: 16px !important;
  }

  .game {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: var(--space-md);
  }

  .game iframe {
    width: 100%;
    max-width: 100%;
    height: 75vh;
    min-height: 600px;
    border: none;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #000;
    display: block;
  }

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

  .pfp { width: 6rem; height: 6rem; }

  .bighero { font-size: x-large; padding: var(--space-md); }

  .nav-cont {
    flex-wrap: wrap;
    height: auto;
    justify-content: space-between;
    align-items: flex-start;
    overflow: visible;
    position: relative;
    z-index: 100;
  }

  nav {
    width: 100%;
    margin-left: 0;
    height: auto;
    padding: var(--space-xs) 0;
  }

  .list {
    flex-direction: column;
    gap: var(--space-sm);
    font-size: small;
    padding: var(--space-md);
  }

  .menu-toggle {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    height: 48px;
    padding: 0 var(--space-md);
    background: none;
    border: none;
    color: white;
    font-size: var(--space-lg);
    margin-left: auto;
    cursor: pointer;
    z-index: 2000;
    -webkit-tap-highlight-color: transparent;
  }

  .site-nav { display: none; width: 100%; overflow: visible; }
  .nav-cont.active .site-nav { display: block; }

  .site-nav .list {
    display: flex;
    flex-direction: column;
    width: 100%;
    background: var(--text-light);
    position: relative;
    z-index: 1500;
  }

  .maindiv {
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, var(--bg-dark), var(--bg-darker));
    overflow: visible;
    min-height: auto;
    padding-bottom: var(--space-3xl);
  }

  .wrapper { width: 100%; order: 2; background: transparent; }

  .side {
    display: block;
    width: 100%;
    min-width: 0;
    background: var(--bg-darker);
    order: 1;
    overflow: visible;
  }

  .side-toggle {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    background: linear-gradient(90deg, #172033, #1f2937);
    color: white;
    border: none;
    padding: var(--space-md);
    padding-bottom: var(--space-sm);
    font-size: var(--space-md);
    font-family: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .side-panel {
    display: none;
    padding: var(--space-md);
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, #1b355d, var(--accent-blue));
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .side.active .side-panel { display: block; }

  .mainmiddle {
    padding-top: var(--space-2xl);
    padding-left: var(--space-md);
    padding-right: var(--space-md);
    padding-bottom: var(--space-2xl);
  }

  .mainmiddle .sentence1,
  .mainmiddle .sentence2,
  .mainmiddle .sentence3,
  .mainmiddle .sentence4,
  .mainmiddle .sentence5,
  .mainmiddle .sentence6 {
    display: block;
    opacity: 0;
    transform: translateY(8px);
    white-space: normal;
    overflow: visible;
    clip-path: none;
    animation: fadeInMobileOnly 0.6s ease forwards;
  }

  .mainmiddle .sentence1 { animation-delay: 0.2s; }
  .mainmiddle .sentence2 { animation-delay: 0.6s; }
  .mainmiddle .sentence3 { animation-delay: 1.0s; }
  .mainmiddle .sentence4 { animation-delay: 1.4s; }
  .mainmiddle .sentence5 { animation-delay: 1.8s; }
  .mainmiddle .sentence6 { animation-delay: 2.2s; }

  .mainmiddle .sentence1::after,
  .mainmiddle .sentence2::after,
  .mainmiddle .sentence3::after,
  .mainmiddle .sentence4::after,
  .mainmiddle .sentence5::after,
  .mainmiddle .sentence6::after {
    content: "";
    display: none;
  }

    .mainmiddle .sentence4::after{

    content: "█";
  margin-left: 6px;
  display: inline-block;
  animation: blink 0.75s step-end infinite;
    }

  .sentencenull {
    width: auto;
    opacity: 0;
    white-space: normal;
    overflow: visible;
    -webkit-animation: fadeInMobile 0.6s ease forwards;
    animation: fadeInMobile 0.6s ease forwards;
  }

  .sentencenull::after {
  content: "█";
  margin-left: 6px;
  display: inline-block;
  animation: blink 0.75s step-end infinite;
  }

  .project-card {
    width: 100%;
    margin-left: 0;
  }

  .cv-container {
    height: calc(100dvh - 90px);
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: hidden;
  }

  .cv-frame {
    width: 100%;
    height: 100%;
    border: none;
    transform: scale(1.08);
    transform-origin: top center;
    -webkit-transform: scale(1.08);
    -webkit-transform-origin: top center;
  }

  body {
    overscroll-behavior: none;
  }
}

@keyframes fadeInMobileOnly {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
