/* ============================================
   FORMIST — Architecture Studio
   GSAP + Three.js + Editorial
   ============================================ */
:root {
  --bg: #0C0C0C;
  --bg-light: #F4F1EB;
  --bg-card: #141414;
  --white: #FFFDF8;
  --text: #E5E0D8;
  --text-dim: rgba(229,224,216,.45);
  --text-muted: rgba(229,224,216,.25);
  --text-dark: #1A1A1A;
  --text-dark-dim: #6B6860;
  --border: rgba(229,224,216,.08);
  --border-light: #D8D4CC;
  --accent: #D4622B;
  --accent-hover: #E8763E;
  --font: 'Syne', system-ui, sans-serif;
  --body: 'DM Sans', system-ui, sans-serif;
  --mono: 'Space Mono', monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-out: cubic-bezier(0, 0, .2, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
}

/* Reset */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { font-family: var(--body); background: var(--bg); color: var(--text); line-height: 1.6; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
img, video { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--white); }

/* ============================================
   TYPOGRAPHY
   ============================================ */
.t-huge { font-family: var(--font); font-size: clamp(3.8rem, 11vw, 12rem); font-weight: 700; line-height: .85; letter-spacing: -.04em; text-transform: uppercase; }
.t-display { font-family: var(--font); font-size: clamp(2.5rem, 6vw, 7rem); font-weight: 700; line-height: .9; letter-spacing: -.03em; text-transform: uppercase; }
.t-h1 { font-family: var(--font); font-size: clamp(2rem, 4vw, 4.2rem); font-weight: 700; line-height: 1; letter-spacing: -.02em; text-transform: uppercase; }
.t-h2 { font-family: var(--font); font-size: clamp(1.4rem, 2.5vw, 2.6rem); font-weight: 600; line-height: 1.1; letter-spacing: -.01em; }
.t-h3 { font-family: var(--font); font-size: clamp(1.1rem, 1.5vw, 1.5rem); font-weight: 600; line-height: 1.25; }
.t-body-lg { font-family: var(--body); font-size: clamp(1.05rem, 1.3vw, 1.2rem); line-height: 1.7; font-weight: 400; }
.t-body { font-family: var(--body); font-size: .95rem; line-height: 1.75; font-weight: 400; }
.t-sm { font-family: var(--body); font-size: .82rem; line-height: 1.6; }
.t-label { font-family: var(--font); font-size: .68rem; letter-spacing: .2em; text-transform: uppercase; font-weight: 600; }
.t-accent { color: var(--accent); }
.t-thin { font-weight: 400; text-transform: none; letter-spacing: normal; }

/* ============================================
   LAYOUT
   ============================================ */
.wrap { max-width: 1400px; margin: 0 auto; padding: 0 clamp(20px, 4vw, 64px); }
.wrap-narrow { max-width: 900px; margin: 0 auto; padding: 0 clamp(20px, 4vw, 64px); }
.wrap-wide { max-width: 1800px; margin: 0 auto; padding: 0 clamp(20px, 4vw, 64px); }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* ============================================
   CUSTOM CURSOR
   ============================================ */
.cursor {
  position: fixed; width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid var(--accent); pointer-events: none; z-index: 9999;
  transform: translate(-50%, -50%); transition: width .3s var(--ease), height .3s var(--ease), border-color .3s;
  mix-blend-mode: difference; left: -100px; top: -100px;
}
.cursor.hovering { width: 48px; height: 48px; border-color: var(--accent-hover); }
@media(pointer: coarse) { .cursor { display: none; } }

/* ============================================
   PRELOADER
   ============================================ */
.preloader {
  position: fixed; inset: 0; z-index: 9000; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .6s var(--ease);
}
.preloader.done { opacity: 0; pointer-events: none; }
.preloader-text { font-family: var(--font); font-size: clamp(1.2rem, 3vw, 2rem); font-weight: 700; letter-spacing: .15em; text-transform: uppercase; color: var(--text); opacity: 0; }

/* ============================================
   NAVIGATION
   ============================================ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: 72px; display: flex; align-items: center;
  padding: 0 clamp(20px, 4vw, 64px);
  transition: background .4s var(--ease), transform .5s var(--ease);
}
.nav.scrolled { background: rgba(12,12,12,.85); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); border-bottom: 1px solid var(--border); }
.nav.hide { transform: translateY(-100%); }
.nav-logo { font-family: var(--font); font-size: 1rem; letter-spacing: .2em; font-weight: 700; text-transform: uppercase; }
.nav-right { display: flex; align-items: center; gap: clamp(20px, 3vw, 40px); margin-left: auto; }
.nav-right a { font-family: var(--body); font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 500; color: var(--text-dim); transition: color .3s; }
.nav-right a:hover { color: var(--white); }
.nav-contact { color: var(--accent) !important; }
.nav-toggle { display: none; width: 26px; height: 18px; position: relative; z-index: 201; }
.nav-toggle span { position: absolute; left: 0; width: 100%; height: 1.5px; background: var(--text); transition: .4s var(--ease); }
.nav-toggle span:nth-child(1) { top: 0; }
.nav-toggle span:nth-child(2) { top: 50%; transform: translateY(-50%); }
.nav-toggle span:nth-child(3) { bottom: 0; }
.nav-toggle.open span:nth-child(1) { top: 50%; transform: translateY(-50%) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { bottom: 50%; transform: translateY(50%) rotate(-45deg); }
@media(max-width:768px) {
  .nav-toggle { display: block; }
  .nav-right { position: fixed; inset: 0; background: var(--bg); flex-direction: column; justify-content: center; align-items: center; gap: 28px; opacity: 0; pointer-events: none; transition: opacity .4s var(--ease); }
  .nav-right.open { opacity: 1; pointer-events: all; }
  .nav-right a { font-size: 1.1rem; letter-spacing: .08em; color: var(--text); }
}

/* ============================================
   HERO
   ============================================ */
.hero {
  min-height: 100vh; display: flex; align-items: flex-end;
  padding: 0 clamp(20px, 4vw, 64px) clamp(48px, 10vh, 120px);
  position: relative; overflow: hidden;
}
#hero-canvas { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; }
.hero-content { position: relative; z-index: 1; max-width: 1000px; }
.hero-title { overflow: hidden; }
.hero-line { overflow: hidden; display: block; }
.hero-line-inner { display: block; transform: translateY(110%); }
.hero-tagline { color: var(--text-dim); margin-top: 32px; max-width: 500px; }
.hero-cta { margin-top: 44px; }
.hero-cta a {
  font-family: var(--font); font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; font-weight: 600;
  display: inline-flex; align-items: center; gap: 12px; color: var(--accent); transition: gap .4s var(--ease);
}
.hero-cta a:hover { gap: 20px; }
.hero-cta a::after { content: '→'; font-size: 1.1rem; }
.hero-scroll {
  position: absolute; bottom: 32px; right: clamp(20px, 4vw, 64px); z-index: 1;
  writing-mode: vertical-rl; font-family: var(--font); font-size: .6rem; letter-spacing: .25em; text-transform: uppercase; color: var(--text-muted);
}
.hero-scroll::after { content: ''; display: block; width: 1px; height: 56px; background: var(--accent); margin-top: 14px; margin-left: auto; margin-right: auto; animation: scrollLine 2s ease-in-out infinite; }
@keyframes scrollLine { 0% { transform: scaleY(0); transform-origin: top; } 50% { transform: scaleY(1); transform-origin: top; } 51% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }

/* ============================================
   SECTION
   ============================================ */
.section { padding: clamp(100px, 14vh, 200px) 0; }
.section-sm { padding: clamp(60px, 8vh, 120px) 0; }
.section-light { background: var(--bg-light); color: var(--text-dark); }
.rule { height: 1px; background: var(--border); }
.section-light .rule { background: var(--border-light); }

/* Section header */
.section-head { margin-bottom: clamp(48px, 7vh, 96px); }
.section-head .t-label { color: var(--accent); margin-bottom: 20px; display: flex; align-items: center; gap: 12px; }
.section-head .t-label::before { content: ''; width: 24px; height: 2px; background: var(--accent); }

/* ============================================
   PROJECT GRID
   ============================================ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(8px, 1vw, 16px);
}
.proj { position: relative; overflow: hidden; cursor: pointer; }
.proj-img { width: 100%; height: 100%; overflow: hidden; background: var(--bg-card); }
.proj-img div, .proj-img img { width: 100%; height: 100%; object-fit: cover; }
.proj-info {
  position: absolute; bottom: 0; left: 0; right: 0; padding: clamp(16px, 2vw, 32px);
  background: linear-gradient(to top, rgba(0,0,0,.7) 0%, transparent 100%);
  color: var(--white); transform: translateY(10px); opacity: 0;
  transition: opacity .5s var(--ease), transform .5s var(--ease);
}
.proj:hover .proj-info { opacity: 1; transform: none; }
.proj-info h3 { font-family: var(--font); font-size: clamp(.9rem, 1.4vw, 1.5rem); font-weight: 600; margin-bottom: 4px; }
.proj-info span { font-family: var(--body); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; opacity: .6; }

/* Grid placements */
.proj-wide { grid-column: span 8; aspect-ratio: 21/9; }
.proj-half { grid-column: span 6; aspect-ratio: 4/3; }
.proj-third { grid-column: span 4; aspect-ratio: 3/4; }
.proj-quarter { grid-column: span 4; aspect-ratio: 4/3; }
@media(max-width:768px) {
  .proj-wide, .proj-half, .proj-third, .proj-quarter { grid-column: span 12; aspect-ratio: 16/10; }
}

/* ============================================
   ABOUT
   ============================================ */
.about-split {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: clamp(48px, 8vw, 140px); align-items: start;
}
.about-split .col-sticky { position: sticky; top: 120px; }
.section-light .about-text p { color: var(--text-dark-dim); margin-bottom: 24px; }
.section-light .about-text p:first-of-type { color: var(--text-dark); font-size: clamp(1.05rem, 1.3vw, 1.2rem); }
.about-img { aspect-ratio: 3/4; background: var(--border-light); overflow: hidden; }
@media(max-width:768px) { .about-split { grid-template-columns: 1fr; } .about-split .col-sticky { position: static; } }

/* Quote */
.quote-block { text-align: center; padding: clamp(60px, 10vh, 140px) 0; }
.quote { font-family: var(--font); font-size: clamp(1.3rem, 2.8vw, 2.8rem); line-height: 1.25; font-weight: 600; color: var(--text-dark); max-width: 820px; margin: 0 auto; }
.quote-attr { margin-top: 28px; font-family: var(--body); font-size: .75rem; letter-spacing: .15em; text-transform: uppercase; color: var(--text-dark-dim); }

/* ============================================
   SERVICES
   ============================================ */
.service-row {
  display: grid; grid-template-columns: 56px 1fr 1.2fr; gap: clamp(16px, 2vw, 32px);
  padding: clamp(28px, 3.5vh, 48px) 0;
  border-bottom: 1px solid var(--border);
  align-items: baseline; transition: opacity .4s var(--ease);
}
.services-wrap:hover .service-row { opacity: .3; }
.services-wrap:hover .service-row:hover { opacity: 1; }
.service-num { font-family: var(--mono); font-size: .8rem; color: var(--accent); }
.service-name { font-family: var(--font); font-size: clamp(1.15rem, 2vw, 1.8rem); font-weight: 600; line-height: 1.2; }
.service-desc { font-family: var(--body); font-size: .88rem; color: var(--text-dim); line-height: 1.7; }
@media(max-width:768px) { .service-row { grid-template-columns: 40px 1fr; } .service-desc { grid-column: 2; } }

/* ============================================
   TIMELINE
   ============================================ */
.tl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(48px, 6vw, 96px); }
@media(max-width:768px) { .tl-grid { grid-template-columns: 1fr; } }
.tl-col-title { font-family: var(--font); font-size: .68rem; letter-spacing: .2em; text-transform: uppercase; font-weight: 600; color: var(--text-dim); margin-bottom: 24px; }
.tl-item { padding: 20px 0; border-bottom: 1px solid var(--border); }
.tl-year { font-family: var(--mono); font-size: .72rem; color: var(--accent); margin-bottom: 8px; }
.tl-title { font-family: var(--font); font-size: 1.05rem; font-weight: 600; margin-bottom: 4px; }
.tl-sub { font-family: var(--body); font-size: .82rem; color: var(--text-dim); }

