/* ============================================
   Tim Smith Portfolio
   Colors: cream #fcf9e8, dark #21201c, blue #0c48ff
   Fonts: Space Mono, Inter
   ============================================ */

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

:root {
  --color-bg: #e6e3dc;
  --color-text: #211f1b;
  --color-accent: #57544e;
  --eink-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
  --font-heading: 'Space Mono', monospace;
  --font-body: 'Inter', sans-serif;
}

/* Color theme (cream/blue) */
:root[data-theme="color"] {
  --color-bg: #fcf9e8;
  --color-text: #21201c;
  --color-accent: #0c48ff;
}


[data-theme="color"] .logo img,
[data-theme="color"] .logo:hover img {
  filter: brightness(0) saturate(100%) invert(22%) sepia(93%) saturate(7160%) hue-rotate(226deg) brightness(98%) contrast(106%);
  opacity: 1;
}

[data-theme="color"] .nav-link {
  color: var(--color-accent);
  opacity: 0.5;
}

[data-theme="color"] .nav-link:hover {
  opacity: 1;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* ============================================
   Layout — Full viewport, centered marquee
   ============================================ */

.site-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  transition: filter 0.4s ease;
}

/* Blur + dither background when modal is open */
body.modal-open .site-wrapper {
  filter: blur(2px) brightness(0.7);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Crect x='0' y='0' width='2' height='2' fill='white'/%3E%3Crect x='2' y='2' width='2' height='2' fill='white'/%3E%3C/svg%3E");
  -webkit-mask-size: 4px 4px;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Crect x='0' y='0' width='2' height='2' fill='white'/%3E%3Crect x='2' y='2' width='2' height='2' fill='white'/%3E%3C/svg%3E");
  mask-size: 4px 4px;
}

/* ============================================
   Header
   ============================================ */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
}

.header-ticker {
  overflow: hidden;
  width: 100%;
  padding: 12px 0;
  color: var(--color-bg);
  position: relative;
  pointer-events: auto;
}

.theme-toggle {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer !important;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  pointer-events: auto;
  transition: opacity 0.2s ease, transform 0.2s ease;
  opacity: 0.8;
}

.theme-toggle:hover {
  opacity: 1;
  transform: scale(1.15);
}

.theme-toggle img {
  height: 24px;
  width: auto;
}

.toggle-icon--eink {
  height: 20px !important;
}

.blue-toggle {
  cursor: pointer;
}

.header-micros {
  display: flex;
  align-items: center;
  gap: 35px;
  width: max-content;
  will-change: transform;
}

.header-micros img {
  width: auto;
  flex-shrink: 0;
}

.ticker-link {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  pointer-events: auto;
  cursor: pointer;
}

/* ============================================
   Marquee — Mouse-driven horizontal scroll
   ============================================ */


/* Swipe hint arrows — mobile only */
.swipe-hint {
  display: none;
  position: fixed;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  z-index: 50;
  pointer-events: none;
  justify-content: space-between;
  padding: 0 16px;
}

