/* ==========================================================
   Eoghan Russell — classic layout, cream palette
   ========================================================== */
:root {
  --bg: #f4efe5;
  --bg-2: #ece5d7;
  --card: #fbf8f2;
  --text: #16243d;
  --muted: #5e6a7d;
  --dim: #8d95a3;
  --accent: #2c5d93;
  --accent-2: #a7834a;
  --accent-soft: rgba(44, 93, 147, 0.1);
  --line: rgba(22, 36, 61, 0.1);
  --line-strong: rgba(22, 36, 61, 0.2);
  --glass: rgba(251, 248, 242, 0.72);
  --shadow: 0 18px 50px -24px rgba(22, 36, 61, 0.28);
  --shadow-lg: 0 30px 80px -30px rgba(22, 36, 61, 0.4);
  --r-sm: 10px;
  --r-md: 18px;
  --r-lg: 26px;
  --f-head: 'Space Grotesk', system-ui, sans-serif;
  --f-body: 'Outfit', system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --nav-h: 80px;
  --on-accent: #fff;
  --nav-bg: rgba(244, 239, 229, .85);
  --nav-solid: rgba(244, 239, 229, .97);
  --particle: 22, 36, 61;
  --particle-line: 44, 93, 147;
  color-scheme: light;

  /* aliases used by the Globefolio page */
  --panel: var(--glass);
  --hi: var(--text);
  --on-hi: var(--bg);
  --r-l: var(--r-lg);
  --r-m: var(--r-md);
  --f-display: var(--f-head);
  --f-mono: var(--f-head);
  --header-h: var(--nav-h);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 70px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--f-body); font-size: 17px; line-height: 1.65; -webkit-font-smoothing: antialiased; overflow-x: clip; }
