/*
  UMD Films — Static Site Styles
  - Color palette & fonts
  - Layout & components
  - Carousels, tabs, forms
  Notes:
    • Replace image/video placeholders in /assets.
    • This stylesheet aims to emulate alpha.umdfilms.com aesthetics with a black base and vibrant red accents.
*/

:root {
  --red: #E3000B;
  --bg-0: #000000;
  --bg-1: #0b0b0b;
  --bg-2: #101010;
  --text-0: #ffffff;
  --text-1: #c9c9c9;
  --muted: #9a9a9a;
  --border: #1e1e1e;
  --focus: #ff4150;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0,0,0,.5);
  --header-h: 72px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Montserrat', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text-0);
  background: radial-gradient(1200px 800px at 80% -10%, rgba(227,0,11,.3), transparent 40%), var(--bg-0);
  line-height: 1.6;
  overflow-x: hidden;
}

html { scroll-behavior: smooth; }
section[id] { scroll-margin-top: calc(var(--header-h) + 10px); }

img { max-width: 100%; display: block; }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  width: min(1200px, 92%);
  margin: 0 auto;
}

.section { padding: 72px 0; position: relative; }
.section-title {
  font-family: 'Bebas Neue', Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif;
  letter-spacing: .04em;
  font-size: clamp(28px, 4vw, 48px);
  margin: 0 0 24px;
}
@media (max-width: 980px) { .section-title { text-align: center; } }

/* Section-specific backgrounds */
.who {
  background: linear-gradient(135deg, rgba(11,11,11,.8) 0%, rgba(16,16,16,.9) 100%), 
              radial-gradient(ellipse at 30% 70%, rgba(227,0,11,.08) 0%, transparent 50%);
}

.services {
  background: linear-gradient(45deg, var(--bg-0) 0%, rgba(5,5,5,1) 50%, var(--bg-0) 100%),
              repeating-linear-gradient(90deg, transparent, transparent 40px, rgba(227,0,11,.02) 42px, rgba(227,0,11,.02) 44px);
}

.portfolio {
  background: radial-gradient(circle at 80% 20%, rgba(16,16,16,.7) 0%, var(--bg-0) 60%),
              linear-gradient(180deg, rgba(11,11,11,.5) 0%, transparent 30%, rgba(11,11,11,.3) 100%);
}

.contact {
  background: linear-gradient(165deg, rgba(8,8,8,1) 0%, rgba(16,16,16,.95) 40%, rgba(227,0,11,.03) 70%, rgba(5,5,5,1) 100%),
              radial-gradient(ellipse at 70% 30%, rgba(227,0,11,.06) 0%, transparent 40%);
}

/* Header */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: rgba(0,0,0,.8);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  transition: background-color 0.3s ease, backdrop-filter 0.3s ease;
  padding-left: max(0px, env(safe-area-inset-left));
  padding-right: max(0px, env(safe-area-inset-right));
}
.header-inner{ display:flex; align-items:center; justify-content:space-between; height:100%; }
.logo { display:flex; align-items:center; gap:12px; color: var(--text-0); }
.logo img { height: 28px; }
.logo-text { font-family:'Bebas Neue'; letter-spacing:.08em; font-size:24px; }

