/* =============================================================
   Chidanandan P — Portfolio
   Dark cinematic system, rooted in Maersk Design System
   ============================================================= */

:root {
  /* Canvas — warm near-black */
  --bg:           #0A0B0C;
  --bg-1:         #101214;   /* raised panel */
  --bg-2:         #16191C;   /* card */
  --bg-3:         #1E2226;   /* hover / inset */
  --line:         rgba(236, 234, 228, 0.10);
  --line-strong:  rgba(236, 234, 228, 0.18);

  /* Ink — warm off-white */
  --fg:           #ECEAE4;
  --fg-soft:      #B7B5AE;
  --fg-mute:      #7E7D78;
  --fg-faint:     #55554F;

  /* Accents */
  --accent:       #42B0D5;   /* Maersk cyan — primary / tech */
  --accent-soft:  #6FC3DF;
  --accent-deep:  #1B7FA3;
  --sand:         #C8A97E;   /* warm architectural secondary */
  --sand-soft:    #DCC4A0;

  --accent-rgb:   66, 176, 213;
  --sand-rgb:     200, 169, 126;

  /* Type */
  --display: "Maersk Headline", "Maersk Text", -apple-system, sans-serif;
  --body:    "Maersk Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono:    "Roboto Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Motion */
  --ease:    cubic-bezier(0.22, 0.61, 0.18, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
  --m: 1; /* motion intensity multiplier (tweakable) */

  /* Layout */
  --maxw: 1280px;
  --gut:  clamp(20px, 5vw, 80px);
}

/* Accent palette swap (tweakable) */
:root[data-accent="sand"]   { --accent: #C8A97E; --accent-soft: #DCC4A0; --accent-deep: #9E7E4F; --accent-rgb: 200,169,126; }
:root[data-accent="green"]  { --accent: #6BBF8A; --accent-soft: #8FD3A8; --accent-deep: #3E8C5E; --accent-rgb: 107,191,138; }
:root[data-accent="amber"]  { --accent: #E0A94A; --accent-soft: #EEC079; --accent-deep: #B07F2A; --accent-rgb: 224,169,74; }

/* Light mode (tweakable) */
:root[data-mode="light"] {
  --bg: #F4F2EC; --bg-1: #FBFAF6; --bg-2: #FFFFFF; --bg-3: #EDEAE2;
  --line: rgba(20,20,20,0.10); --line-strong: rgba(20,20,20,0.18);
  --fg: #16181A; --fg-soft: #3D3F42; --fg-mute: #6A6C6E; --fg-faint: #A6A6A2;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--fg);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  cursor: none;
}
@media (max-width: 820px) { body { cursor: auto; } }

::selection { background: rgba(var(--accent-rgb), 0.30); color: #fff; }

h1,h2,h3,h4 { font-family: var(--display); font-weight: 500; letter-spacing: -0.02em; line-height: 1.02; }

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: none; border: none; background: none; color: inherit; }
@media (max-width: 820px) { button { cursor: pointer; } }

/* ---- type helpers ---- */
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--fg-mute);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: ""; width: 24px; height: 1px; background: var(--accent); opacity: 0.8;
}
.eyebrow.no-rule::before { display: none; }
.mono { font-family: var(--mono); }
.italic-d { font-family: var(--display); font-style: italic; font-weight: 300; }

/* ---- layout ---- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding-inline: var(--gut); }
section { position: relative; }
.section-pad { padding-block: clamp(90px, 13vw, 180px); }

/* =============================================================
   CUSTOM CURSOR
   ============================================================= */
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0; z-index: 9999; pointer-events: none;
  border-radius: 50%; transform: translate(-50%, -50%);
  mix-blend-mode: difference;
}
.cursor-dot { width: 6px; height: 6px; background: #fff; }
.cursor-ring {
  width: 36px; height: 36px; border: 1px solid rgba(255,255,255,0.6);
  transition: width .25s var(--ease), height .25s var(--ease), border-color .25s var(--ease), background .25s var(--ease);
}
.cursor-ring.hover { width: 64px; height: 64px; border-color: rgba(255,255,255,0.9); background: rgba(255,255,255,0.05); }
.cursor-ring.text { width: 4px; height: 28px; border-radius: 2px; background: #fff; border: none; }
@media (max-width: 820px) { .cursor-dot, .cursor-ring { display: none; } }

/* =============================================================
   SCROLL PROGRESS
   ============================================================= */
.scroll-prog {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--sand));
  z-index: 200; transition: width .1s linear;
}

/* =============================================================
   NAV
   ============================================================= */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px var(--gut);
  transition: background .4s var(--ease), padding .4s var(--ease), border-color .4s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding-block: 14px;
  border-color: var(--line);
}
.nav-brand { display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: 13px; letter-spacing: 0.05em; }
.nav-brand .star { width: 18px; height: 18px; animation: spin-slow 24s linear infinite; }
@keyframes spin-slow { to { transform: rotate(360deg); } }
.nav-brand b { font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; }
.nav-links { display: flex; gap: 4px; align-items: center; }
.nav-links a {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; color: var(--fg-soft);
  padding: 8px 14px; border-radius: 2px; position: relative; transition: color .2s var(--ease);
}
.nav-links a span { color: var(--fg-faint); margin-right: 7px; }
.nav-links a:hover { color: var(--fg); }
.nav-links a::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 4px; height: 1px;
  background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease);
}
.nav-links a:hover::after, .nav-links a.active::after { transform: scaleX(1); }
.nav-cta {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em;
  border: 1px solid var(--line-strong); padding: 9px 16px; border-radius: 2px;
  color: var(--fg); transition: background .25s var(--ease), border-color .25s var(--ease);
}
.nav-cta:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); }
@media (max-width: 920px) { .nav-links { display: none; } }

