/* ========================================
   ROPEISM — UNIFIED DESIGN SYSTEM
   Dark cinematic aesthetic throughout
   ======================================== */

/* ========================================
   FONTS
   ======================================== */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&display=swap');

/* ========================================
   DESIGN TOKENS
   ======================================== */
:root {
  /* Colors — Dark mode only */
  --bg: #0a0a09;
  --bg-subtle: rgba(255, 255, 255, 0.03);
  --ink: #f5f2eb;
  --ink-muted: #8a857a;
  --accent: #d4c8b0;
  --border: rgba(255, 255, 255, 0.08);

  /* Typography */
  --font-display: "Instrument Serif", Georgia, serif;
  --font-body: system-ui, -apple-system, sans-serif;

  /* Spacing */
  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 48px;
  --space-xl: 80px;
  --page-gutter: clamp(20px, 5vw, 80px);

  /* Radii */
  --radius: 8px;
  --radius-lg: 16px;
}

/* ========================================
   RESET & BASE
   ======================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  /* scroll-behavior: smooth; <--- CONFLICTS WITH LENIS */
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Page transitions */
body {
  opacity: 0;
  transition: opacity 400ms ease;
}

body.is-loaded {
  opacity: 1;
}

body.is-exiting {
  opacity: 0;
}

/* ========================================
   TYPOGRAPHY
   ======================================== */
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.1;
  margin: 0 0 var(--space-sm);
}

h1 {
  font-size: clamp(2.5rem, 8vw, 5rem);
}

h2 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
}

h3 {
  font-size: 1.25rem;
}

p {
  margin: 0 0 var(--space-sm);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.2s;
}

a:hover {
  opacity: 0.7;
}

.muted {
  color: var(--ink-muted);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ========================================
   ACCESSIBILITY
   ======================================== */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ========================================
   NAVIGATION — Consistent across all pages
   ======================================== */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 20px var(--page-gutter);
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
}

.brand {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--ink);
  text-decoration: none;
  z-index: 101;
}

.brand:hover {
  opacity: 1;
}

/* Nav links */
#primary-nav ul {
  display: flex;
  gap: 32px;
  list-style: none;
  margin: 0;
  padding: 0;
}

#primary-nav a {
  color: var(--ink);
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  opacity: 0.6;
  transition: opacity 0.2s;
}

#primary-nav a:hover,
#primary-nav a[aria-current="page"] {
  opacity: 1;
}

/* Mobile menu button */
#navbtn {
  display: none;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.85rem;
  cursor: pointer;
  z-index: 101;
}

@media (max-width: 768px) {
  #navbtn {
    display: block;
  }

  #primary-nav {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
  }

  #primary-nav.is-open {
    opacity: 1;
    visibility: visible;
  }

  #primary-nav ul {
    flex-direction: column;
    align-items: center;
    gap: 24px;
  }

  #primary-nav a {
    font-family: var(--font-display);
    font-size: 2rem;
  }
}

/* ========================================
   LAYOUT UTILITIES
   ======================================== */
.wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: var(--space-xl) var(--page-gutter);
}

.wrap-wide {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-xl) var(--page-gutter);
}

.grid-2 {
  display: grid;
  gap: var(--space-md);
}

@media (min-width: 640px) {
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  background: var(--ink);
  color: var(--bg);
  border: none;
  border-radius: 999px;
  font-size: 0.95rem;
  font-family: var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
}

.btn:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
}

/* ========================================
   TAGS
   ======================================== */
.tag {
  display: inline-block;
  padding: 4px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}

/* ========================================
   IMAGE FRAMES
   ======================================== */
.img-frame {
  margin: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.img-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ========================================
   FOOTER
   ======================================== */
footer {
  padding: var(--space-lg) var(--page-gutter);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--ink-muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
}

footer span:last-child {
  font-family: var(--font-display);
  font-style: italic;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  body {
    transition: none;
    opacity: 1;
  }

  * {
    transition: none !important;
  }
}

/* ========================================
   CUSTOM CURSOR (Global)
   ======================================== */
@media (pointer: fine) {

  /* Only hide default cursor if we have the custom one replaced */
  body.has-custom-cursor {
    cursor: none;
  }

  /* Fallback: If we just want it everywhere */
  body {
    /* We'll handle cursor hiding via class or just let it overlay */
  }

  .cursor-dot {
    position: fixed;
    top: 0;
    left: 0;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s, background-color 0.3s, opacity 0.3s;
    mix-blend-mode: exclusion;
    opacity: 0;
    /* Hidden by default until moved */
  }

  body:hover .cursor-dot {
    opacity: 1;
  }

  /* Hover state for cursor */
  body.is-hovering .cursor-dot {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.5);
  }
}