.nav .menu { display:flex; gap:18px; list-style:none; margin:0; padding:0; }
.nav .menu a { color:#ddd; padding:10px 12px; border-radius:10px; }
.nav .menu a:hover, .nav .menu a.is-active { color:#fff; background: rgba(227,0,11,.1); box-shadow: inset 0 0 0 1px rgba(227,0,11,.25); }

.nav-toggle { display:none; width:44px; height:44px; border:1px solid var(--border); background:var(--bg-1); border-radius:10px; color:#fff; align-items:center; justify-content:center; }
.nav-toggle .bar { display:block; width:20px; height:2px; background:#fff; margin:3px auto; border-radius:2px; }

@media (max-width: 860px) {
  .nav .menu { position: fixed; inset: calc(var(--header-h)) 0 auto 0; background: rgba(0,0,0,.95); border-top:1px solid var(--border); display:none; flex-direction:column; padding:12px; }
  .nav .menu.is-open { display:flex; }
  .nav-toggle { display:inline-flex; }
}

/* Hero */
.hero { position:relative; min-height: calc(100vh - var(--header-h)); display:grid; place-items:center; text-align:center; }
/* Prefer small viewport units when available for consistent mobile height */
@supports (height: 100svh) {
  .hero { min-height: calc(100svh - var(--header-h)); }
}
/* Fallback to dynamic viewport units where supported */
@supports (height: 100dvh) {
  .hero { min-height: calc(100dvh - var(--header-h)); }
}
/* On mobile widths, add top padding equal to header height so content centers visually below the fixed header */
@media (max-width: 860px) {
  .hero { padding-top: var(--header-h); }
}
.hero .video-bg { position:absolute; inset:0; overflow:hidden; }
.hero-video { width:100%; height:100%; object-fit:cover; filter: saturate(1.05) contrast(1.05); }
.video-overlay { position:absolute; inset:0; background: radial-gradient(60% 60% at 50% 40%, rgba(0,0,0,.25), rgba(0,0,0,.75)); mix-blend-mode:multiply; }

/* Stars pattern */
.stars { position:absolute; inset:0; background: transparent; }
.stars::before, .stars::after {
  content:""; position:absolute; inset:0; background-repeat:repeat; pointer-events:none;
}
/* Tiny stars */
.stars::before {
  background-image: radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,.35) 50%, transparent 51%),
                    radial-gradient(1px 1px at 70% 80%, rgba(255,255,255,.25) 50%, transparent 51%),
                    radial-gradient(1px 1px at 40% 60%, rgba(255,255,255,.3) 50%, transparent 51%),
                    radial-gradient(1px 1px at 90% 20%, rgba(255,255,255,.25) 50%, transparent 51%);
  background-size: 600px 600px;
  animation: twinkle 12s linear infinite;
}
/* Shimmer sweep */
.stars::after {
  background: linear-gradient(100deg, transparent 0%, rgba(255,255,255,.05) 40%, transparent 80%);
  transform: translateX(-100%);
  animation: shimmer 10s linear infinite;
}

@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes twinkle { 50% { opacity: .6; } }

.hero-content { position:relative; z-index:2; padding: 0 16px; }
.hero .title { font-family:'Bebas Neue'; font-size: clamp(36px, 7vw, 88px); line-height: .95; margin: 0 0 12px; letter-spacing:.04em; text-shadow: 0 6px 30px rgba(0,0,0,.8); }
.hero .subtitle { color:#e7e7e7; margin:0 0 22px; max-width: 720px; }

.btn { display:inline-block; padding:12px 18px; border-radius:12px; border:1px solid var(--border); background: var(--bg-2); color:#fff; transition:.2s ease; }
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); text-decoration:none; }
.btn-primary { background: var(--red); border-color: #8a0006; }
.btn-primary:hover { background: #ff0010; }
.btn-ghost { background: transparent; border-color: #2a2a2a; }

/* Two columns layout */
.two-col { display:grid; grid-template-columns: 1.1fr .9fr; gap: 36px; align-items:center; }
.who-text p { color: var(--text-1); }
.who-image img { border-radius: var(--radius); box-shadow: var(--shadow); }
@media (max-width: 980px){ .two-col { grid-template-columns: 1fr; } .who-image{ order:-1; } }

/* Balance columns on medium screens for visual centering */
@media (min-width: 981px) and (max-width: 1200px) {
  .two-col { grid-template-columns: 1fr 1fr; }
}

/* Center content for 'Quiénes somos' on small screens */
@media (max-width: 980px) {
  .who .two-col { justify-items: center; text-align: center; gap: 24px; }
  .who-text { max-width: 60ch; }
  .who-image img { max-width: min(520px, 90%); height: auto; }
}

/* Tabs */
.tabs { display:flex; gap:10px; margin:20px 0; }
.tab { background: var(--bg-2); border:1px solid var(--border); color:#ddd; padding:8px 14px; border-radius:12px; cursor:pointer; }
.tab[aria-selected="true"], .tab:focus-visible { outline: 2px solid var(--focus); border-color: var(--focus); color:#fff; }
.tabpanel { margin-top: 8px; }

/* Cards & carousels */
.card { background: linear-gradient(180deg, var(--bg-1), #070707); border:1px solid var(--border); border-radius: var(--radius); padding:14px; box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.card.person img { border-radius: 12px; margin-bottom: 10px; aspect-ratio: 4/5; object-fit: cover; }
.card.person h3 { margin: 4px 0 0; font-size: 18px; }
.card.person .role { color: var(--muted); margin: 2px 0 0; font-size: 14px; }

.carousel { position: relative; display:flex; align-items:center; gap:10px; }
.carousel-track { display:grid; grid-auto-flow: column; grid-auto-columns: minmax(180px, 1fr); gap:14px; overflow-x:auto; scroll-behavior:smooth; padding:4px; scrollbar-width: thin; scroll-snap-type: x mandatory; touch-action: pan-x; }
.carousel-track { overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.carousel-track > * { scroll-snap-align: start; }
.carousel-track.dragging { cursor: grabbing; }

/* Team carousels: 1 item on mobile, max 3 on desktop */
.team-carousel .carousel-track { 
  grid-auto-columns: 100%; 
  scrollbar-width: none; 
  -ms-overflow-style: none; 
}
.team-carousel .carousel-track::-webkit-scrollbar { 
  width: 0; 
  height: 0; 
  display: none; 
}
@media (min-width: 900px) {
  .team-carousel .carousel-track { grid-auto-columns: calc((100% - (2 * 14px)) / 3); }
}
/* Tablet: 2 items visible */
@media (min-width: 600px) and (max-width: 899px) {
  .team-carousel .carousel-track { grid-auto-columns: calc((100% - 14px) / 2); }
}

/* Portfolio carousel: 1 item on mobile, max 3 on desktop */
.portfolio-carousel .carousel-track { 
  grid-auto-columns: 100%; 
  scrollbar-width: none; 
  -ms-overflow-style: none; 
}
.portfolio-carousel .carousel-track::-webkit-scrollbar { 
  width: 0; 
  height: 0; 
  display: none; 
}
@media (min-width: 900px) {
  .portfolio-carousel .carousel-track { grid-auto-columns: calc((100% - (2 * 14px)) / 3); }
}
/* Tablet: 2 items visible */
@media (min-width: 600px) and (max-width: 899px) {
  .portfolio-carousel .carousel-track { grid-auto-columns: calc((100% - 14px) / 2); }
}
.carousel-track:focus { outline: 2px solid var(--focus); outline-offset: 2px; }
.carousel-btn { width:40px; height:40px; border-radius:12px; background: var(--bg-2); border:1px solid var(--border); color:#fff; display:grid; place-items:center; cursor:pointer; }
.carousel-btn:hover { background:#151515; }
.carousel-btn svg { width:20px; height:20px; fill: currentColor; }

/* Services grid */
.services-grid { display:grid; grid-template-columns: repeat(4, 1fr); gap:16px; }
.service-card { text-align:center; padding:22px; transition: transform .18s ease, box-shadow .18s ease; }
.service-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.service-card i { font-size: 28px; color: var(--red); margin-bottom: 8px; }
.service-card h3 { margin: 8px 0; font-size: 18px; }
.service-card p { color: var(--text-1); font-size: 14px; }
@media (max-width: 1100px){ .services-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 800px){ .services-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px){ .services-grid { grid-template-columns: 1fr; } }

/* Portfolio */
.filters { display:flex; gap:10px; margin-bottom: 12px; flex-wrap:wrap; justify-content: center; }
.filter { background: var(--bg-2); color:#ddd; border:1px solid var(--border); padding:8px 14px; border-radius:999px; cursor:pointer; }
.filter.is-active, .filter:focus-visible { outline: 2px solid var(--focus); border-color: var(--focus); color:#fff; }

.poster-item { 
  position: relative; 
  cursor: pointer; 
  border-radius: 12px; 
  overflow: hidden;
  transition: transform .3s ease, box-shadow .3s ease;
}
.poster-item:hover { 
  transform: translateY(-4px); 
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
}
.poster-item img { 
  border-radius: 12px; 
  aspect-ratio: 2/3; 
  object-fit: cover; 
  width: 100%;
  transition: transform .3s ease;
}
.poster-item:hover img { transform: scale(1.02); }

.poster-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(0,0,0,.85) 0%, transparent 60%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 20px;
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: auto;
}
.poster-item:hover .poster-overlay,
.poster-item:focus-within .poster-overlay { 
  opacity: 1; 
}

.poster-overlay h3 { 
  color: #fff; 
  margin: 0 0 12px; 
  font-size: 18px; 
  text-align: center;
  text-shadow: 0 2px 8px rgba(0,0,0,.8);
  pointer-events: none;
}
.poster-btn {
  background: var(--red);
  border: 1px solid #a00008;
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all .2s ease;
  pointer-events: auto;
  z-index: 10;
  position: relative;
  outline: none;
  display: inline-block;
  text-decoration: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.poster-btn:hover,
.poster-btn:focus-visible {
  background: #ff0d1a;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(227,0,11,.4);
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.poster-btn:active {
  transform: translateY(0);
  background: #d00009;
}

/* Mobile: show overlay on click/tap */
@media (max-width: 900px) {
  .poster-overlay { 
    opacity: 1; 
  }
  .poster-item { transform: none; }
  .poster-item:hover { transform: none; }
}

/* Tight screens: compact spacing and header */
@media (max-width: 420px) {
  :root { --header-h: 60px; }
  .section { padding: 56px 0; }
  .header-inner { padding: 0 6px; }
  .logo img { height: 24px; }
  .logo-text { font-size: 20px; }
}

/* Contact form */
.form-grid { display:grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 14px; }
@media (max-width: 680px){ .form-grid { grid-template-columns: 1fr; } }
.form-grid label { display:flex; flex-direction:column; gap:6px; }
.form-grid label span { font-size: 13px; color:#bbb; }
.form-grid input, .form-grid select, .form-grid textarea {
  background: #0a0a0a; border:1px solid #1c1c1c; color:#fff; padding:12px 12px; border-radius: 10px; font: inherit;
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus { outline: 2px solid var(--focus); border-color: var(--focus); }
.form-grid .full { grid-column: 1 / -1; }
.checkbox { flex-direction: row; align-items:center; gap:10px; }
.form-status { min-height: 1.2em; color: var(--text-1); margin-top: 10px; }
.form-status.success { color: #2ecc71; }
.form-status.error { color: #ff6b6b; }

/* Footer */
.site-footer { 
  border-top: 1px solid var(--border); 
  background: linear-gradient(180deg, #030303 0%, #050505 50%, #020202 100%),
              repeating-linear-gradient(45deg, transparent, transparent 60px, rgba(227,0,11,.015) 62px, rgba(227,0,11,.015) 64px);
  padding: 36px 0; 
}
.site-footer .logos .logo-item { height: clamp(52px, 5.5vw, 68px); width: auto; opacity: .9; filter: grayscale(100%); transition: .2s; }
.site-footer .logos .logo-item:hover { filter: grayscale(0%); opacity: 1; }
.site-footer .logos .carousel-track { scrollbar-width: none; -ms-overflow-style: none; gap: 8px; }
.site-footer .logos .carousel-track::-webkit-scrollbar { width: 0; height: 0; display: none; }
.follow { display:flex; align-items:center; gap:12px; margin: 20px 0; }
@media (max-width: 900px) { .follow { justify-content: center; } }
.follow-title { font-family:'Bebas Neue'; letter-spacing:.08em; }
.social { display:inline-grid; place-items:center; width:44px; height:44px; border-radius:12px; border:1px solid var(--border); color:#fff; background: var(--bg-2); transition: color .2s ease, background .2s ease, box-shadow .2s ease, border-color .2s ease, transform .2s ease; }
.social:hover { background:#151515; color: var(--red); border-color: rgba(227,0,11,.6); box-shadow: 0 0 0 1px rgba(227,0,11,.35), 0 0 16px rgba(227,0,11,.25); transform: translateY(-1px); }
.social:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--red), 0 0 16px rgba(227,0,11,.25); }
.social svg { width:24px; height:24px; fill: currentColor; }
.legal { color: var(--muted); font-size: 13px; }
.legal .whatsapp { color: #25D366; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .carousel-track, .stars::after, .stars::before { animation: none; }
  .poster-item, .poster-item img, .poster-overlay { transition: none; }
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  /* Safe area support for notches */
  padding-top: max(20px, env(safe-area-inset-top));
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}
.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.85);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  background: linear-gradient(145deg, var(--bg-1), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 900px;
  width: min(900px, 96vw);
  max-height: 90vh;
  /* Use flex column so video stays on top and info below can scroll */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.8);
  animation: modalSlideIn .3s ease;
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(30px) scale(.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  background: rgba(0,0,0,.7);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 10;
  transition: background .2s ease;
}
.modal-close:hover { background: rgba(227,0,11,.8); }
.modal-close svg { width: 20px; height: 20px; }

.modal-video {
  position: relative;
  background: #000;
  aspect-ratio: 16/9;
  /* Fixed-height region at top of the modal */
  flex: 0 0 auto;
}
.modal-video iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.modal-info {
  padding: 24px;
  /* Auto height, no scroll by default */
  flex: 0 0 auto;
}

/* Desktop: reduce video height so description is visible without scrolling */
@media (min-width: 900px) {
  .modal-video { aspect-ratio: auto; height: clamp(260px, 45vh, 480px); }
}
/* Very short screens: shrink video more */
@media (max-height: 560px) {
  .modal-video { height: 40vh; aspect-ratio: auto; }
}

/* Desktop: show up to 4 lines by default; expandable */
@media (min-width: 900px) {
  .modal-description {
    display: -webkit-box;
    line-clamp: 4;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .modal-description.expanded {
    display: block;
    line-clamp: unset;
    -webkit-line-clamp: unset;
    -webkit-box-orient: initial;
    overflow: visible;
  }
}

/* Toggle button inside modal-info */
.modal-more-toggle {
  appearance: none;
  background: transparent;
  border: none;
  color: var(--red);
  font-weight: 600;
  cursor: pointer;
  padding: 6px 0 0;
}
.modal-more-toggle:focus { outline: 2px solid var(--focus); outline-offset: 2px; }

/* When expanded, allow modal to scroll if needed */
.modal-content.expanded { overflow: auto; }
.modal-info h2 {
  margin: 0 0 8px;
  font-family: 'Bebas Neue';
  font-size: 28px;
  color: var(--text-0);
}
.modal-year {
  margin: 0 0 16px;
  color: var(--red);
  font-weight: 600;
}
.modal-description {
  margin: 0;
  color: var(--text-1);
  line-height: 1.6;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Desktop-specific modal description fix */
@media (min-width: 900px) {
  .modal-description {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-height: 1px;
  }
}
