/* ============================================
   DCASTRO PORTFOLIO — Main Stylesheet
   Based on Pastel Editorial Design System
   ============================================ */

:root {
  /* --- Color: surfaces --- */
  --bg:        #F4EFE6;
  --surface:   #FAF6EE;
  --surface-2: #EFE7D6;
  --ink:       #2A2622;
  --ink-2:     #6B6258;
  --ink-3:     #A39A8C;
  --border:    #E5DCC9;
  --border-2:  #D4C8AF;

  /* --- Color: pastel accents --- */
  --primary:        #C97B5A;
  --primary-soft:   #ECC9B5;
  --primary-ink:    #6B3A22;
  --secondary:      #8FA48A;
  --secondary-soft: #CFD9C8;
  --secondary-ink:  #3F523A;
  --support-1: #C9BCD4;
  --support-2: #E8C7B5;
  --support-3: #B8C9D2;
  --support-4: #E1D5A8;

  /* signal */
  --success: #6F8E5B;
  --warning: #C99155;
  --danger:  #B65A4F;

  /* --- Type --- */
  --font-display: "Bricolage Grotesque", ui-sans-serif, sans-serif;
  --font-body:    "Hanken Grotesk", ui-sans-serif, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, monospace;

  --t-display: clamp(56px, 7vw, 96px);
  --t-h1:      clamp(40px, 4.6vw, 64px);
  --t-h2:      clamp(30px, 3.2vw, 44px);
  --t-h3:      clamp(22px, 2.2vw, 30px);
  --t-h4:      20px;
  --t-h5:      17px;
  --t-body:    16px;
  --t-small:   14px;
  --t-caption: 12px;

  /* --- Spacing (4-base) --- */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;
  --s-10: 128px;

  /* --- Radius --- */
  --r-1: 4px;
  --r-2: 6px;
  --r-3: 10px;
  --r-4: 16px;
  --r-pill: 999px;

  /* --- Shadow --- */
  --shadow-1: 0 1px 0 rgba(42, 38, 34, 0.04), 0 1px 2px rgba(42, 38, 34, 0.04);
  --shadow-2: 0 1px 0 rgba(42, 38, 34, 0.04), 0 4px 12px rgba(42, 38, 34, 0.06);
  --shadow-3: 0 1px 0 rgba(42, 38, 34, 0.04), 0 12px 28px rgba(42, 38, 34, 0.08);
  --shadow-focus: 0 0 0 3px rgba(201, 123, 90, 0.25);

  /* --- Motion --- */
  --ease: cubic-bezier(.2, .7, .2, 1);
  --dur-1: 120ms;
  --dur-2: 220ms;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  font-size: var(--t-body);
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--primary-soft); color: var(--primary-ink); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; }

/* ============================================
   LAYOUT
   ============================================ */
.shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--s-6);
}

/* ============================================
   SITE HEADER
   ============================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: var(--s-4) 0;
  background: var(--bg);
}
.site-header .shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-5);
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.header-brand {
  display: flex;
  align-items: center;
}
.header-logo {
  height: 24px;
  width: auto;
}

/* Contact icons */
.header-contact {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.header-contact a {
  color: var(--ink-2);
  transition: color var(--dur-2) var(--ease);
  display: flex;
  align-items: center;
}
.header-contact a:hover {
  color: var(--primary);
}

/* Rotating subtitle */
.header-subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  height: 16px;
  display: flex;
  align-items: center;
  gap: 0.4em;
}
.header-subtitle-static {
  white-space: nowrap;
  line-height: 16px;
}
.header-subtitle-rotate {
  height: 16px;
  overflow: hidden;
  position: relative;
}
.header-subtitle-inner {
  display: flex;
  flex-direction: column;
  animation: rotateText 8s var(--ease) infinite;
}
.header-subtitle-inner span {
  height: 16px;
  line-height: 16px;
  white-space: nowrap;
}
@keyframes rotateText {
  0%, 20%   { transform: translateY(0); }
  25%, 45%  { transform: translateY(-16px); }
  50%, 70%  { transform: translateY(-32px); }
  75%, 95%  { transform: translateY(-48px); }
  100%      { transform: translateY(-64px); }
}