h1, h2, h3, h4 { font-family: var(--f-head); line-height: 1.1; letter-spacing: -.02em; margin: 0; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
img, video, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
ul { list-style: none; margin: 0; padding: 0; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(22, 36, 61, .25); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.section-padding { padding: clamp(80px, 12vh, 120px) 0; }
.section-alt { background: var(--bg-2); }
.text-gradient { background: linear-gradient(120deg, var(--text) 10%, var(--accent) 90%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.glass { background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line); }
.skip { position: fixed; left: 16px; top: -60px; z-index: 3000; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; transition: top .2s; }
.skip:focus { top: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.eyebrow { display: inline-flex; align-items: center; gap: 10px; font-family: var(--f-head); font-size: 13px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.eyebrow::before { content: ''; width: 24px; height: 2px; border-radius: 2px; background: var(--accent-2); }
.section-header { text-align: center; margin-bottom: clamp(40px, 7vh, 64px); }
.section-header h2 { font-size: clamp(2.2rem, 4.5vw, 3.4rem); margin-top: 14px; }
.section-header p { color: var(--muted); margin-top: 12px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 50px; padding: 0 28px; border-radius: 50px; font-weight: 600; font-size: 15.5px; transition: transform .35s var(--ease), box-shadow .35s var(--ease), background .3s, color .3s, border-color .3s; }
.btn i { transition: transform .35s var(--ease); font-size: .9em; }
.btn:hover i { transform: translateX(4px); }
.btn-primary { background: var(--text); color: var(--bg); box-shadow: 0 12px 28px -14px rgba(22, 36, 61, .6); }
.btn-primary:hover { background: var(--accent); transform: translateY(-2px); box-shadow: 0 18px 36px -16px rgba(44, 93, 147, .7); }
.btn-outline { border: 1.5px solid var(--line-strong); color: var(--text); }
.btn-outline:hover { border-color: var(--text); transform: translateY(-2px); }
.btn-light { background: #fff; color: var(--text); }
.btn-light:hover { background: var(--accent-2); color: #fff; }
.btn-locked { background: rgba(255, 255, 255, .14); color: rgba(255, 255, 255, .8); border: 1px solid rgba(255, 255, 255, .25); cursor: not-allowed; }
.btn-sm { min-height: 42px; padding: 0 20px; font-size: 14.5px; }

/* ---------- Cursor ---------- */
.cursor-dot, .cursor-ring { position: fixed; top: 0; left: 0; z-index: 2500; pointer-events: none; border-radius: 50%; }
.cursor-dot { width: 8px; height: 8px; margin: -4px 0 0 -4px; background: var(--accent); }
.cursor-ring { width: 36px; height: 36px; margin: -18px 0 0 -18px; border: 1.5px solid rgba(44, 93, 147, .45); transition: width .3s var(--ease), height .3s var(--ease), margin .3s var(--ease), background .3s, border-color .3s, opacity .3s; }
.hovering .cursor-ring { width: 58px; height: 58px; margin: -29px 0 0 -29px; background: var(--accent-soft); border-color: var(--accent); }
.cursor-hidden .cursor-dot, .cursor-hidden .cursor-ring { opacity: 0; }
@media (hover: hover) and (pointer: fine) { .has-cursor, .has-cursor * { cursor: none !important; } .has-cursor input, .has-cursor textarea { cursor: text !important; } }
@media not ((hover: hover) and (pointer: fine)) { .cursor-dot, .cursor-ring { display: none; } }

.scroll-progress { position: fixed; top: 0; left: 0; height: 3px; width: 100%; z-index: 2001; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transform-origin: 0 50%; transform: scaleX(0); }

/* ---------- Navigation ---------- */
.navbar { position: fixed; top: 0; left: 0; right: 0; height: var(--nav-h); z-index: 2000; display: flex; align-items: center; transition: height .4s var(--ease), background .4s, box-shadow .4s, border-color .4s; border-bottom: 1px solid transparent; }
.navbar.scrolled { height: 68px; background: var(--nav-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom-color: var(--line); box-shadow: 0 10px 30px -20px rgba(22, 36, 61, .3); }
.nav-container { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.logo { font-family: var(--f-head); font-size: 1.5rem; font-weight: 700; letter-spacing: -.04em; }
.logo span { color: var(--accent-2); }
.nav-links { display: flex; gap: 6px; align-items: center; }
.nav-link { position: relative; font-weight: 500; font-size: .98rem; color: var(--muted); padding: 8px 16px; border-radius: 50px; transition: color .25s, background .25s; }
.nav-link:hover, .nav-link.active { color: var(--text); background: rgba(22, 36, 61, .06); }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.btn-cv { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 20px; border-radius: 50px; font-weight: 600; font-size: .92rem; background: var(--text); color: var(--bg); transition: background .3s, transform .3s var(--ease); }
.btn-cv:hover { background: var(--accent); transform: translateY(-1px); }
.menu-btn { display: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-strong); font-size: 1.05rem; }
.mobile-nav { position: fixed; inset: 0; z-index: 1999; background: var(--nav-solid); backdrop-filter: blur(10px); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; opacity: 0; visibility: hidden; transition: opacity .35s, visibility .35s; }
.mobile-nav a { font-family: var(--f-head); font-size: 2.4rem; font-weight: 700; letter-spacing: -.03em; padding: 6px 20px; }
.menu-open .mobile-nav { opacity: 1; visibility: visible; }
@media (max-width: 900px) { .nav-links { display: none; } .menu-btn { display: grid; place-items: center; } }

/* ---------- Hero ---------- */
.hero { position: relative; min-height: 100vh; min-height: 100svh; display: flex; align-items: center; overflow: hidden; padding: calc(var(--nav-h) + 30px) 0 60px; }
#particles-js { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.hero::after { content: ''; position: absolute; inset: auto 0 0; height: 160px; background: linear-gradient(transparent, var(--bg)); pointer-events: none; }
.hero-glow { position: absolute; width: 60vw; height: 60vw; right: -15vw; top: -20vw; border-radius: 50%; background: radial-gradient(circle, rgba(44, 93, 147, .14), transparent 65%); pointer-events: none; }
.hero-glow--2 { right: auto; left: -20vw; top: auto; bottom: -30vw; background: radial-gradient(circle, rgba(167, 131, 74, .14), transparent 65%); }
.hero-content { position: relative; z-index: 1; display: grid; grid-template-columns: 1.1fr .9fr; align-items: center; gap: clamp(30px, 6vw, 80px); width: 100%; }
.hero-hello { font-family: var(--f-head); font-weight: 500; letter-spacing: .18em; color: var(--accent); font-size: 14px; display: inline-flex; align-items: center; gap: 10px; }
.hero-hello .wave { display: inline-block; animation: wave 2.6s ease-in-out infinite; transform-origin: 70% 70%; }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20% { transform: rotate(-8deg); } 40% { transform: rotate(-4deg); } 50% { transform: rotate(10deg); } }
.hero-text h1 { font-size: clamp(2.8rem, 6.2vw, 4.8rem); margin: 14px 0 22px; min-height: 2.25em; font-weight: 700; letter-spacing: -.035em; }
.typewriter-cursor { display: inline-block; width: 3px; height: .85em; background: var(--accent-2); margin-left: 6px; vertical-align: -.06em; border-radius: 2px; animation: blink .9s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero-text > p { color: var(--muted); font-size: 1.08rem; max-width: 56ch; }
.cta-group { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 32px; }
.hero-stats { display: flex; gap: clamp(20px, 4vw, 44px); margin-top: 44px; padding-top: 26px; border-top: 1px solid var(--line); }
.hero-stats b { display: block; font-family: var(--f-head); font-size: 1.9rem; letter-spacing: -.03em; line-height: 1; }
.hero-stats span { color: var(--muted); font-size: 14px; }
.hero-visual { position: relative; perspective: 1200px; }
.tilt-card { position: relative; width: 100%; aspect-ratio: 4 / 5; max-height: 72vh; border-radius: var(--r-lg); transform-style: preserve-3d; box-shadow: var(--shadow-lg); will-change: transform; background: var(--card); }
.tilt-card img { width: 100%; height: 100%; object-fit: cover; object-position: center 22%; border-radius: var(--r-lg); }
.tilt-card { overflow: visible; }
.tilt-glare { position: absolute; inset: 0; border-radius: var(--r-lg); pointer-events: none; overflow: hidden; }
.tilt-glare i { position: absolute; left: -10%; top: -10%; width: 70%; height: 60%; background: radial-gradient(circle, rgba(255, 255, 255, .22), transparent 65%); }
.tilt-badge.glass { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--card); }
.tilt-badge { position: absolute; left: -22px; bottom: 34px; z-index: 2; transform: translateZ(60px); padding: 14px 18px; border-radius: 16px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow); }
.tilt-badge i { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--text); color: var(--bg); font-size: 15px; }
.tilt-badge b { display: block; font-family: var(--f-head); font-size: 15px; line-height: 1.2; }
.tilt-badge span { font-size: 13px; color: var(--muted); }
.tilt-badge--top { left: auto; right: -18px; top: 30px; bottom: auto; }
.tilt-badge--top i { background: var(--accent-2); }
.scroll-hint { position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 2; width: 26px; height: 42px; border-radius: 20px; border: 1.5px solid var(--line-strong); }
.scroll-hint::after { content: ''; position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px; border-radius: 4px; background: var(--accent); animation: scrollhint 1.8s var(--ease) infinite; }
@keyframes scrollhint { 0% { transform: translateY(0); opacity: 1; } 80% { transform: translateY(14px); opacity: 0; } 100% { opacity: 0; } }

/* ---------- Marquee ---------- */
.marquee-section { padding: 30px 0; background: var(--card); overflow: hidden; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
.marquee-content { display: flex; width: max-content; animation: scroll 38s linear infinite; }
.marquee-section:hover .marquee-content { animation-play-state: paused; }
.marquee-item { font-family: var(--f-head); font-size: 1.45rem; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 12px; padding-right: 70px; transition: color .3s; white-space: nowrap; }
.marquee-item:hover { color: var(--text); }
.marquee-item i { color: var(--accent); }
.marquee-item:nth-child(3n) i { color: var(--accent-2); }
@keyframes scroll { to { transform: translateX(-50%); } }

/* ---------- Projects ---------- */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 28px; }
@property --flip { syntax: '<angle>'; inherits: true; initial-value: 0deg; }
@property --lift { syntax: '<length>'; inherits: true; initial-value: 0px; }
.project-card { position: relative; height: 420px; perspective: 1400px; outline: none; --tx: 0deg; --ty: 0deg; transition: --flip 1s cubic-bezier(.65, 0, .25, 1), --lift .55s var(--ease); }
.project-card::after { content: ''; position: absolute; left: 10%; right: 10%; bottom: -14px; height: 30px; border-radius: 50%; background: radial-gradient(ellipse at center, rgba(22, 36, 61, .3), transparent 70%); opacity: .35; transform: scale(.9); transition: opacity .6s var(--ease), transform .6s var(--ease); z-index: -1; }
.project-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transform: translateZ(var(--lift)) rotateX(var(--ty)) rotateY(calc(var(--tx) + var(--flip))); transition: transform .25s ease-out; }
.project-card:hover, .project-card:focus-within, .project-card.flipped { --flip: 180deg; --lift: 34px; }
.project-card:hover::after, .project-card:focus-within::after, .project-card.flipped::after { opacity: .9; transform: scale(1.05) translateY(10px); }
.project-front, .project-back { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: var(--r-md); overflow: hidden; }
.project-front { background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 28px; }
.project-front::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 50% 38%, var(--tint, rgba(44, 93, 147, .14)), transparent 60%); }
.project-logo { position: relative; width: 112px; height: 112px; object-fit: contain; margin-bottom: 22px; border-radius: 26px; transition: transform .6s var(--ease); }
.project-card:hover .project-logo { transform: scale(1.06) rotate(-3deg); }
.project-front h3 { position: relative; font-size: 1.7rem; }
.project-tag { position: relative; margin-top: 10px; font-size: 13px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.project-status { position: absolute; top: 18px; right: 18px; font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 50px; background: rgba(63, 143, 90, .12); color: #2f7a4a; }
.project-status.build { background: rgba(167, 131, 74, .14); color: #8a6a33; }
.project-hint { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; font-size: 12.5px; color: var(--dim); display: flex; align-items: center; justify-content: center; gap: 8px; }
.project-back { transform: rotateY(180deg); background: #16243d center / cover no-repeat; color: #fff; display: flex; flex-direction: column; justify-content: flex-end; padding: 30px; box-shadow: var(--shadow-lg); }
.project-back::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(22, 36, 61, .25) 0%, rgba(22, 36, 61, .92) 62%); }
.project-back > * { position: relative; }
.project-back h3 { font-size: 1.7rem; }
.project-back p { margin: 10px 0 20px; color: rgba(255, 255, 255, .82); font-size: 15.5px; line-height: 1.55; }
.project-back .btn { align-self: flex-start; }

/* ---------- Timeline ---------- */
.timeline-wrapper { position: relative; max-width: 920px; margin: 0 auto; }
.timeline-line { position: absolute; left: 50%; top: 6px; bottom: 6px; width: 2px; background: var(--line-strong); transform: translateX(-50%); border-radius: 2px; overflow: hidden; }
.timeline-line i { position: absolute; left: 0; top: 0; width: 100%; height: 100%; background: linear-gradient(var(--accent), var(--accent-2)); transform-origin: top; transform: scaleY(0); }
.timeline-item { position: relative; width: 50%; padding: 0 48px; margin-bottom: 44px; opacity: 0; transform: translateY(34px); transition: opacity .8s var(--ease), transform .9s var(--ease); }
.timeline-item.show { opacity: 1; transform: none; }
.timeline-item:nth-child(even) { left: 0; text-align: right; }
.timeline-item:nth-child(odd) { left: 50%; }
.timeline-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 24px 26px; box-shadow: var(--shadow); transition: transform .5s var(--ease), box-shadow .5s var(--ease); }
.timeline-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.timeline-dot { position: absolute; top: 26px; width: 18px; height: 18px; border-radius: 50%; background: var(--bg); border: 3px solid var(--accent); box-shadow: 0 0 0 6px var(--bg); transition: background .4s; }
.timeline-item.show .timeline-dot { background: var(--accent); }
.timeline-item:nth-child(even) .timeline-dot { right: -9px; }
.timeline-item:nth-child(odd) .timeline-dot { left: -9px; }
.timeline-date { display: inline-block; font-family: var(--f-head); font-size: 13px; font-weight: 600; letter-spacing: .06em; color: var(--accent); background: var(--accent-soft); padding: 4px 12px; border-radius: 50px; }
.timeline-card h3 { font-size: 1.32rem; margin: 12px 0 4px; }
.timeline-org { font-weight: 600; font-size: 15px; color: var(--accent-2); }
.timeline-card p { margin-top: 10px; color: var(--muted); font-size: 15.5px; }

/* ---------- Contact ---------- */
.contact-wrap { display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(28px, 5vw, 60px); align-items: start; max-width: 1040px; margin: 0 auto; }
.contact-info h3 { font-size: clamp(1.8rem, 3vw, 2.4rem); }
.contact-info > p { color: var(--muted); margin: 14px 0 26px; }
.contact-line { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--r-sm); background: var(--card); border: 1px solid var(--line); margin-bottom: 12px; transition: border-color .3s, transform .4s var(--ease); width: 100%; text-align: left; }
.contact-line:hover { border-color: var(--accent); transform: translateX(4px); }
.contact-line i { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.contact-line b { display: block; font-family: var(--f-head); font-size: 15.5px; }
.contact-line span { color: var(--muted); font-size: 14px; }
.contact-form { padding: clamp(26px, 4vw, 40px); border-radius: var(--r-lg); background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.input-group { position: relative; margin-bottom: 18px; }
.input-field { width: 100%; padding: 22px 16px 10px; background: var(--bg); border: 1.5px solid transparent; border-radius: var(--r-sm); color: var(--text); font: inherit; font-size: 16px; transition: border-color .25s, background .25s, box-shadow .25s; resize: vertical; }
.input-field:focus { outline: none; border-color: var(--accent); background: var(--card); box-shadow: 0 0 0 4px var(--accent-soft); }
.input-group label { position: absolute; left: 17px; top: 16px; color: var(--dim); pointer-events: none; transition: all .25s var(--ease); }
.input-field:focus + label, .input-field:not(:placeholder-shown) + label { top: 6px; font-size: 12px; color: var(--accent); font-weight: 500; }
textarea.input-field { min-height: 150px; }
.form-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.form-status { font-size: 14.5px; color: #a3412f; }

/* ---------- Footer ---------- */
footer { position: relative; padding: 60px 0 46px; text-align: center; border-top: 1px solid var(--line); overflow: hidden; background: var(--bg-2); }
#matrix-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; opacity: .14; }
.footer-content { position: relative; z-index: 1; }
.footer-logo { font-family: var(--f-head); font-size: 2rem; font-weight: 700; letter-spacing: -.04em; }
.footer-logo span { color: var(--accent-2); }
.footer-nav { display: flex; justify-content: center; gap: 6px 22px; flex-wrap: wrap; margin: 18px 0 22px; color: var(--muted); }
.footer-nav a:hover { color: var(--text); }
.socials { display: flex; justify-content: center; gap: 12px; }
.social { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--card); border: 1px solid var(--line); font-size: 1.15rem; transition: background .3s, color .3s, transform .4s var(--ease); }
.social:hover { background: var(--text); color: var(--bg); transform: translateY(-3px); }
.footer-copy { margin-top: 26px; color: var(--dim); font-size: 14px; }

/* ---------- Chat ---------- */
.chat-trigger { position: fixed; bottom: 26px; right: 26px; width: 62px; height: 62px; z-index: 1500; border-radius: 50%; display: grid; place-items: center; font-size: 1.45rem; background: var(--text); color: var(--bg); box-shadow: 0 16px 34px -12px rgba(22, 36, 61, .55); transition: transform .45s var(--ease), background .3s; }
.chat-trigger:hover { transform: scale(1.08) rotate(8deg); background: var(--accent); }
.chat-trigger .fa-xmark { display: none; }
.chat-open .chat-trigger .fa-xmark { display: block; }
.chat-open .chat-trigger .fa-comment-dots { display: none; }
.chat-window { position: fixed; bottom: 102px; right: 26px; width: min(340px, calc(100vw - 32px)); height: min(460px, 68vh); z-index: 1500; display: flex; flex-direction: column; border-radius: var(--r-md); overflow: hidden; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-lg); transform-origin: bottom right; opacity: 0; visibility: hidden; transform: translateY(14px) scale(.96); transition: opacity .3s, transform .45s var(--ease), visibility .3s; }
.chat-open .chat-window { opacity: 1; visibility: visible; transform: none; }
.chat-header { padding: 16px 18px; background: var(--text); color: var(--bg); display: flex; align-items: center; gap: 12px; }
.chat-header img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; object-position: center 20%; border: 2px solid var(--accent-2); }
.chat-header h4 { font-size: 16px; }
.chat-header small { display: block; font-size: 12px; opacity: .75; }
.chat-header small::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #6fcf8f; margin-right: 6px; }
.chat-body { flex: 1; padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; font-size: 14.5px; }
.chat-msg { max-width: 86%; padding: 10px 14px; border-radius: 16px; line-height: 1.45; animation: pop .35s var(--ease); }
.chat-msg.bot { background: var(--bg-2); border-bottom-left-radius: 4px; }
.chat-msg.user { align-self: flex-end; background: var(--text); color: var(--bg); border-bottom-right-radius: 4px; }
.chat-msg.typing { display: inline-flex; gap: 4px; }
.chat-msg.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); animation: dots 1s infinite; }
.chat-msg.typing i:nth-child(2) { animation-delay: .15s; } .chat-msg.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dots { 50% { transform: translateY(-4px); opacity: .5; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }
.chat-input-area { padding: 10px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.chat-input { flex: 1; min-width: 0; height: 42px; padding: 0 16px; border-radius: 50px; background: var(--bg); border: 1.5px solid transparent; color: var(--text); font: inherit; font-size: 15px; }
.chat-input:focus { outline: none; border-color: var(--accent); }
.chat-send { width: 42px; height: 42px; border-radius: 50%; background: var(--text); color: var(--bg); display: grid; place-items: center; }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity .9s var(--ease), transform 1s var(--ease); transition-delay: var(--d, 0s); }
.reveal.show { opacity: 1; transform: none; }

/* ---------- Project pages ---------- */
.page-hero { padding: calc(var(--nav-h) + clamp(50px, 9vh, 100px)) 0 20px; position: relative; overflow: hidden; }
.back-link { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 500; font-size: 15px; transition: color .25s, gap .3s var(--ease); }
.back-link:hover { color: var(--text); gap: 12px; }
.page-hero h1 { font-size: clamp(2.8rem, 7vw, 5.4rem); letter-spacing: -.04em; margin: 22px 0 16px; }
.page-hero .lead { font-size: clamp(1.08rem, 1.6vw, 1.3rem); color: var(--muted); max-width: 60ch; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 50px; background: var(--accent-soft); color: var(--accent); }
.chip--live { background: rgba(63, 143, 90, .12); color: #2f7a4a; }
.chip--build { background: rgba(167, 131, 74, .14); color: #8a6a33; }
.page-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.media { margin: clamp(36px, 6vh, 60px) 0 0; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-lg); background: var(--text); }
.media img, .media video { width: 100%; height: auto; display: block; }
.page-grid { display: grid; grid-template-columns: 1fr 320px; gap: clamp(30px, 5vw, 64px); align-items: start; padding-top: clamp(50px, 8vh, 90px); }
.page-body section + section { margin-top: 54px; }
.page-body h2 { font-size: clamp(1.7rem, 2.8vw, 2.3rem); margin: 12px 0 16px; }
.page-body p { color: var(--muted); font-size: 1.06rem; margin-bottom: 1em; max-width: 68ch; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 22px; }
.stat { padding: 22px; border-radius: var(--r-md); background: var(--card); border: 1px solid var(--line); }
.stat b { display: block; font-family: var(--f-head); font-size: clamp(2.4rem, 5vw, 3.4rem); letter-spacing: -.04em; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.stat span { display: block; margin-top: 10px; color: var(--muted); font-size: 14.5px; }
.stats-note { font-size: 13px; color: var(--dim); margin-top: 10px; }
.features-list { display: grid; gap: 12px; }
.feature { display: grid; grid-template-columns: auto 1fr; gap: 16px; padding: 20px 22px; border-radius: var(--r-md); background: var(--card); border: 1px solid var(--line); transition: transform .45s var(--ease), border-color .3s; }
.feature:hover { transform: translateX(6px); border-color: var(--line-strong); }
.feature i { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 17px; }
.feature h3 { font-size: 1.12rem; margin-bottom: 4px; }
.feature p { margin: 0; font-size: 15.5px; }
.sidebar { position: sticky; top: 100px; padding: 26px; border-radius: var(--r-lg); background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.sidebar dl { margin: 0; display: grid; gap: 18px; }
.sidebar dt { font-family: var(--f-head); font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); margin-bottom: 4px; }
.sidebar dd { margin: 0; font-weight: 500; }
.stack { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.stack span { font-size: 13.5px; padding: 5px 11px; border-radius: 50px; background: var(--bg); border: 1px solid var(--line); }
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 10px; }
.gallery figure { margin: 0; border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow); background: var(--text); cursor: zoom-in; }
.gallery figure.wide { grid-column: 1 / -1; }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform 1s var(--ease); }
.gallery figure:hover img { transform: scale(1.04); }
.building { display: grid; grid-template-columns: auto 1fr; gap: 30px; align-items: center; padding: clamp(26px, 5vw, 48px); border-radius: var(--r-lg); background: var(--card); border: 1px dashed var(--line-strong); margin-top: 40px; }
.building img { width: 130px; border-radius: 28px; box-shadow: var(--shadow); }
.building h2 { font-size: clamp(1.6rem, 2.6vw, 2.2rem); margin-bottom: 10px; }
.building p { color: var(--muted); margin-bottom: 20px; max-width: 54ch; }
.progress { height: 6px; border-radius: 6px; background: var(--bg-2); overflow: hidden; max-width: 360px; margin-bottom: 20px; }
.progress i { display: block; height: 100%; width: 35%; border-radius: 6px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); animation: loading 2.2s var(--ease) infinite alternate; }
@keyframes loading { from { transform: translateX(-60%); } to { transform: translateX(220%); } }
.next-project { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: clamp(70px, 12vh, 120px); padding: clamp(28px, 4vw, 40px); border-radius: var(--r-lg); background: var(--text); color: var(--bg); transition: transform .5s var(--ease), box-shadow .5s; }
.next-project:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.next-project small { display: block; font-family: var(--f-head); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; opacity: .65; }
.next-project b { display: block; font-family: var(--f-head); font-size: clamp(1.8rem, 4vw, 3rem); letter-spacing: -.03em; margin-top: 4px; }
.next-project .arrow { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-2); color: #fff; font-size: 1.3rem; transition: transform .5s var(--ease); flex: none; }
.next-project:hover .arrow { transform: rotate(-45deg); }
.lightbox { border: 0; padding: 0; background: transparent; max-width: min(94vw, 1200px); }
.lightbox::backdrop { background: rgba(22, 36, 61, .82); backdrop-filter: blur(4px); }
.lightbox img { max-height: 84vh; border-radius: 14px; }
.lightbox button { display: flex; margin: 14px auto 0; }

