/* ============================================================
   Daniel Utrilla Mellinas — Portfolio
   style.css — Shared stylesheet
   ============================================================ */

/* ---------- Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Playfair+Display:ital,wght@1,400;1,500&display=swap');

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:           #FAFAF8;
  --bg-card:      #F2F0EC;
  --text:         #1A1A18;
  --text-muted:   #6B6B66;
  --accent:       #B07D54;   /* warm terracotta — used for date labels & diamond glyphs */
  --border:       #E4E2DC;
  --nav-height:   64px;

  --font-sans:    'Inter', system-ui, sans-serif;
  --font-serif:   'Playfair Display', Georgia, serif;

  --ease-out:     cubic-bezier(0.16, 1, 0.3, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

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

/* ---------- Utility ---------- */
.container {
  width: 100%;
  max-width: 860px;
  margin-inline: auto;
  padding-inline: 32px;
}

.container--wide {
  max-width: 1080px;
}

/* ---------- Navbar ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: 32px;
  background: rgba(250, 250, 248, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease;
}

.nav.scrolled {
  border-color: var(--border);
}

.nav__logo {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text);
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.nav__logo:hover {
  opacity: 1;
}

.nav__links {
  display: flex;
  gap: 32px;
  list-style: none;
}

.nav__links a {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
  position: relative;
  transition: color 0.2s ease;
}

.nav__links a::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--text);
  transition: width 0.25s var(--ease-out);
}

.nav__links a:hover,
.nav__links a.active {
  color: var(--text);
}

.nav__links a.active::after,
.nav__links a:hover::after {
  width: 100%;
}

/* ---------- Page offset for fixed nav ---------- */
.page-top {
  padding-top: var(--nav-height);
}

/* ---------- Hero ---------- */
.hero {
  padding-top: clamp(64px, 10vw, 120px);
  padding-bottom: clamp(48px, 8vw, 96px);
}

.hero__avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: 28px;
  border: 2px solid var(--border);
}

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

.hero__headline {
  font-family: var(--font-sans);
  font-size: clamp(28px, 4.5vw, 48px);
  font-weight: 400;
  line-height: 1.22;
  letter-spacing: -0.02em;
  color: var(--text);
  max-width: 720px;
  margin-bottom: 28px;
}

.hero__headline em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
}

.hero__diamond {
  color: var(--accent);
  font-style: normal;
}

.hero__tagline {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 24px;
}

.hero__sub {
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.hero__sub a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.hero__sub a:hover {
  color: var(--text);
  border-color: var(--text);
}

.hero__sub a svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

/* ---------- Section divider ---------- */
.section-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-label span {
  display: inline-block;
  width: 20px;
  height: 1px;
  background: var(--text-muted);
  opacity: 0.4;
}

/* ---------- Selected Work ---------- */
.work {
  padding-block: clamp(40px, 6vw, 80px);
  border-top: 1px solid var(--border);
}

.work__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 56px;
}

.work__title {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}

.work__note {
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.6;
}

/* ---------- Project Row ---------- */
.project {
  padding-block: 48px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.project:first-child {
  border-top: none;
}

.project__meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.project__name {
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: gap 0.25s var(--ease-out);
}

.project__name a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: gap 0.25s var(--ease-out);
}

.project__name a:hover {
  gap: 16px;
}

.project__arrow {
  display: inline-block;
  font-size: 20px;
  opacity: 0.4;
  transition: opacity 0.25s ease, transform 0.25s var(--ease-out);
}

.project__name a:hover .project__arrow {
  opacity: 1;
  transform: translate(4px, -4px);
}

.project__date {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.project__desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 360px;
}

.project__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: transparent;
}

.project__image {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-card);
  margin-top: 8px;
}

.project__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease-out);
}

.project:hover .project__image img {
  transform: scale(1.03);
}

.project__image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.4;
  font-style: italic;
}

