/* ================================================================
   global.css — Da'anong Gyang DP v2
   Shared across all pages. Mirrors Danik Bartolini visual system.
   ================================================================ */

:root {
  --bg:     #0c0c0c;
  --text:   #f5f6f4;
  --muted:  #6e6e6e;
  --line:   rgba(245, 246, 244, 0.14);
  --accent: #1a6aff;
  --max-w:  1200px;
  --header-h: 62px;
  --pad:    clamp(16px, 3vw, 32px);
  --font-display: "Inter", sans-serif;
  --font-body:    "Inter", sans-serif;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  opacity: 0;
}
body.is-loaded {
  animation: pageEnter 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
body.page-exit {
  animation: pageExit 0.38s cubic-bezier(0.55, 0, 1, 0.45) forwards;
  pointer-events: none;
}
body.nav-open  { overflow: hidden; }

@keyframes pageEnter {
  from { opacity: 0; transform: translateX(22px); }
  to   { opacity: 1; transform: translateX(0);    }
}
@keyframes pageExit {
  to { opacity: 0; transform: translateX(-22px); }
}
a { color: inherit; text-decoration: none; transition: opacity 0.2s ease; }
a:hover { opacity: 0.7; }
img, video { display: block; max-width: 100%; }
ul, ol { list-style: none; padding: 0; margin: 0; }
button { font: inherit; background: none; border: none; cursor: pointer; color: inherit; padding: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: 400; }

/* ---- Layout ---- */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Progress bars (Danik signature) ---- */
.progress-track {
  display: flex;
  gap: 6px;
  align-items: center;
}
.progress-track .bar {
  height: 12px;
  background-color: var(--text);
  flex-shrink: 0;
}
.progress-track--muted .bar {
  background-color: var(--muted);
  height: 15px;
}

/* ---- MPA page transitions (Chrome 126+ via View Transition API) ---- */
@view-transition { navigation: auto; }
@keyframes vtExit  { to   { opacity: 0; transform: translateX(-22px); } }
@keyframes vtEnter { from { opacity: 0; transform: translateX(22px);  } }
::view-transition-old(root) { animation: 0.45s cubic-bezier(0.83, 0, 0.17, 1) both vtExit;  }
::view-transition-new(root) { animation: 0.45s cubic-bezier(0.83, 0, 0.17, 1) both vtEnter; }
/* Header persists during transitions */
.site-header { view-transition-name: site-header; }
::view-transition-old(site-header),
::view-transition-new(site-header) { animation: none; }

/* ---- Scroll reveal ---- */
[data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.85s cubic-bezier(0.645, 0.045, 0.355, 1),
              transform 0.85s cubic-bezier(0.645, 0.045, 0.355, 1);
}
[data-reveal].is-visible { opacity: 1; transform: translateY(0); }
[data-reveal-stagger="2"] { transition-delay: 0.12s; }
[data-reveal-stagger="3"] { transition-delay: 0.24s; }

/* ---- Card hover opacity (cinematic dim) ---- */
.work-card:hover .work-card__img,
.portfolio-card:hover .portfolio-card__img { opacity: 0.72; }

/* ---- Card info: title + meta label below thumbnail ---- */
.work-card__info,
.portfolio-card__info  { padding: 12px 0 0; }
.work-card__title,
.portfolio-card__title { display: block; font-size: 14px; }
.work-card__meta,
.portfolio-card__meta  { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }

@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  body.is-loaded { animation: none; opacity: 1; }
  body.page-exit { animation: none; }
}

/* ---- Header (fixed, dark) ---- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-h);
  background: var(--bg);
  z-index: 200;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.header-inner {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo {
  font-size: 15px;
  font-weight: 400;
  white-space: nowrap;
}
.logo span {
  font-weight: 400;
  opacity: 0.45;
}
.main-nav {
  display: flex;
  gap: 28px;
  font-size: 14px;
}

/* Mobile menu trigger */
.nav-trigger {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 26px;
  padding: 4px 0;
  background: none;
  border: none;
  cursor: pointer;
}
.nav-trigger__line {
  display: block;
  height: 1px;
  background: var(--text);
  width: 100%;
}

/* Hide decorative bars at 900px — they overflow the header below this width */
@media (max-width: 900px) {
  .header-bars { display: none !important; }
  .footer-middle .progress-track--muted { display: none; }
}

@media (max-width: 768px) {
  .main-nav    { display: none !important; }
  .nav-trigger { display: flex; }
}