.swipe-hint-arrow {
  font-family: 'Space Mono', monospace;
  font-size: 48px;
  color: var(--color-text);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.swipe-hint.is-visible .swipe-hint-arrow {
  animation: hintPulse 3s ease-in-out forwards;
}

.swipe-hint.is-visible .swipe-hint-right {
  animation-delay: 0.15s;
}

@keyframes hintPulse {
  0% { opacity: 0; transform: translateX(0); }
  20% { opacity: 0.6; }
  50% { opacity: 0.6; transform: translateX(0); }
  80% { opacity: 0; transform: translateX(0); }
  100% { opacity: 0; }
}

.swipe-hint.is-visible .swipe-hint-left {
  animation-name: hintPulseLeft;
}
.swipe-hint.is-visible .swipe-hint-right {
  animation-name: hintPulseRight;
}

@keyframes hintPulseLeft {
  0% { opacity: 0; transform: translateX(0); }
  10% { opacity: 0.6; }
  50% { opacity: 0.6; transform: translateX(-8px); }
  90% { opacity: 0; transform: translateX(-12px); }
  100% { opacity: 0; }
}

@keyframes hintPulseRight {
  0% { opacity: 0; transform: translateX(0); }
  10% { opacity: 0.6; }
  50% { opacity: 0.6; transform: translateX(8px); }
  90% { opacity: 0; transform: translateX(12px); }
  100% { opacity: 0; }
}

@media (max-width: 768px) {
  .swipe-hint {
    display: flex;
  }
}

.marquee-container {
  flex: 1;
  overflow: hidden;
  position: relative;
  cursor: none;
}

.marquee-track {
  position: absolute;
  will-change: transform;
}

.marquee-item {
  position: absolute;
  font-family: var(--font-heading);
  font-size: 110px;
  letter-spacing: -0.04em;
  line-height: 1;
  cursor: none;
  user-select: none;
  white-space: nowrap;
}

.marquee-number {
  font-size: 0.35em;
  vertical-align: super;
  opacity: 0.5;
  margin-right: 4px;
  letter-spacing: 0;
}

.marquee-item a,
.marquee-item a:link,
.marquee-item a:visited {
  cursor: none;
  text-decoration: none;
  color: var(--color-text) !important;
  position: relative;
  display: inline-block;
}

.marquee-item a:hover {
  opacity: 0;
  transition: opacity 0.15s ease;
}

.marquee-separator {
  display: none;
  font-family: var(--font-heading);
  font-size: 40px;
  font-weight: 700;
  color: var(--color-accent);
  padding: 0 25px;
  margin-left: -40px;
  user-select: none;
  flex-shrink: 0;
  visibility: hidden;
}

/* ============================================
   Cursor — Eye icon + Thumbnail
   ============================================ */

/* Crosshair lines */
.crosshair-x {
  position: fixed;
  top: 0;
  left: 0;
  width: 1.5px;
  height: 100vh;
  background: var(--color-text);
  opacity: 0;
  pointer-events: none;
  z-index: 999;
  transition: opacity 0.3s ease;
  transform: translateX(-1px);
}

.crosshair-y {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 1.5px;
  background: var(--color-text);
  opacity: 0;
  pointer-events: none;
  z-index: 999;
  transition: opacity 0.3s ease;
  transform: translateY(-1px);
}

.crosshair-x.is-visible,
.crosshair-y.is-visible {
  opacity: 0.15;
}

.crosshair-dot {
  position: fixed;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #b5b0a1;
  opacity: 0;
  pointer-events: none;
  z-index: 1000;
  transform: translate(-3px, -3px);
  transition: opacity 0.3s ease;
}

.crosshair-dot.is-visible {
  opacity: 0.6;
}

.custom-cursor {
  position: fixed;
  pointer-events: none;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.custom-cursor.is-visible {
  opacity: 1;
}

.cursor-eye {
  width: 0;
  height: 0;
  display: none;
}

.cursor-eye svg {
  width: 32px;
  height: 32px;
}

.cursor-thumbnail {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 320px;
  height: 220px;
  border-radius: 6px;
  overflow: visible;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.cursor-thumbnail.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Corner crop marks — offset plus at each corner */
.cursor-thumbnail::before,
.cursor-thumbnail::after {
  content: '';
  position: absolute;
  background: var(--color-text);
  opacity: 0.15;
  pointer-events: none;
}

/* Horizontal bars of each plus */
.cursor-thumbnail::before {
  width: 14px;
  height: 1.5px;
  top: -10.75px;
  left: -17px;
  box-shadow:
    340px 0 0 0 var(--color-text),
    0 240px 0 0 var(--color-text),
    340px 240px 0 0 var(--color-text);
}

/* Vertical bars of each plus */
.cursor-thumbnail::after {
  width: 1.5px;
  height: 14px;
  top: -17px;
  left: -10.75px;
  box-shadow:
    340px 0 0 0 var(--color-text),
    0 240px 0 0 var(--color-text),
    340px 240px 0 0 var(--color-text);
}

.cursor-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

/* ============================================
   Footer
   ============================================ */

.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 20px 28px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
}

.site-footer > * {
  pointer-events: auto;
}

.logo {
  text-decoration: none;
  display: flex;
  align-items: center;
}

.logo img {
  height: 18px;
  width: auto;
  filter: grayscale(1) brightness(1.4) sepia(0.3);
  opacity: 0.5;
  transition: filter 0.3s ease, opacity 0.3s ease;
}

.logo:hover img {
  filter: none;
  opacity: 1;
}

.footer-nav {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 24px;
}

.nav-link {
  font-family: var(--font-heading);
  font-size: 13px;
  color: #b5b0a1;
  text-decoration: none;
  line-height: 1.4;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: var(--color-accent);
}

.nav-link:hover {
  color: var(--color-accent);
}

/* ============================================
   Project Modal
   ============================================ */

.modal-overlay {
  display: none;
  justify-content: center;
  align-items: flex-start;
  padding-top: 50px;
  min-height: 100vh;
  z-index: 200;
  cursor: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='4' y1='4' x2='20' y2='20' stroke='%230c48ff' stroke-width='2.5' stroke-linecap='round'/%3E%3Cline x1='20' y1='4' x2='4' y2='20' stroke='%230c48ff' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E") 12 12, pointer;
}

.modal-overlay.is-open {
  display: flex;
  padding-bottom: 50px;
}

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  cursor: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='4' y1='4' x2='20' y2='20' stroke='%230c48ff' stroke-width='2.5' stroke-linecap='round'/%3E%3Cline x1='20' y1='4' x2='4' y2='20' stroke='%230c48ff' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E") 12 12, pointer;
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 900px;
  background-color: var(--color-text);
  color: var(--color-bg);
  z-index: 1;
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.4s ease, opacity 0.4s ease;
  cursor: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cline x1='4' y1='4' x2='20' y2='20' stroke='%230c48ff' stroke-width='2.5' stroke-linecap='round'/%3E%3Cline x1='20' y1='4' x2='4' y2='20' stroke='%230c48ff' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E") 12 12, pointer;
  border-radius: 12px;
  overflow: hidden;
}

.modal-overlay.is-open .modal-content {
  transform: translateY(0);
  opacity: 1;
}

.modal-hero {
  width: 100%;
  overflow: hidden;
}

.modal-hero img {
  width: 100%;
  display: block;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 28px 36px 0;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 28px;
  letter-spacing: -0.04em;
  flex: 1;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--color-accent);
  font-family: var(--font-heading);
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: opacity 0.2s ease;
  flex-shrink: 0;
  margin-left: 20px;
  margin-top: 4px;
}