/* ---------- About Page ---------- */
.about {
  padding-top: clamp(48px, 8vw, 96px);
  padding-bottom: clamp(48px, 8vw, 96px);
}

.about__photo-wrap {
  float: right;
  margin-left: 40px;
  margin-bottom: 24px;
  width: clamp(160px, 28vw, 260px);
}

.about__photo {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-card);
  transform: rotate(3deg);
  box-shadow: 0 16px 40px rgba(0,0,0,0.08);
  transition: transform 0.4s var(--ease-out);
}

.about__photo:hover {
  transform: rotate(0deg);
}

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

.about__photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.4;
  font-style: italic;
  padding: 16px;
  text-align: center;
}

.about__intro {
  font-size: clamp(18px, 2.5vw, 24px);
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: -0.01em;
  margin-bottom: 32px;
  max-width: 640px;
}

.about__intro em {
  font-family: var(--font-serif);
  font-style: italic;
}

.about__body {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.75;
  max-width: 580px;
  clear: both;
}

.about__body p + p {
  margin-top: 16px;
}

/* Timeline */
.timeline {
  margin-top: 64px;
}

.timeline__section {
  margin-bottom: 48px;
}

.timeline__heading {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 24px;
}

.timeline__item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px 24px;
  padding-block: 16px;
  border-bottom: 1px solid var(--border);
  align-items: start;
}

.timeline__item:last-child {
  border-bottom: none;
}

.timeline__period {
  font-size: 12px;
  color: var(--text-muted);
  padding-top: 3px;
  line-height: 1.4;
}

.timeline__role {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 2px;
  line-height: 1.3;
}

.timeline__company {
  font-size: 13px;
  color: var(--text-muted);
}

/* Certifications / Interests grid */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 48px;
}

.info-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 24px;
}

.info-card__heading {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.info-card__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-card__list li {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  padding-left: 16px;
  position: relative;
}

.info-card__list li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-size: 12px;
}

/* ---------- Case Study / Project Detail ---------- */
.case-study {
  padding-top: clamp(48px, 8vw, 96px);
  padding-bottom: clamp(64px, 10vw, 128px);
}

.case-study__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 48px;
  transition: color 0.2s ease;
}

.case-study__back:hover {
  color: var(--text);
}

.case-study__back svg {
  width: 14px;
  height: 14px;
}

.case-study__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}

.case-study__title {
  font-size: clamp(28px, 5vw, 52px);
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: 24px;
}

.case-study__title em {
  font-family: var(--font-serif);
  font-style: italic;
}

.case-study__summary {
  font-size: clamp(16px, 2vw, 20px);
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 820px;
  margin-bottom: 48px;
}

.case-study__hero-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-card);
  margin-bottom: 64px;
}

.case-study__hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Stats bar */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 64px;
}

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

.stat {
  background: var(--bg);
  padding: 24px;
}

.stat__value {
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 6px;
}

.stat__label {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Case study sections */
.cs-section {
  margin-bottom: 64px;
}

.cs-section__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.cs-section__heading {
  font-size: clamp(20px, 2.5vw, 28px);
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.cs-section__body {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.75;
  max-width: 820px;
}

.cs-section__body p + p {
  margin-top: 16px;
}

.cs-section__image {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-card);
  margin-top: 32px;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cs-section__image img, .cs-section__image video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

/* Top-anchored web screenshots & videos */
.top-anchored-image, .case-study__hero-image img, .case-study__hero-image video, .project__image img, .project__image video {
  object-position: top center;
}

/* Vertical Mobile 2-Column Grid Layouts */
.vertical-mobile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 32px;
}

.vertical-mobile-card {
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-card);
  aspect-ratio: 9 / 19.5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vertical-mobile-card img, .vertical-mobile-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.cs-image-placeholder {
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.4;
  font-style: italic;
}

.cs-section__divider {
  border: none;
  border-top: 1px solid var(--border);
  margin-block: 64px;
}

/* Two-col layout for case study */
.cs-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 32px;
}