/* ============================================
   AWARDS
   ============================================ */
.awards-row { display: flex; gap: clamp(12px, 1.5vw, 20px); overflow-x: auto; padding-bottom: 16px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.awards-row::-webkit-scrollbar { display: none; }
.award {
  flex: 0 0 auto; width: clamp(260px, 22vw, 320px); padding: clamp(24px, 3vw, 36px);
  border: 1px solid var(--border); scroll-snap-align: start;
  transition: border-color .4s var(--ease), background .4s var(--ease);
}
.award:hover { border-color: var(--accent); background: var(--bg-card); }
.award-yr { font-family: var(--mono); font-size: .68rem; color: var(--accent); margin-bottom: 16px; }
.award-name { font-family: var(--font); font-size: .95rem; font-weight: 600; margin-bottom: 8px; line-height: 1.3; }
.award-detail { font-family: var(--body); font-size: .78rem; color: var(--text-dim); line-height: 1.6; }

/* ============================================
   BLOG
   ============================================ */
.blog-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(24px, 3vw, 40px); }
@media(max-width:900px) { .blog-grid { grid-template-columns: 1fr; } }
.blog-item { cursor: pointer; }
.blog-img { aspect-ratio: 3/2; overflow: hidden; background: var(--bg-card); margin-bottom: 20px; }
.blog-img div { width: 100%; height: 100%; }
.blog-tag { font-family: var(--font); font-size: .62rem; letter-spacing: .2em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin-bottom: 10px; }
.blog-item h3 { font-family: var(--font); font-size: clamp(1rem, 1.4vw, 1.3rem); font-weight: 600; line-height: 1.3; margin-bottom: 10px; transition: color .3s; }
.blog-item:hover h3 { color: var(--accent); }
.blog-item p { font-family: var(--body); font-size: .85rem; color: var(--text-dim); line-height: 1.65; }
.blog-date { font-family: var(--body); font-size: .72rem; color: var(--text-muted); margin-top: 14px; }