/* ---------- HAMBURGER BUTTON ---------- */
.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  z-index: 101;
  position: relative;
}
@media (max-width: 920px) { .nav-burger { display: flex; } }
.nav-burger span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--fg);
  border-radius: 1px;
  transform-origin: center;
  transition: transform .32s var(--ease), opacity .22s var(--ease), width .22s var(--ease);
}
.nav-burger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; width: 0; }
.nav-burger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }
@media (max-width: 480px) { .nav-cta { display: none; } }

/* ---------- MOBILE NAV OVERLAY ---------- */
@media (min-width: 921px) { .mob-nav { display: none !important; } }
.mob-nav {
  position: fixed;
  inset: 0;
  z-index: 98;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 88px var(--gut) 60px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(100%);
  transition: opacity .38s var(--ease), transform .38s var(--ease), visibility .38s;
}
.mob-nav.open {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.mob-nav-inner {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.mob-link {
  display: flex;
  align-items: baseline;
  gap: 18px;
  font-family: var(--display);
  font-size: clamp(26px, 7vw, 52px);
  font-weight: 500;
  color: var(--fg-soft);
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  opacity: 0;
  transform: translateX(28px);
  transition: color .2s var(--ease), opacity .38s var(--ease), transform .38s var(--ease);
}
.mob-link::before {
  content: attr(data-idx);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.1em;
  flex-shrink: 0;
}
.mob-link:hover { color: var(--fg); }
.mob-nav.open .mob-link { opacity: 1; transform: none; }
.mob-nav.open .mob-link:nth-child(1) { transition-delay: .04s; }
.mob-nav.open .mob-link:nth-child(2) { transition-delay: .08s; }
.mob-nav.open .mob-link:nth-child(3) { transition-delay: .12s; }
.mob-nav.open .mob-link:nth-child(4) { transition-delay: .16s; }
.mob-nav.open .mob-link:nth-child(5) { transition-delay: .20s; }
.mob-nav.open .mob-link:nth-child(6) { transition-delay: .24s; }
.mob-nav.open .mob-link:nth-child(7) { transition-delay: .28s; }
.mob-nav.open .mob-link:nth-child(8) { transition-delay: .32s; }
.mob-nav-cta {
  margin-top: 36px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--accent);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .38s var(--ease) .40s, transform .38s var(--ease) .40s, color .2s;
}
.mob-nav-cta::after { content: " →"; }
.mob-nav.open .mob-nav-cta { opacity: 1; transform: none; }
.mob-nav-cta:hover { color: var(--fg); }

/* =============================================================
   LOADER
   ============================================================= */
.loader {
  position: fixed; inset: 0; z-index: 9000; background: var(--bg);
  display: grid; place-items: center; transition: opacity .8s var(--ease), visibility .8s;
}
.loader.done { opacity: 0; visibility: hidden; }
.loader-inner { text-align: center; width: min(420px, 76vw); }
.loader-star { width: 34px; height: 34px; margin: 0 auto 26px; animation: spin-slow 4s linear infinite; }
.loader-bar { height: 1px; background: var(--line); position: relative; overflow: hidden; }
.loader-bar i { position: absolute; inset: 0; width: 0; background: var(--accent); transition: width .2s linear; }
.loader-meta { display: flex; justify-content: space-between; margin-top: 14px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; color: var(--fg-mute); }
.loader-word { font-family: var(--display); font-size: clamp(28px,5vw,46px); font-weight: 300; overflow: hidden; height: 1.1em; }
.loader-word span { display: block; transition: transform .5s var(--ease); }

/* =============================================================
   BUTTONS / PILLS
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.03em;
  padding: 15px 26px; border-radius: 2px; position: relative; overflow: hidden;
  transition: transform .3s var(--ease), color .3s var(--ease);
}
.btn-primary { background: var(--fg); color: var(--bg); }
.btn-primary .arr { transition: transform .35s var(--ease); }
.btn-primary:hover .arr { transform: translateX(5px); }
.btn-ghost { border: 1px solid var(--line-strong); color: var(--fg); }
.btn-ghost:hover { border-color: var(--fg); }

.chip {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.02em;
  padding: 7px 13px; border: 1px solid var(--line); border-radius: 2px;
  color: var(--fg-soft); transition: border-color .25s var(--ease), color .25s var(--ease), background .25s var(--ease);
}
.chip:hover { border-color: var(--accent); color: var(--fg); }

/* =============================================================
   SECTION HEADERS
   ============================================================= */
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; margin-bottom: clamp(48px, 7vw, 90px); flex-wrap: wrap; }
.sec-title { font-size: clamp(34px, 6vw, 76px); font-weight: 500; line-height: 0.98; max-width: 16ch; }
.sec-title em { font-style: italic; font-weight: 300; color: var(--accent); }
.sec-idx { font-family: var(--mono); font-size: 12px; color: var(--fg-mute); letter-spacing: 0.1em; white-space: nowrap; }