/* Nav */
.header-nav {
  display: flex;
  align-items: center;
  gap: var(--s-1);
}
.header-nav a {
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-pill);
  font-size: var(--t-small);
  color: var(--ink-2);
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}
.header-nav a:hover,
.header-nav a.active {
  color: var(--ink);
  background: var(--surface-2);
}

/* Contact links inside nav (mobile only) */
.header-nav-contact {
  display: none;
}

/* Mobile menu */
.header-menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-2);
  border-radius: var(--r-pill);
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}
.header-menu-toggle svg { width: 20px; height: 20px; }

@media (max-width: 768px) {
  .header-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: var(--s-4);
    right: var(--s-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-3);
    box-shadow: var(--shadow-3);
    flex-direction: column;
    padding: var(--s-3);
    gap: var(--s-1);
  }
  .header-nav.open { display: flex; }
  .header-nav a { width: 100%; padding: var(--s-3) var(--s-4); }
  .header-contact { display: none; }
  .header-nav-contact {
    display: flex;
    gap: var(--s-2);
    padding: var(--s-3) var(--s-4);
    border-top: 1px solid var(--border);
    margin-top: var(--s-2);
  }
  .header-nav-contact a {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    color: var(--ink-2);
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: var(--s-2) var(--s-3);
    border-radius: var(--r-pill);
    transition: color var(--dur-2) var(--ease), background var(--dur-2) var(--ease);
  }
  .header-nav-contact a:hover {
    color: var(--primary);
    background: var(--surface-2);
  }
  .header-nav-contact a svg { flex-shrink: 0; }
  .header-menu-toggle { display: inline-flex; order: 2; }
  .site-header .shell { position: relative; }
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  margin-top: var(--s-9);
  padding: var(--s-7) 0 var(--s-6);
  border-top: 1px solid var(--border);
}
.site-footer .shell {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--s-5);
  flex-wrap: wrap;
}
.footer-left {
  flex-shrink: 0;
}
.footer-logo {
  height: clamp(40px, 6vw, 72px);
  width: auto;
}
.footer-contact {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-3);
}
.footer-contact a {
  color: var(--ink-3);
  transition: color var(--dur-2) var(--ease);
}
.footer-contact a:hover {
  color: var(--primary);
}
.footer-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ============================================
   HERO (index.html)
   ============================================ */
.hero {
  position: relative;
  width: 100%;
  height: 80vh;
  min-height: 400px;
  max-height: 700px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: rgba(42, 38, 34, 0.35);
}
.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: var(--s-6);
}
.hero-title {
  font-family: var(--font-display);
  font-size: var(--t-display);
  line-height: 0.95;
  letter-spacing: -0.035em;
  font-weight: 500;
  color: var(--surface);
  margin: 0;
  text-wrap: balance;
}
.hero-title em {
  font-style: italic;
  font-weight: 400;
  color: var(--primary-soft);
}

/* ============================================
   FILTER BAR
   ============================================ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-7) 0 var(--s-6);
  flex-wrap: wrap;
}
.filter-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-pill);
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: all var(--dur-2) var(--ease);
}
.filter-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.filter-btn.active {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}

/* ============================================
   PROJECT GRID (cards)
   ============================================ */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-5);
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease);
  opacity: 0;
  transform: translateY(20px);
}
.project-card.visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease), box-shadow var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease);
}
.project-card:hover {
  border-color: var(--border-2);
  box-shadow: var(--shadow-2);
  transform: translateY(-2px);
}
.project-card.visible:hover {
  transform: translateY(-2px);
}

.project-card-media {
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--surface-2);
}
.project-card-media img,
.project-card-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease);
}
.project-card:hover .project-card-media img,
.project-card:hover .project-card-media video {
  transform: scale(1.03);
}

.project-card-body {
  padding: var(--s-3) var(--s-4);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.project-card-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-3);
}
.project-card-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.25;
}
.project-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: auto;
  padding-top: var(--s-2);
}
.project-card-tags .tag {
  font-size: 9px;
  padding: 2px 6px;
  letter-spacing: 0.06em;
}

/* Tags */
.tag {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 5px 10px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
}
.tag-primary { background: var(--primary-soft); color: var(--primary-ink); }
.tag-secondary { background: var(--secondary-soft); color: var(--secondary-ink); }