/* Blog page - light theme */
.blog-page { background: var(--bg-light); color: var(--text-dark); }
.blog-hero-page { padding: 140px 0 60px; }
.blog-page .section-head .t-label { color: var(--accent); }
.blog-page .section-head .t-label::before { background: var(--accent); }
.blog-featured { display: grid; grid-template-columns: 1.2fr 1fr; gap: clamp(32px, 4vw, 64px); align-items: center; padding: clamp(40px, 5vh, 80px) 0; }
.blog-featured-img { aspect-ratio: 16/10; overflow: hidden; background: var(--border-light); }
.blog-featured-body h2 { font-family: var(--font); font-size: clamp(1.5rem, 2.5vw, 2.4rem); font-weight: 700; margin-bottom: 16px; line-height: 1.15; }
.blog-featured-body p { font-family: var(--body); color: var(--text-dark-dim); margin-bottom: 16px; }
.blog-read-more { font-family: var(--font); font-size: .72rem; letter-spacing: .15em; text-transform: uppercase; font-weight: 600; color: var(--accent); display: inline-flex; align-items: center; gap: 8px; transition: gap .3s; }
.blog-read-more:hover { gap: 14px; }
.blog-read-more::after { content: '→'; }
@media(max-width:768px) { .blog-featured { grid-template-columns: 1fr; } }
.blog-page .blog-item h3 { color: var(--text-dark); }
.blog-page .blog-item:hover h3 { color: var(--accent); }
.blog-page .blog-item p { color: var(--text-dark-dim); }
.blog-page .blog-date { color: #999; }
.blog-page .blog-img { background: var(--border-light); }
.blog-page .rule { background: var(--border-light); }

/* ============================================
   CONTACT
   ============================================ */
.contact-split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(48px, 8vw, 140px); align-items: start; }
@media(max-width:768px) { .contact-split { grid-template-columns: 1fr; } }
.contact-info-block { margin-bottom: 36px; }
.contact-info-block .t-label { color: var(--text-dim); margin-bottom: 10px; }
.contact-info-block a { font-family: var(--font); font-size: clamp(1rem, 1.5vw, 1.35rem); font-weight: 600; transition: color .3s; }
.contact-info-block a:hover { color: var(--accent); }