.modal-close-btn:hover {
  opacity: 0.6;
}

.modal-body {
  padding: 12px 36px 60px;
}

.modal-roles {
  font-family: var(--font-heading);
  font-size: 12px;
  margin-bottom: 24px;
}

.modal-roles .role-label {
  color: var(--color-bg);
  text-decoration: none;
  margin-right: 4px;
}

.modal-roles span {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.modal-roles .role-sep {
  color: var(--color-accent);
  text-decoration: none;
  margin: 0 4px;
}

.modal-description {
  font-family: var(--font-heading);
  font-size: 12px;
  line-height: 1.8;
  margin-bottom: 36px;
  max-width: 640px;
}

.modal-impact {
  margin-bottom: 40px;
}

.modal-impact h3 {
  font-family: var(--font-heading);
  font-size: 20px;
  letter-spacing: -0.04em;
  margin-bottom: 16px;
}

.modal-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.modal-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: 12px;
}

.modal-stat .stat-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border: 1px solid var(--color-accent);
  border-radius: 20px;
  color: var(--color-accent);
  font-weight: 700;
  font-size: 13px;
}

.modal-gallery {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-gallery > img {
  width: 100%;
  border-radius: 4px;
}

/* Gallery row — flexible columns */
.gallery-row {
  display: grid;
  gap: 4px;
}

.gallery-row--1col {
  grid-template-columns: 1fr;
}

.gallery-row--2col {
  grid-template-columns: 1fr 1fr;
}

.gallery-col {
  min-width: 0;
  overflow: hidden;
}

.gallery-col img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 4px;
}