/* ---------- 404 / success ---------- */
.lost { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 24px; }
.lost h1 { font-size: clamp(5rem, 20vw, 12rem); letter-spacing: -.06em; line-height: .9; }
.lost p { color: var(--muted); font-size: 1.1rem; max-width: 42ch; margin: 18px auto 28px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-content { grid-template-columns: 1fr; text-align: center; }
  .hero-text > p { margin: 0 auto; }
  .cta-group, .hero-stats { justify-content: center; }
  .hero-visual { max-width: 340px; margin: 10px auto 0; width: 100%; }
  .tilt-badge { left: -10px; } .tilt-badge--top { right: -10px; left: auto; }
  .hero-text h1 { min-height: 2.3em; }
  .scroll-hint { display: none; }
  .timeline-line { left: 9px; }
  .timeline-item { width: 100%; left: 0 !important; text-align: left !important; padding: 0 0 0 40px; }
  .timeline-item .timeline-dot { left: 0 !important; right: auto !important; }
  .contact-wrap, .page-grid { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .building { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .project-card { height: 400px; }
  .gallery, .stats { grid-template-columns: 1fr; }
  .chat-trigger { right: 16px; bottom: 16px; }
  .chat-window { right: 16px; bottom: 90px; }
  .btn-cv span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .reveal, .timeline-item { opacity: 1; transform: none; }
}

/* ---------- Smooth scroll (Lenis) ---------- */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

/* ---------- Hero entrance ---------- */
.hero-seq { opacity: 0; transform: translateY(26px); transition: opacity .9s var(--ease), transform 1.1s var(--ease); transition-delay: var(--d, 0s); }
.hero-ready .hero-seq { opacity: 1; transform: none; }
.split-w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; margin-bottom: -.08em; }
.split-w > span { display: inline-block; transform: translateY(105%); transition: transform .9s var(--ease); transition-delay: calc(var(--d, 0s) + var(--i) * 14ms); }
.hero-ready .split-w > span { transform: none; }
.hero-visual-wrap { will-change: transform; perspective: 1200px; }

/* ---------- Magnetic ---------- */

@media (prefers-reduced-motion: reduce) { .hero-seq, .split-w > span { opacity: 1; transform: none; } .project-card { transition: none; } }

/* ==========================================================
   Dark mode (navy)
   ========================================================== */
:root[data-theme='dark'] {
  --bg: #0b1424;
  --bg-2: #0f1a2e;
  --card: #132139;
  --text: #eef0f4;
  --muted: #a4afc2;
  --dim: #6f7c92;
  --accent: #7fb0e8;
  --accent-2: #d6b27a;
  --accent-soft: rgba(127, 176, 232, .14);
  --line: rgba(238, 240, 244, .09);
  --line-strong: rgba(238, 240, 244, .2);
  --glass: rgba(19, 33, 57, .7);
  --shadow: 0 18px 50px -24px rgba(0, 0, 0, .7);
  --shadow-lg: 0 30px 80px -30px rgba(0, 0, 0, .85);
  --on-accent: #0b1424;
  --nav-bg: rgba(11, 20, 36, .82);
  --nav-solid: rgba(11, 20, 36, .97);
  --particle: 238, 240, 244;
  --particle-line: 127, 176, 232;
  color-scheme: dark;
}
:root[data-theme='dark'] .text-gradient { background-image: linear-gradient(120deg, #fff 10%, var(--accent) 90%); }
:root[data-theme='dark'] .btn-primary:hover { background: var(--accent); color: var(--on-accent); }
:root[data-theme='dark'] .hero-glow { background: radial-gradient(circle, rgba(127, 176, 232, .14), transparent 65%); }
:root[data-theme='dark'] .hero-glow--2 { background: radial-gradient(circle, rgba(214, 178, 122, .12), transparent 65%); }
:root[data-theme='dark'] .project-status { background: rgba(111, 207, 143, .14); color: #7fd49c; }
:root[data-theme='dark'] .chip--live { background: rgba(111, 207, 143, .14); color: #7fd49c; }
:root[data-theme='dark'] .tilt-card img { filter: brightness(.94); }
:root[data-theme='dark'] .media, :root[data-theme='dark'] .gallery figure { background: #000; }
html.theme-anim, html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after { transition: background-color .5s var(--ease), color .5s var(--ease), border-color .5s var(--ease), fill .5s, box-shadow .5s !important; }

/* Theme toggle */
.theme-toggle { position: relative; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; overflow: hidden; color: var(--text); transition: border-color .3s, transform .4s var(--ease); }
.theme-toggle:hover { border-color: var(--accent); transform: rotate(-12deg); }
.theme-toggle i { position: absolute; transition: transform .6s var(--ease), opacity .4s; }
.theme-toggle .fa-moon { transform: translateY(0) rotate(0); }
.theme-toggle .fa-sun { transform: translateY(150%) rotate(90deg); opacity: 0; color: var(--accent-2); }
:root[data-theme='dark'] .theme-toggle .fa-moon { transform: translateY(-150%) rotate(-90deg); opacity: 0; }
:root[data-theme='dark'] .theme-toggle .fa-sun { transform: none; opacity: 1; }
.theme-wipe { position: fixed; z-index: 2600; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; pointer-events: none; transform: scale(0); }

/* ==========================================================
   Page transitions
   ========================================================== */
.page-curtain { position: fixed; inset: 0; z-index: 2700; pointer-events: none; background: var(--text); transform: scaleY(0); transform-origin: bottom; display: grid; place-items: center; }
.page-curtain b { font-family: var(--f-head); font-size: clamp(2rem, 5vw, 3.4rem); letter-spacing: -.04em; color: var(--bg); opacity: 0; transform: translateY(20px); transition: opacity .3s, transform .5s var(--ease); }
.page-curtain b span { color: var(--accent-2); }
.leaving .page-curtain { transform: scaleY(1); transition: transform .55s cubic-bezier(.77, 0, .18, 1); }
.leaving .page-curtain b { opacity: 1; transform: none; transition-delay: .2s; }
.arriving .page-curtain { transform: scaleY(1); transform-origin: top; }
.arrived .page-curtain { transform: scaleY(0); transform-origin: top; transition: transform .7s cubic-bezier(.77, 0, .18, 1) .05s; }

/* ==========================================================
   Sliding nav indicator
   ========================================================== */
.nav-links { position: relative; }
.nav-pill { position: absolute; top: 0; left: 0; height: 100%; border-radius: 50px; background: rgba(127, 140, 160, .14); pointer-events: none; opacity: 0; transition: transform .5s var(--ease), width .5s var(--ease), opacity .3s; z-index: -1; }
.nav-links.has-pill .nav-link:hover, .nav-links.has-pill .nav-link.active { background: transparent; }

/* ==========================================================
   Back to top with progress ring
   ========================================================== */
.to-top { position: fixed; left: 26px; bottom: 26px; z-index: 1400; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--card); color: var(--text); box-shadow: var(--shadow); opacity: 0; visibility: hidden; transform: translateY(16px) scale(.9); transition: opacity .35s, visibility .35s, transform .5s var(--ease); }
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.to-top circle { fill: none; stroke-width: 3; }
.to-top .track { stroke: var(--line); }
.to-top .prog { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 145; stroke-dashoffset: 145; }
.to-top i { transition: transform .4s var(--ease); }
.to-top:hover i { transform: translateY(-3px); }

/* ==========================================================
   Cursor spotlight on cards
   ========================================================== */
.spot { position: relative; isolation: isolate; }
.spot::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1; opacity: 0; transition: opacity .4s; background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), var(--accent-soft), transparent 45%); }
.spot::after { content: ''; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; padding: 1px; opacity: 0; transition: opacity .4s; background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), var(--accent), transparent 60%); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.spot:hover::before, .spot:hover::after { opacity: 1; }

/* ==========================================================
   Heading reveal
   ========================================================== */
.line-mask { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: .1em; margin-bottom: -.1em; }
.line-mask > span { display: inline-block; transform: translateY(110%) rotate(2deg); transition: transform 1s var(--ease); transition-delay: calc(var(--i, 0) * 70ms); }
.show .line-mask > span, .line-mask.show > span { transform: none; }
.section-header h2 .line-mask:last-child > span { color: inherit; }
.eyebrow::before { transform-origin: left; transform: scaleX(0); transition: transform .9s var(--ease) .2s; }
.show .eyebrow::before, .eyebrow.show::before { transform: scaleX(1); }

/* ==========================================================
   Skills
   ========================================================== */
.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.skill-card { padding: 30px; border-radius: var(--r-lg); background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .5s var(--ease); }
.skill-card:hover { transform: translateY(-6px); }
.skill-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 22px; background: var(--accent-soft); color: var(--accent); margin-bottom: 20px; transition: transform .6s var(--ease); }
.skill-card:hover .skill-icon { transform: rotate(-8deg) scale(1.08); }
.skill-card:nth-child(2) .skill-icon { background: rgba(167, 131, 74, .15); color: var(--accent-2); }
.skill-card h3 { font-size: 1.4rem; }
.skill-card > p { color: var(--muted); margin: 8px 0 20px; font-size: 15.5px; }
.skill-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-tags span { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 50px; background: var(--bg); border: 1px solid var(--line); font-size: 14px; font-weight: 500; opacity: 0; transform: translateY(10px) scale(.95); transition: opacity .5s var(--ease), transform .6s var(--ease), border-color .3s, color .3s; transition-delay: calc(var(--i) * 45ms + .2s); }
.skill-tags span:hover { border-color: var(--accent); color: var(--accent); }
.skill-tags span i { color: var(--accent); font-size: 13px; }
.skill-card.show .skill-tags span { opacity: 1; transform: none; }
@media (max-width: 900px) { .skills-grid { grid-template-columns: 1fr; } }