/* ---------- Talks Page ---------- */
.talks {
  padding-top: clamp(48px, 8vw, 96px);
  padding-bottom: clamp(64px, 10vw, 128px);
}

.talks__header {
  margin-bottom: 64px;
}

.talks__headline {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 20px;
}

.talks__headline em {
  font-family: var(--font-serif);
  font-style: italic;
}

.talks__sub {
  font-size: 15px;
  color: var(--text-muted);
  max-width: 500px;
}

.talk-item {
  padding-block: 40px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.talk-item:last-child {
  border-bottom: 1px solid var(--border);
}

.talk-item__event {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.talk-item__title {
  font-size: clamp(18px, 2.2vw, 24px);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.talk-item__year {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.talk-item__desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.65;
}

/* ---------- Footer ---------- */
.footer {
  padding-block: 48px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.footer__left {
  font-size: 13px;
  color: var(--text-muted);
}

.footer__links {
  display: flex;
  gap: 24px;
  list-style: none;
}

.footer__links a {
  font-size: 13px;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.footer__links a:hover {
  color: var(--text);
}

/* ---------- Scroll-triggered Animations ---------- */
.fade-up {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-up-delay-1 { transition-delay: 0.1s; }
.fade-up-delay-2 { transition-delay: 0.2s; }
.fade-up-delay-3 { transition-delay: 0.3s; }
.fade-up-delay-4 { transition-delay: 0.4s; }

/* ---------- Responsive ---------- */
@media (max-width: 680px) {
  .container {
    padding-inline: 20px;
  }

  .nav {
    padding-inline: 20px;
  }

  .nav__links {
    gap: 20px;
  }

  .project__meta {
    grid-template-columns: 1fr;
  }

  .about__photo-wrap {
    float: none;
    margin-left: 0;
    width: 60%;
    margin-bottom: 32px;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .timeline__item {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .timeline__period {
    color: var(--accent);
    font-size: 11px;
  }

  .cs-two-col {
    grid-template-columns: 1fr;
  }

  .talk-item {
    grid-template-columns: 1fr;
  }

  .footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .stats {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---------- Misc helpers ---------- */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ── Interactive Image & Video Containers & Lightbox Modal ── */
.clickable-image {
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  border-radius: 8px;
  overflow: hidden;
}

.clickable-image:hover {
  transform: translateY(-2px) scale(1.015);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
}

/* Lightbox Overlay */
.lightbox-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 2rem;
}

.lightbox-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-media-container {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 92vw;
  max-height: 88vh;
}

.lightbox-content {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  transform: scale(0.95);
  transition: transform 0.25s ease;
}

.lightbox-modal.active .lightbox-content {
  transform: scale(1);
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 1.75rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
  z-index: 100000;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: scale(1.08);
}

/* ---------- Case Study Password Gate ---------- */
.cs-lock__overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 24, 0.55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 10000;
}

.cs-lock__overlay[hidden] {
  display: none;
}

.cs-lock__dialog {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 40px 32px 32px;
  text-align: center;
  animation: cs-lock-in 0.25s var(--ease-out);
}

@keyframes cs-lock-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.cs-lock__close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
}

.cs-lock__close:hover {
  color: var(--text);
}

.cs-lock__title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.15rem;
  margin-bottom: 8px;
}

.cs-lock__note {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

.cs-lock__note a {
  color: var(--accent);
  text-decoration: underline;
}

.cs-lock__form {
  display: flex;
  gap: 8px;
}

.cs-lock__input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.cs-lock__input:focus {
  outline: none;
  border-color: var(--accent);
}

.cs-lock__submit {
  padding: 11px 18px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--bg);
  background: var(--text);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s ease;
  white-space: nowrap;
}

.cs-lock__submit:hover {
  background: var(--accent);
}

.cs-lock__error {
  margin-top: 14px;
  font-size: 0.85rem;
  color: #b04545;
}
