/* ============================================================
   Thisaga Dewjan Kadupitiya  | Thisaga.com
   ============================================================ */

:root {
  --bg:        #000000;
  --ink:       #ffffff;
  --ink-soft:  rgba(255,255,255,0.62);
  --ink-mute:  rgba(255,255,255,0.40);
  --line:      rgba(255,255,255,0.13);
  --line-2:    rgba(255,255,255,0.26);

  /* portrait arch lighting */
  --arch-blue: radial-gradient(120% 90% at 50% 28%, #2a5fae 0%, #163a78 34%, #0a1d3e 64%, #060f22 100%);
  --arch-teal: radial-gradient(120% 90% at 50% 30%, #4f9aa6 0%, #2c6470 36%, #16323c 66%, #0a1a20 100%);

  /* set --portrait to url("me.png") on :root to fill every slot at once */
  --portrait: none;

  --display: "Manrope", system-ui, sans-serif;
  --mono: "Space Mono", ui-monospace, monospace;
  --script: "Dancing Script", cursive;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --maxw: 1240px;
  --pad: clamp(1.25rem, 5vw, 5rem);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--display); line-height: 1.5; letter-spacing: 0.005em;
  overflow-x: hidden; -webkit-font-smoothing: antialiased;
}
::selection { background: #fff; color: #000; }
a { color: inherit; text-decoration: none; }

/* ---- progress + cursor ---- */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 70; background: #fff; opacity: 0.85; transform: scaleX(0); transform-origin: 0 50%; will-change: transform; }
.cursor { position: fixed; top: 0; left: 0; width: 12px; height: 12px; border-radius: 50%; background: #fff; mix-blend-mode: difference; pointer-events: none; z-index: 80; transform: translate3d(-50%,-50%,0); transition: width 0.25s var(--ease), height 0.25s var(--ease); opacity: 0; will-change: transform; }
.cursor.is-active { opacity: 1; }
.cursor.is-hover { width: 46px; height: 46px; }

/* shared micro label */
.label { display: inline-block; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.28em; text-transform: uppercase; color: var(--ink-mute); }

/* ============================================================
   NAV
   ============================================================ */
.nav { position: fixed; top: 0; left: 0; right: 0; z-index: 60; display: flex; align-items: center; justify-content: space-between; padding: 1.5rem var(--pad); transition: padding 0.5s var(--ease), background 0.5s var(--ease); }
.nav.is-stuck { padding-top: 1rem; padding-bottom: 1rem; background: rgba(0,0,0,0.5); backdrop-filter: blur(12px); }
.nav__brand { font-family: var(--display); font-weight: 800; font-size: 1.35rem; letter-spacing: -0.02em; }
.nav__brand span { color: var(--ink-mute); }
.nav__links { display: flex; gap: 2rem; }
.nav__links a { font-size: 0.95rem; font-weight: 500; color: var(--ink-soft); position: relative; transition: color 0.3s var(--ease); }
.nav__links a::after { content: ""; position: absolute; left: 0; bottom: -4px; height: 1.5px; width: 0; background: #fff; transition: width 0.4s var(--ease); }
.nav__links a:hover { color: #fff; }
.nav__links a:hover::after { width: 100%; }
.nav__toggle { display: none; flex-direction: column; gap: 6px; background: none; border: none; cursor: pointer; padding: 6px; }
.nav__toggle span { width: 26px; height: 2px; background: #fff; transition: transform 0.4s var(--ease), opacity 0.3s; }
.nav__toggle.is-open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav__toggle.is-open span:nth-child(2) { transform: rotate(-45deg); }
.mobile-menu { position: fixed; inset: 0; z-index: 55; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.6rem; opacity: 0; pointer-events: none; transform: translateY(-10px); transition: opacity 0.4s var(--ease), transform 0.4s var(--ease); }
.mobile-menu.is-open { opacity: 1; pointer-events: auto; transform: none; }
.mobile-menu a { font-family: var(--display); font-weight: 700; font-size: 2rem; letter-spacing: -0.02em; }

/* ============================================================
   PORTRAIT ARCH (shared) — taller frame, gentler curve
   ============================================================ */
.arch { position: relative; width: clamp(220px, 27vw, 380px); height: clamp(360px, 48vw, 620px); will-change: transform; }
.arch__inner { width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.2s var(--ease); }
.portrait-media {
  position: relative; width: 100%; height: 100%; overflow: hidden;
  border-radius: 46% 46% 12% 12% / 22% 22% 4% 4%;
  background: var(--arch-blue);
  background-image: var(--portrait), var(--arch-blue);
  background-size: cover; background-position: center;
  box-shadow: 0 60px 120px -50px rgba(34,90,180,0.5), inset 0 0 60px rgba(0,0,0,0.4);
}
.portrait-media--teal { border-radius: 22px; background: var(--arch-teal); background-image: var(--portrait), var(--arch-teal); box-shadow: 0 60px 120px -50px rgba(60,140,150,0.45); }
.portrait-media__ph { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.45rem; text-align: center; padding: 1.5rem; transform: translateZ(40px); }
.ph__ring { width: 54px; height: 54px; border-radius: 50%; border: 1px dashed rgba(255,255,255,0.4); position: relative; margin-bottom: 0.5rem; }
.ph__ring::after { content: "+"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 1.4rem; }
.ph__hint { font-size: 0.9rem; color: rgba(255,255,255,0.85); }
.ph__sub { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(255,255,255,0.5); }

/* ============================================================
   HERO
   ============================================================ */
.hero { position: relative; min-height: 100svh; display: flex; align-items: center; justify-content: center; padding: 7rem var(--pad) 4.5rem; overflow: hidden; perspective: 1300px; }
.hero__scene { position: relative; display: flex; flex-direction: column; align-items: center; width: 100%; max-width: var(--maxw); }

.hero__name {
  position: relative; z-index: 3;
  margin-top: clamp(-120px, -11vh, -70px);
  font-family: var(--display); font-weight: 800;
  font-size: clamp(2.6rem, 10vw, 9rem); line-height: 0.86;
  letter-spacing: -0.045em; text-align: center; color: #fff;
  text-shadow: 0 30px 70px rgba(0,0,0,0.6);
  will-change: transform;
}
.hero__name .nl { display: block; }
.hero__name .w { display: inline-block; opacity: 0; transform: translateY(0.5em); transition: opacity 0.7s var(--ease), transform 0.95s var(--ease); }
.hero__name.is-in .w { opacity: 1; transform: none; }
.hero__name.is-in .nl:nth-child(1) .w:nth-child(1) { transition-delay: 0.05s; }
.hero__name.is-in .nl:nth-child(1) .w:nth-child(2) { transition-delay: 0.13s; }
.hero__name.is-in .nl:nth-child(2) .w:nth-child(1) { transition-delay: 0.21s; }

.hero__tag { position: relative; z-index: 3; margin-top: 1.6rem; text-align: center; }
.hero__role { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 0.6rem; }
.hero__lede { font-size: clamp(0.95rem, 1.6vw, 1.15rem); color: var(--ink-soft); }

.hero__corner { position: absolute; bottom: 1.8rem; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-mute); }
.hero__corner--l { left: var(--pad); }
.hero__corner--r { right: var(--pad); }

/* ============================================================
   SECTION SCAFFOLD
   ============================================================ */
.section { position: relative; z-index: 2; max-width: var(--maxw); margin: 0 auto; padding: clamp(5rem, 12vw, 10rem) var(--pad); }
.sec-head { margin-bottom: clamp(2.5rem, 5vw, 4.5rem); }
.sec-head .label { margin-bottom: 1.4rem; }
.sec-title { font-family: var(--display); font-weight: 700; font-size: clamp(2.4rem, 6.5vw, 5.5rem); line-height: 0.98; letter-spacing: -0.035em; max-width: 16ch; }
.sec-title--alt { font-weight: 300; font-size: clamp(2rem, 4.6vw, 3.6rem); letter-spacing: -0.02em; color: var(--ink-soft); }

/* split words */
[data-split] { perspective: 700px; }
.split-word { display: inline-block; opacity: 0; transform: translateY(0.6em) rotateX(-35deg); transform-origin: 50% 100%; transition: opacity 0.7s var(--ease), transform 0.9s var(--ease); transition-delay: calc(var(--i) * 0.05s); }
[data-anim="rise"].is-in .split-word { opacity: 1; transform: none; }

/* ============================================================
   VENTURES — editorial project rows
   ============================================================ */
.projects { border-top: 1px solid var(--line); }
.proj { display: grid; grid-template-columns: 56px 1fr auto 40px; align-items: center; gap: 1.5rem; padding: 2.2rem 0.5rem; border-bottom: 1px solid var(--line); transition: padding 0.4s var(--ease), background 0.4s var(--ease); }
.proj:hover { padding-left: 1.4rem; padding-right: 1.4rem; background: rgba(255,255,255,0.02); }
.proj__idx { font-family: var(--mono); font-size: 0.8rem; color: var(--ink-mute); }
.proj__title { display: block; font-family: var(--display); font-weight: 700; font-size: clamp(1.7rem, 3.6vw, 2.9rem); letter-spacing: -0.03em; line-height: 1.05; transition: transform 0.4s var(--ease); }
.proj__desc { display: block; color: var(--ink-soft); font-size: 0.98rem; max-width: 46ch; margin-top: 0.5rem; }
.proj__tags { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-mute); white-space: nowrap; }
.proj__arrow { font-size: 1.4rem; color: var(--ink-soft); justify-self: end; transition: transform 0.4s var(--ease), color 0.4s var(--ease); }
.proj:hover .proj__title { transform: translateX(8px); }
.proj:hover .proj__arrow { transform: translate(5px,-5px); color: #fff; }

/* ============================================================
   HIGHLIGHTS
   ============================================================ */
.timeline { border-top: 1px solid var(--line); }
.trow { display: grid; grid-template-columns: 220px 1fr; gap: 2rem; padding: 2.2rem 0; border-bottom: 1px solid var(--line); transition: background 0.4s var(--ease); }
.trow:hover { background: rgba(255,255,255,0.02); }
.trow__label { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-mute); padding-top: 0.4rem; }
.trow__body h3 { font-family: var(--display); font-weight: 700; font-size: 1.5rem; letter-spacing: -0.02em; margin-bottom: 0.4rem; }
.trow__body p { color: var(--ink-soft); font-size: 1rem; max-width: 54ch; }

/* ============================================================
   ABOUT — image left, text right (editorial)
   signature now sits UNDER the text, not over the image
   ============================================================ */
.about { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 6vw, 6rem); align-items: center; }
.about__media { will-change: transform; }
.about__inner { position: relative; transform-style: preserve-3d; transition: transform 0.2s var(--ease); }
.about__media .portrait-media { height: clamp(420px, 52vw, 640px); border-radius: 24px; }
.about__text .label { margin-bottom: 1.8rem; }
.about__statement { font-family: var(--display); font-weight: 700; font-size: clamp(1.7rem, 3.2vw, 2.7rem); line-height: 1.18; letter-spacing: -0.025em; margin-bottom: 2.4rem; }
.about__p { color: var(--ink-soft); font-size: 1.05rem; line-height: 1.6; margin-bottom: 1.2rem; max-width: 52ch; }
.about__sign { display: block; font-family: var(--script); font-weight: 600; font-size: 2.4rem; color: #fff; margin-top: 1.6rem; }

/* ============================================================
   CAPABILITIES
   ============================================================ */
.caps { list-style: none; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.caps li { display: flex; align-items: baseline; gap: 1rem; font-family: var(--display); font-weight: 600; font-size: clamp(1.3rem, 2.6vw, 2.1rem); letter-spacing: -0.02em; padding: 1.8rem 1.8rem; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); transition: background 0.4s var(--ease), padding-left 0.4s var(--ease); }
.caps li span { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em; color: var(--ink-mute); font-weight: 400; }
.caps li:hover { background: rgba(255,255,255,0.03); padding-left: 2.3rem; }

/* ============================================================
   CONTACT — giant statement over portrait (reference finale)
   ============================================================ */
.contact { position: relative; padding: clamp(5rem, 10vw, 9rem) var(--pad) 4rem; overflow: hidden; perspective: 1300px; }
.contact__scene { position: relative; display: flex; justify-content: center; align-items: center; min-height: 70vh; }
.arch--contact { position: absolute; top: 44%; left: 50%; transform: translate(-50%,-50%); z-index: 1; }
.contact__big {
  position: relative; z-index: 3; text-align: center;
  font-family: var(--display); font-weight: 800;
  font-size: clamp(2.6rem, 11vw, 10rem); line-height: 0.86;
  letter-spacing: -0.04em; color: #fff; text-transform: uppercase;
  text-shadow: 0 30px 70px rgba(0,0,0,0.6);
}
.contact__big .nl { display: block; }
.contact__big .w { display: inline-block; opacity: 0; transform: translateY(0.5em); transition: opacity 0.7s var(--ease), transform 0.95s var(--ease); }
.contact__big.is-in .w { opacity: 1; transform: none; }
.contact__big.is-in .nl:nth-child(1) .w:nth-child(1){transition-delay:.05s}
.contact__big.is-in .nl:nth-child(1) .w:nth-child(2){transition-delay:.12s}
.contact__big.is-in .nl:nth-child(2) .w:nth-child(1){transition-delay:.19s}
.contact__big.is-in .nl:nth-child(2) .w:nth-child(2){transition-delay:.26s}
.contact__big.is-in .nl:nth-child(3) .w:nth-child(1){transition-delay:.33s}
.contact__cta { text-align: center; margin-top: 2.5rem; }
.contact__mail { font-family: var(--display); font-weight: 600; font-size: clamp(1.3rem, 3vw, 2.2rem); letter-spacing: -0.02em; border-bottom: 2px solid var(--line-2); padding-bottom: 6px; transition: border-color 0.4s var(--ease); }
.contact__mail:hover { border-color: #fff; }

/* ============================================================
   FOOTER
   ============================================================ */
.footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; max-width: var(--maxw); margin: 0 auto; padding: 2.5rem var(--pad) 3rem; border-top: 1px solid var(--line); }
.footer__brand { font-family: var(--display); font-weight: 800; font-size: 1.2rem; letter-spacing: -0.02em; }
.footer__brand span { color: var(--ink-mute); }
.footer__copy { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.08em; color: var(--ink-mute); }
.footer__social { display: flex; gap: 1.4rem; }
.footer__social a { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft); transition: color 0.3s var(--ease); }
.footer__social a:hover { color: #fff; }

/* ============================================================
   REVEALS
   ============================================================ */
[data-reveal] { opacity: 0; transform: translateY(26px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
[data-reveal].is-in { opacity: 1; transform: none; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 880px) {
  .about { grid-template-columns: 1fr; gap: 2.5rem; }
  .proj { grid-template-columns: 40px 1fr 32px; }
  .proj__tags { display: none; }
  .trow { grid-template-columns: 1fr; gap: 0.5rem; }
  .trow__label { padding-top: 0; }
  .caps { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .nav__links { display: none; }
  .nav__toggle { display: flex; }
  .hero__name { margin-top: clamp(-90px, -10vh, -50px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0.001ms !important; }
  [data-reveal], .split-word, .hero__name .w, .contact__big .w { opacity: 1 !important; transform: none !important; }
  html { scroll-behavior: auto; }
  .cursor { display: none; }
}

a:focus-visible, button:focus-visible { outline: 2px solid #fff; outline-offset: 3px; border-radius: 4px; }

/* ============================================================
   IMAGES 
   ============================================================ */

/* Hero portrait (also used in the Contact arch) */
#heroArch .portrait-media,
#contactArch .portrait-media {
  background-image: url("me.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* About portrait */
.about__media .portrait-media {
  background-image: url("about.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.portrait-media__ph { display: none; }


/* ============================================================
   PRELOADER — matches the Thisaga.com wordmark
   ============================================================ */
   .preloader {
      position: fixed; inset: 0; z-index: 200;
      display: flex; flex-direction: column; align-items: center; justify-content: center;
      gap: 1.6rem; background: #000;
      transition: opacity 0.7s var(--ease), visibility 0.7s var(--ease);
    }
    .preloader.is-done { opacity: 0; visibility: hidden; }
    .preloader__brand {
      font-family: var(--display); font-weight: 800; font-size: clamp(1.8rem, 6vw, 3rem);
      letter-spacing: -0.02em; color: #fff; opacity: 0;
      transform: translateY(14px);
      animation: preIn 0.8s var(--ease) 0.1s forwards;
    }
    .preloader__brand span { color: var(--ink-mute); }
    @keyframes preIn { to { opacity: 1; transform: none; } }
    .preloader__bar { width: clamp(120px, 30vw, 220px); height: 2px; background: rgba(255,255,255,0.16); overflow: hidden; border-radius: 2px; }
    .preloader__bar span { display: block; height: 100%; width: 100%; background: #fff; transform: translateX(-100%); animation: preBar 1.4s var(--ease) 0.2s forwards; }
    @keyframes preBar { to { transform: translateX(0); } }
    
    /* ============================================================
       CONTACT SOCIAL — futuristic 3D flip links above the email
       ============================================================ */
    .contact__social {
      display: flex; justify-content: center; flex-wrap: wrap;
      gap: clamp(1.2rem, 4vw, 2.6rem); margin-bottom: 2.4rem;
      perspective: 600px;
    }
    .contact__social a {
      position: relative; display: inline-block;
      font-family: var(--mono); font-size: 0.82rem; letter-spacing: 0.18em;
      text-transform: uppercase; color: var(--ink-soft);
      padding: 0.2rem 0; transform-style: preserve-3d;
      transition: color 0.4s var(--ease), transform 0.5s var(--ease);
    }
    .contact__social a span { display: inline-block; transition: transform 0.5s var(--ease); }
    .contact__social a::after {
      content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 1px;
      background: #fff; transform: scaleX(0); transform-origin: left; transition: transform 0.45s var(--ease);
    }
    .contact__social a:hover {
      color: #fff; transform: translateY(-3px) rotateX(12deg);
    }
    .contact__social a:hover span { transform: translateZ(14px); }
    .contact__social a:hover::after { transform: scaleX(1); }
    
    /* ============================================================
       MOBILE FIXES — name overlap + centered footer
       ============================================================ */
    @media (max-width: 640px) {
      /* name no longer crashes into the portrait */
      .hero__name {
        margin-top: clamp(-56px, -7vh, -40px);
        font-size: clamp(2.2rem, 12vw, 3.4rem);
        line-height: 0.92;
      }
      .hero__tag { margin-top: 2rem; }
      .arch { height: clamp(380px, 90vw, 520px); }
    
      /* footer stacks and centers nicely */
      .footer {
        flex-direction: column; align-items: center; text-align: center;
        gap: 1.4rem; padding-bottom: 3.5rem;
      }
      .footer__copy { max-width: 30ch; }
      .footer__social { justify-content: center; flex-wrap: wrap; gap: 1.6rem; }
    
      /* contact socials breathe on small screens */
      .contact__social { gap: 1.4rem 2rem; }
    }