/* ============================================
   PROJECT MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(42, 38, 34, 0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-5);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-2) var(--ease), visibility var(--dur-2) var(--ease);
}
.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}
.modal {
  background: var(--surface);
  border-radius: var(--r-4);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-3);
  transform: translateY(20px);
  transition: transform var(--dur-2) var(--ease);
}
.modal-overlay.open .modal {
  transform: translateY(0);
}
.modal-close {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: flex-end;
  padding: var(--s-4) var(--s-5) 0;
  z-index: 2;
}
.modal-close button {
  width: 36px;
  height: 36px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-2);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--ink-2);
  transition: background var(--dur-2) var(--ease);
}
.modal-close button:hover { background: var(--surface-2); }
.modal-body {
  padding: var(--s-4) var(--s-6) var(--s-6);
}
.modal-gallery {
  display: grid;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
}
.modal-gallery img,
.modal-gallery video {
  width: 100%;
  border-radius: var(--r-3);
}
.modal-title {
  font-family: var(--font-display);
  font-size: var(--t-h2);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 var(--s-2);
}
.modal-subtitle {
  font-size: var(--t-small);
  color: var(--ink-2);
  margin: 0 0 var(--s-5);
}
.modal-description {
  font-size: var(--t-body);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 60ch;
  margin: 0 0 var(--s-5);
}
.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

/* Gallery slideshow */
.modal-slideshow {
  position: relative;
  margin-bottom: var(--s-5);
  border-radius: var(--r-3);
  overflow: hidden;
  background: var(--surface-2);
}
.modal-slideshow-track {
  display: flex;
  transition: transform 0.4s var(--ease);
  will-change: transform;
}
.modal-slideshow-track img {
  width: 100%;
  flex-shrink: 0;
  object-fit: contain;
  border-radius: var(--r-3);
}
.modal-slideshow-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: rgba(250, 246, 238, 0.85);
  backdrop-filter: blur(4px);
  color: var(--ink);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
  transition: background var(--dur-2) var(--ease), opacity var(--dur-2) var(--ease);
  opacity: 0.8;
}
.modal-slideshow-arrow:hover { background: var(--surface); opacity: 1; }
.modal-slideshow-arrow.prev { left: var(--s-3); }
.modal-slideshow-arrow.next { right: var(--s-3); }
.modal-slideshow-arrow[disabled] { opacity: 0.3; pointer-events: none; }
.modal-slideshow-indicators {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: var(--s-3) 0 var(--s-1);
}
.modal-slideshow-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--r-pill);
  background: var(--border-2);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
}
.modal-slideshow-dot.active {
  background: var(--primary);
  transform: scale(1.3);
}
.modal-slideshow-counter {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  text-align: center;
  padding-top: var(--s-1);
}

/* ============================================
   CATEGORY PAGE
   ============================================ */
.page-header {
  padding: var(--s-7) 0 var(--s-6);
}
.page-back {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  margin-bottom: var(--s-5);
  transition: color var(--dur-2) var(--ease);
}
.page-back:hover { color: var(--ink); }
.page-title {
  font-family: var(--font-display);
  font-size: var(--t-h1);
  line-height: 1.05;
  letter-spacing: -0.025em;
  font-weight: 500;
  margin: 0;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--s-9) var(--s-5);
  color: var(--ink-3);
}
.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--s-4);
  opacity: 0.4;
}
.empty-state p {
  font-size: var(--t-small);
  margin: 0;
}

/* ============================================
   BUTTONS (design system)
   ============================================ */
.btn {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.005em;
  padding: 12px 18px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform var(--dur-1) var(--ease), background var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.btn-primary { background: var(--ink); color: var(--surface); }
.btn-primary:hover { background: var(--primary-ink); }
.btn-accent { background: var(--primary); color: var(--surface); }
.btn-accent:hover { background: var(--primary-ink); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--border-2); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 8px 12px; font-size: 13px; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
  .project-grid { grid-template-columns: repeat(2, 1fr); }
  .hero { height: 60vh; }
}
@media (max-width: 600px) {
  .shell { padding: 0 var(--s-4); }
  .project-grid { grid-template-columns: 1fr; }
  .hero { height: 50vh; min-height: 300px; }
  .modal-body { padding: var(--s-4); }
}