/* Section headings inside gallery */
.gallery-section-heading {
  font-family: var(--font-heading);
  font-size: 20px;
  letter-spacing: -0.04em;
  color: var(--color-bg);
  padding: 28px 0 12px;
}

/* Text blocks inside gallery */
.gallery-text {
  font-family: var(--font-heading);
  font-size: 12px;
  line-height: 1.8;
  color: var(--color-bg);
  padding: 8px 0;
}

.gallery-text p {
  margin-bottom: 12px;
}

/* Modal tap hint (mobile) */
.modal-tap-hint {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-heading);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  background: var(--color-bg);
  border: 1.5px solid var(--color-accent);
  border-radius: 20px;
  padding: 8px 18px;
  z-index: 300;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}

.modal-tap-hint.is-visible {
  opacity: 1;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
  /* Marquee — smaller, tighter overlap on mobile */
  .marquee-item {
    font-size: 40px;
    padding: 0;
    margin-left: -24px;
    cursor: auto;
  }

  .marquee-item:first-child {
    margin-left: 0;
  }

  /* Mobile marquee — horizontal swipe with stagger */
  .marquee-container {
    cursor: auto;
    display: flex;
    align-items: center;
  }

  .marquee-track {
    position: relative;
    display: flex;
    align-items: center;
    white-space: nowrap;
  }

  .marquee-item {
    position: relative;
    font-size: 40px;
    padding: 0 8px;
    margin-left: -12px;
    cursor: auto;
  }

  .marquee-item:first-child {
    margin-left: 0;
  }

  .marquee-item a {
    cursor: auto;
  }

  .marquee-item:nth-child(7n+1) { transform: translateY(-15vh); }
  .marquee-item:nth-child(7n+2) { transform: translateY(10vh); }
  .marquee-item:nth-child(7n+3) { transform: translateY(-5vh); }
  .marquee-item:nth-child(7n+4) { transform: translateY(18vh); }
  .marquee-item:nth-child(7n+5) { transform: translateY(-12vh); }
  .marquee-item:nth-child(7n+6) { transform: translateY(5vh); }
  .marquee-item:nth-child(7n+7) { transform: translateY(-2vh); }

  .marquee-separator {
    display: none;
  }

  /* Title hover — no fade on mobile (no cursor thumbnail) */
  .marquee-item a:hover {
    opacity: 1;
  }

  /* Hide custom cursor on touch */
  .custom-cursor,
  .crosshair-x,
  .crosshair-y,
  .crosshair-dot {
    display: none !important;
  }

  /* Footer — logo left, nav right, hide mirrored logo */
  .footer-logo-right {
    display: none;
  }

  .site-footer {
    padding: 16px 20px;
  }

  .footer-nav {
    gap: 16px;
  }

  .nav-link {
    font-size: 12px;
  }

  .logo img {
    height: 14px;
  }

  /* Header ticker */
  .header-micros {
    gap: 28px;
  }

  /* Modal — full width, less padding */
  .modal-overlay {
    padding-top: 40px;
    cursor: auto;
  }

  .modal-overlay.is-open {
    padding-bottom: 40px;
  }

  .modal-backdrop {
    cursor: auto;
  }

  .modal-content {
    max-width: 100%;
    border-radius: 8px;
    margin: 0 8px;
    cursor: auto;
  }

  .modal-header {
    padding: 20px 20px 0;
  }

  .modal-title {
    font-size: 22px;
  }

  .modal-body {
    padding: 12px 20px 40px;
  }

  .modal-stats {
    gap: 12px;
  }

  .modal-description {
    font-size: 11px;
  }
}