/* ---- Work nav overlay (category selector) ---- */
.work-nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 12, 12, 0.97);
  z-index: 250;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 8vw;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.work-nav-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}
.work-nav-close {
  position: absolute;
  top: 24px;
  right: 32px;
  font-size: 22px;
  color: var(--text);
  opacity: 0.45;
  transition: opacity 0.2s;
}
.work-nav-close:hover { opacity: 1; }
.work-nav-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.work-nav-item {
  font-size: clamp(44px, 8vw, 100px);
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--muted);
  line-height: 1.1;
  transition: color 0.18s ease;
  display: block;
  padding: 4px 0;
}
.work-nav-item:first-child { color: var(--text); }
.work-nav-item:hover { color: var(--text); opacity: 1; }

/* ---- Nav overlay (mobile full-screen) ---- */
.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(72, 72, 68, 0.78);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 300;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 22px 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.nav-overlay::before {
  content: "Da'anong\A Gyang";
  position: absolute;
  top: 20px;
  left: 24px;
  white-space: pre-line;
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 0.95;
  color: var(--text);
}
.nav-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}
.nav-close {
  position: absolute;
  top: 24px;
  right: 24px;
  font-size: 12px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.2s;
}
.nav-close:hover { opacity: 1; }
.nav-overlay .nav-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 170px;
}
.nav-overlay .nav-link {
  font-size: clamp(44px, 12vw, 70px);
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.08;
  color: var(--text);
}

/* ---- Shared footer ---- */
.site-footer {
  padding-top: 80px;
  padding-bottom: 40px;
  border-top: 1px solid var(--line);
  overflow: hidden;
}
.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 80px;
  flex-wrap: wrap;
  gap: 48px;
}
.footer-heading-group {
  display: flex;
  flex-direction: column;
}
.footer-name {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 14px;
  font-weight: 400;
}
.footer-heading {
  font-size: clamp(36px, 5vw, 56px);
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.footer-cols {
  display: flex;
  gap: 64px;
  flex-wrap: wrap;
}
.footer-col h4 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 16px;
  font-weight: 400;
}
.footer-col ul {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
}
.footer-middle {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 60px;
  font-size: 11px;
  color: var(--muted);
}
.footer-middle-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.footer-middle-col.progress-track {
  flex-direction: row;
  align-items: center;
  gap: 6px;
}
/* Huge scrolling name marquee */
.footer-marquee {
  overflow: hidden;
  white-space: nowrap;
  margin-bottom: 40px;
  user-select: none;
}
.footer-marquee__inner {
  display: inline-flex;
  gap: 80px;
  font-size: clamp(64px, 11vw, 160px);
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
  animation: marqSlide 18s linear infinite;
}
@keyframes marqSlide {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.footer-bottom {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

@media (max-width: 768px) {
  .site-footer          { padding-top: 48px; padding-bottom: 28px; }
  .footer-top           { display: grid; grid-template-columns: 1fr; gap: 34px; margin-bottom: 44px; }
  .footer-heading-group { width: 100%; }
  .footer-heading       { font-size: clamp(42px, 11vw, 54px); max-width: 8em; }
  .footer-cols          { width: 100%; display: grid; grid-template-columns: 1fr; gap: 24px; }
  .footer-col:nth-child(3) { grid-column: auto; }
  .footer-col h4        { font-size: 9px; margin-bottom: 10px; }
  .footer-col ul        { font-size: 14px; }
  .footer-col a         { overflow-wrap: anywhere; }
  .footer-col ul        { gap: 8px; }
  .footer-middle        { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; margin-bottom: 24px; align-items: start; }
  .footer-middle-col.progress-track { grid-column: 1 / -1; justify-content: flex-start; }
  .footer-marquee       { margin-bottom: 28px; }
  .footer-marquee__inner { gap: 40px; font-size: clamp(56px, 18vw, 76px); }
  .footer-bottom        { gap: 16px; }
  /* Work nav overlay: reduce font so long words don't overflow */
  .work-nav-item { font-size: clamp(28px, 9vw, 44px); }
}

/* ---- Next Project Nav ---- */
.next-project {
  padding: 40px 0 100px;
  border-top: 1px solid var(--line);
}
.next-project__link {
  display: block;
  transition: opacity 0.3s ease;
}
.next-project__link:hover {
  opacity: 1;
}
.next-project__label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 24px;
}
.next-project__title {
  font-size: clamp(40px, 6vw, 90px);
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.03em;
  transition: color 0.3s ease;
}
.next-project__link:hover .next-project__title {
  color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  .footer-marquee__inner { animation: none; }
}