/* ============================================
   FOOTER
   ============================================ */
.footer { padding: clamp(48px, 6vh, 80px) 0; border-top: 1px solid var(--border); }
.footer-inner { display: flex; justify-content: space-between; align-items: start; flex-wrap: wrap; gap: 32px; }
.footer-logo { font-family: var(--font); font-size: .9rem; letter-spacing: .2em; font-weight: 700; text-transform: uppercase; }
.footer-links { display: flex; gap: clamp(32px, 4vw, 64px); }
.footer-col h4 { font-family: var(--font); font-size: .6rem; letter-spacing: .2em; text-transform: uppercase; font-weight: 600; color: var(--text-dim); margin-bottom: 14px; }
.footer-col a { display: block; font-family: var(--body); font-size: .82rem; color: var(--text-dim); padding: 3px 0; transition: color .3s; }
.footer-col a:hover { color: var(--white); }
.footer-copy { margin-top: clamp(40px, 5vh, 64px); font-family: var(--body); font-size: .72rem; color: var(--text-muted); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
/* Blog page footer overrides */
.blog-page .footer { border-top-color: var(--border-light); }
.blog-page .footer-col a { color: var(--text-dark-dim); }
.blog-page .footer-col a:hover { color: var(--text-dark); }
.blog-page .footer-copy { color: #999; }

/* ============================================
   MARQUEE
   ============================================ */
.marquee { overflow: hidden; padding: clamp(20px, 3vh, 40px) 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.marquee-track { display: flex; width: max-content; }
.marquee-item { font-family: var(--font); font-size: clamp(2rem, 5vw, 5rem); font-weight: 700; text-transform: uppercase; white-space: nowrap; padding: 0 clamp(20px, 3vw, 48px); color: var(--text-muted); letter-spacing: -.02em; }
.marquee-item .dot { display: inline-block; width: 8px; height: 8px; background: var(--accent); border-radius: 50%; margin: 0 clamp(16px, 2vw, 32px); vertical-align: middle; }

/* ============================================
   ANIMATIONS — GSAP driven, CSS fallbacks
   ============================================ */
.reveal { opacity: 0; transform: translateY(40px); }
.reveal.active { opacity: 1; transform: none; transition: opacity .8s var(--ease), transform .8s var(--ease); }
.stg-reveal > * { opacity: 0; transform: translateY(30px); }

/* Image clip reveal */
.img-clip { clip-path: inset(100% 0 0 0); }
.img-clip.active { clip-path: inset(0); transition: clip-path 1.2s var(--ease); }

/* Smooth scroll */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