/* ==========================================================
   Command palette
   ========================================================== */
.kbd-hint { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border-radius: 50px; border: 1px solid var(--line-strong); color: var(--muted); font-size: 13.5px; font-weight: 500; transition: border-color .3s, color .3s; }
.kbd-hint:hover { border-color: var(--accent); color: var(--text); }
kbd { font-family: var(--f-head); font-size: 11.5px; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--muted); }
.palette { border: 0; padding: 0; width: min(600px, calc(100vw - 28px)); margin-top: 14vh; border-radius: 20px; background: var(--card); color: var(--text); box-shadow: var(--shadow-lg), 0 0 0 1px var(--line); overflow: hidden; }
.palette::backdrop { background: rgba(11, 20, 36, .45); backdrop-filter: blur(6px); }
.palette[open] { animation: palIn .4s var(--ease); }
@keyframes palIn { from { opacity: 0; transform: translateY(-12px) scale(.97); } }
.pal-search { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.pal-search i { color: var(--muted); }
.pal-search input { flex: 1; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 17px; outline: none; }
.pal-list { max-height: 50vh; overflow-y: auto; padding: 8px; margin: 0; }
.pal-group { font-family: var(--f-head); font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); padding: 12px 12px 6px; }
.pal-item { display: flex; align-items: center; gap: 14px; padding: 11px 12px; border-radius: 12px; cursor: pointer; }
.pal-item i { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--bg); color: var(--accent); flex: none; font-size: 14px; }
.pal-item b { display: block; font-weight: 600; font-size: 15px; }
.pal-item small { color: var(--muted); font-size: 13px; }
.pal-item[aria-selected='true'] { background: var(--accent-soft); }
.pal-item[aria-selected='true'] i { background: var(--accent); color: var(--on-accent); }
.pal-foot { display: flex; gap: 16px; padding: 12px 20px; border-top: 1px solid var(--line); color: var(--dim); font-size: 12.5px; }
.pal-empty { padding: 30px; text-align: center; color: var(--muted); }
@media (max-width: 900px) { .kbd-hint { display: none; } }
@media (max-width: 560px) { .to-top { left: 16px; bottom: 16px; } }
@media (prefers-reduced-motion: reduce) { .line-mask > span, .skill-tags span { transform: none; opacity: 1; } .page-curtain { display: none; } }
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) { z-index: 2; }

/* ---------- Performance ---------- */
.hero-glow { will-change: auto; }
