/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0d2b3e;
  --accent:     #29bcd8;
  --accent-dk:  #1fa3bd;
  --page-l:     #ebebeb;
  --page-r:     #f0f0f0;
  --text:       #2c2c2c;
  --muted:      #666;
  --tl-line:    #29bcd8;
}

html, body {
  width: 100%; height: 100%;
  font-family: 'Segoe UI', sans-serif;
  background: var(--bg);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

/* =============================================
   SCENE / BOOK
   ============================================= */
.scene { perspective: 2000px; }

.book {
  position: relative;
  width: 860px;
  height: 540px;
}

/* =============================================
   SPREAD
   ============================================= */
.spread {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: row;
  border: 4px solid var(--accent);
  border-radius: 3px;
  overflow: hidden;
  box-shadow:
    0 24px 60px rgba(0,0,0,.6),
    0 0 0 1px rgba(41,188,216,.3);
  transform-style: preserve-3d;
}
.spread.active { display: flex; }

/* =============================================
   PAGE
   ============================================= */
.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.page-left  { background: linear-gradient(to right, #e4e4e4, #ebebeb); }
.page-right { background: linear-gradient(to right, #ebebeb, #e4e4e4); }

/* spine shadow */
.page-left::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 3px; height: 100%;
  background: linear-gradient(to right, rgba(0,0,0,.08), transparent);
  z-index: 10;
}

/* =============================================
   PAGE CONTENT
   ============================================= */
.page-content {
  flex: 1;
  padding: 26px 28px 10px;
  overflow-y: auto;
}
.page-content::-webkit-scrollbar { width: 3px; }
.page-content::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

/* =============================================
   PAGE FOOTERS
   ============================================= */
.page-footer {
  display: flex;
  align-items: center;
  padding: 7px 14px;
  min-height: 42px;
  border-top: 1px solid #d8d8d8;
}

/* About page — no number, no arrows, just blank space */
.page-footer-empty {
  border-top: 1px solid #d8d8d8;
}

/* Left pages: "< arrow ··· number" — arrow far left, number centred */
.footer-left-nav {
  justify-content: flex-start;
  gap: 0;
}
.footer-left-nav .page-num {
  flex: 1;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

/* Right pages: "number  >arrow" — number then arrow pushed right */
.footer-right-only {
  justify-content: flex-end;
  gap: 10px;
}
.footer-right-only .page-num {
  font-size: 13px;
  color: var(--muted);
}

/* Contact footer: "< number [person-icon]" */
.footer-contact {
  justify-content: space-between;
  align-items: center;
}
.footer-contact .page-num {
  font-size: 13px;
  color: var(--muted);
}

/* =============================================
   NAV BUTTONS
   ============================================= */
.nav-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent);
  font-size: 15px;
  padding: 4px 7px;
  border-radius: 4px;
  transition: background .18s, color .18s;
  flex-shrink: 0;
}
.nav-btn:hover { background: var(--accent); color: #fff; }

/* Person icon button on contact page */
.home-btn {
  background: #ddd;
  color: var(--text);
  border-radius: 6px;
  font-size: 13px;
  padding: 5px 9px;
}
.home-btn:hover { background: var(--accent); color: #fff; }

/* =============================================
   SECTION TITLE
   ============================================= */
.section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin-bottom: 18px;
}

/* =============================================
   ABOUT
   ============================================= */
.about-content { text-align: center; }

.avatar-wrap {
  margin: 0 auto 10px;
  width: 112px; height: 112px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  padding: 3px;
  background: #fff;
  overflow: hidden;
}
.avatar { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.name { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.role { font-size: 14px; font-weight: 600; color: var(--accent); margin-bottom: 10px; }

.socials { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; }
.socials a {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  font-size: 13px;
  text-decoration: none;
  transition: background .18s, color .18s;
}
.socials a:hover { background: var(--accent); color: #fff; }

.bio {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 18px;
  text-align: left;
}

.btn-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* =============================================
   BUTTONS
   ============================================= */
.btn {
  padding: 8px 20px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
  border: 2px solid var(--accent);
}
.btn-filled  { background: var(--accent); color: #fff; }
.btn-filled:hover { background: var(--accent-dk); border-color: var(--accent-dk); }
.btn-outline { background: transparent; color: var(--text); }
.btn-outline:hover { background: var(--accent); color: #fff; }
.btn-sm   { padding: 5px 14px; font-size: 12px; }
.btn-full { width: 100%; }

/* =============================================
   TIMELINE
   ============================================= */
.timeline { position: relative; padding-left: 16px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 6px; top: 7px; bottom: 7px;
  width: 2px;
  background: var(--tl-line);
}

.timeline-item { display: flex; gap: 14px; margin-bottom: 18px; position: relative; }

.tl-dot {
  flex-shrink: 0;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 3px;
  z-index: 1;
  position: relative;
  box-shadow: 0 0 0 3px rgba(41,188,216,.22);
}

.tl-date {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  display: block;
  margin-bottom: 3px;
}
.tl-date i { margin-right: 5px; }
.tl-body h3 { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.tl-body p  { font-size: 11.5px; color: var(--muted); line-height: 1.55; }

/* =============================================
   SERVICES GRID
   ============================================= */
.services-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.service-card {
  border: 1.5px solid var(--accent);
  border-radius: 8px;
  padding: 14px 12px;
  text-align: center;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.service-icon { font-size: 22px; color: var(--accent); }
.service-card h4 { font-size: 13px; font-weight: 700; color: var(--text); }
.service-card p  { font-size: 11px; color: var(--muted); line-height: 1.5; flex: 1; }

/* =============================================
   SKILLS
   ============================================= */
.skills-cat {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin: 10px 0 7px;
}

.skills-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 2px; }

.skill-card {
  width: 70px; height: 70px;
  border: 1.5px solid var(--accent);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: #fff;
  font-size: 10.5px;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background-color .2s ease;
}
.skill-card i { font-size: 24px; color: var(--accent); }

.skill-card:hover {
  transform: translateY(-4px);
  border-color: var(--text);
  background: #fffdf8;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .12);
}

.skill-card:hover i,
.skill-card:hover .a-letter,
.skill-card:hover .php-text {
  transform: scale(1.05);
}

.skill-card i,
.skill-card .a-letter,
.skill-card .php-text {
  transition: transform .2s ease, color .2s ease;
}

.angular-icon .a-letter {
  font-size: 22px; font-weight: 900;
  color: #dd1b16; font-family: serif; line-height: 1;
}
.php-icon .php-text {
  font-size: 17px; font-weight: 700;
  color: #777bb3; font-family: monospace;
}
.spring-boot-icon i { color: #6db33f; }
.mysql-icon i { color: #4479a1; }
.postgres-icon i { color: #336791; }
.mongodb-icon i { color: #47a248; }
.java-icon i { color: #f89820; }
.node-icon i { color: #3c873a; }

/* =============================================
   LATEST PROJECT
   ============================================= */
.project-img-wrap {
  width: 100%; height: 158px;
  border-radius: 6px; overflow: hidden;
  margin-bottom: 10px;
  border: 1px solid #ddd;
}
.project-img { width: 100%; height: 100%; object-fit: cover; }

.project-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.project-name { font-size: 15px; font-weight: 700; color: var(--text); }
.live-preview  {
  font-size: 12px; color: var(--accent);
  text-decoration: none; font-weight: 600;
}
.live-preview:hover { text-decoration: underline; }
.live-preview i { font-size: 10px; margin-left: 3px; }

.project-tech { font-size: 12.5px; color: var(--text); margin-bottom: 2px; }
.project-desc { font-size: 12px; color: var(--muted); line-height: 1.55; margin-bottom: 14px; }

/* =============================================
   CONTACT
   ============================================= */
.contact-content .section-title { text-align: left; }

.contact-form { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }

.form-input, .form-textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #ccc;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  background: #f5f5f5;
  font-family: inherit;
  transition: border-color .2s;
}
.form-input:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.form-textarea { height: 165px; resize: vertical; }

/* =============================================
   BACK COVER  (solid cyan right page on contact spread)
   ============================================= */
.back-cover {
  background: var(--accent) !important;
  border-left: 1px solid rgba(255,255,255,.25);
}

/* =============================================
   PAGE FLIP ANIMATION
   ============================================= */
.page-right {
  transform-origin: left center;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  will-change: transform;
}

.page-left {
  transform-origin: right center;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  will-change: transform;
}

.page-right::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,.02) 0%, rgba(0,0,0,.05) 30%, transparent 100%);
  pointer-events: none;
  z-index: 2;
}

.page-left::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(270deg, rgba(0,0,0,.04) 0%, transparent 35%);
  pointer-events: none;
  z-index: 2;
}

@keyframes page-turn-next {
  0%   { transform: rotateY(0deg) translateZ(0); box-shadow: inset -8px 0 20px rgba(0,0,0,.05); }
  20%  { transform: rotateY(-14deg) translateZ(0); box-shadow: inset -10px 0 24px rgba(0,0,0,.08); }
  45%  { transform: rotateY(-58deg) scale(1.008); box-shadow: inset -24px 0 34px rgba(0,0,0,.14); }
  70%  { transform: rotateY(-112deg) scale(1.004); box-shadow: inset -16px 0 28px rgba(0,0,0,.08); }
  100% { transform: rotateY(-180deg) translateZ(0); box-shadow: inset -8px 0 20px rgba(0,0,0,.05); }
}

@keyframes page-turn-prev {
  0%   { transform: rotateY(0deg) translateZ(0); box-shadow: inset -8px 0 20px rgba(0,0,0,.05); }
  20%  { transform: rotateY(14deg) translateZ(0); box-shadow: inset 10px 0 24px rgba(0,0,0,.08); }
  45%  { transform: rotateY(58deg) scale(1.008); box-shadow: inset 24px 0 34px rgba(0,0,0,.14); }
  70%  { transform: rotateY(112deg) scale(1.004); box-shadow: inset 16px 0 28px rgba(0,0,0,.08); }
  100% { transform: rotateY(180deg) translateZ(0); box-shadow: inset -8px 0 20px rgba(0,0,0,.05); }
}

.page-right.page-turn-next { animation: page-turn-next 1.05s cubic-bezier(.15,.75,.25,1) forwards; }
.page-left.page-turn-prev { animation: page-turn-prev 1.05s cubic-bezier(.15,.75,.25,1) forwards; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1100px) {
  .book {
    width: min(94vw, 860px);
    height: min(72vw, 540px);
    max-height: 540px;
  }

  .page-content {
    padding: 22px 22px 8px;
  }

  .section-title {
    font-size: 18px;
    margin-bottom: 14px;
  }

  .avatar-wrap {
    width: 102px;
    height: 102px;
  }

  .name {
    font-size: 20px;
  }

  .bio,
  .tl-body p,
  .service-card p,
  .project-desc,
  .project-tech {
    font-size: 11.5px;
  }
}

@media (max-width: 768px) {
  html, body {
    height: auto;
    min-height: 100%;
    overflow-y: auto;
    align-items: flex-start;
  }

  body {
    padding: 14px 10px 18px;
  }

  .scene {
    width: 100%;
  }

  .book {
    width: 100%;
    height: auto;
    max-height: none;
  }

  .spread {
    position: relative;
    flex-direction: column;
    min-height: auto;
  }

  .page {
    min-height: 0;
  }

  .page-content {
    overflow-y: visible;
    padding: 18px 16px 10px;
  }

  .page-footer {
    min-height: 38px;
    padding: 6px 10px;
  }

  .page-left::after {
    width: 0;
  }

  .page-right,
  .page-left {
    transform-origin: center center;
  }

  .page-footer-empty,
  .footer-left-nav,
  .footer-right-only,
  .footer-contact {
    justify-content: space-between;
  }

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

  .service-card {
    padding: 12px 10px;
  }

  .skills-grid {
    justify-content: center;
  }

  .skill-card {
    width: 76px;
    height: 76px;
  }

  .project-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .contact-content .section-title {
    text-align: center;
  }

  .timeline {
    padding-left: 12px;
  }

  .timeline-item {
    gap: 10px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 10px 8px 14px;
  }

  .book {
    width: 100%;
  }

  .spread {
    border-width: 3px;
  }

  .page-content {
    padding: 16px 12px 8px;
  }

  .section-title {
    font-size: 17px;
    margin-bottom: 12px;
  }

  .avatar-wrap {
    width: 92px;
    height: 92px;
  }

  .name {
    font-size: 18px;
  }

  .role {
    font-size: 13px;
  }

  .socials {
    flex-wrap: wrap;
  }

  .btn-row {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .services-grid,
  .skills-grid {
    gap: 10px;
  }

  .skill-card {
    width: 72px;
    height: 72px;
  }

  .service-card h4,
  .tl-body h3,
  .project-name {
    font-size: 12.5px;
  }

  .form-input,
  .form-textarea {
    font-size: 12px;
    padding: 10px 12px;
  }
}