/* =============================================================
   REVEAL ANIMATION
   ============================================================= */
.reveal { opacity: 0; transform: translateY(calc(28px * var(--m))); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.reveal[data-d="1"] { transition-delay: .08s; }
.reveal[data-d="2"] { transition-delay: .16s; }
.reveal[data-d="3"] { transition-delay: .24s; }
.reveal[data-d="4"] { transition-delay: .32s; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* line-by-line text reveal */
.line-mask { overflow: hidden; display: block; padding-bottom: 0.12em; }
.line-mask > span { display: block; transform: translateY(0); transition: transform 1s var(--ease); }
.line-mask:not(.in) > span { transform: translateY(110%); }
@media (prefers-reduced-motion: reduce) { .line-mask:not(.in) > span { transform: none; } }

/* footer */
.footer { border-top: 1px solid var(--line); padding-block: 60px 40px; }
.footer-grid { display: flex; justify-content: space-between; align-items: flex-start; gap: 40px; flex-wrap: wrap; }
.footer-big { font-family: var(--display); font-size: clamp(48px, 12vw, 150px); font-weight: 300; line-height: 0.9; letter-spacing: -0.03em; color: var(--fg); margin-top: 50px; }
.footer-big em { font-style: italic; color: var(--accent); }
.footer-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 20px; margin-top: 40px; font-family: var(--mono); font-size: 12px; color: var(--fg-mute); letter-spacing: 0.05em; }
