/* ============================================================
   WILLIAM DIIORIO — PORTFOLIO
   Accent Color: #E05A2B (Burnt Athletic Orange)
   A warm, muted orange that evokes Nike's competitive energy
   while maintaining Apple's restraint. Used sparingly for
   maximum impact.
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
  --color-bg:       #0A0A0A;
  --color-bg-alt:   #111111;
  --color-bg-card:  #161616;
  --color-surface:  #1A1A1A;
  --color-border:   #2A2A2A;
  --color-text:     #F5F5F5;
  --color-text-sub: #999999;
  --color-accent:   #E05A2B;
  --color-accent-dim: rgba(224, 90, 43, 0.15);

  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --space-xs:  0.5rem;
  --space-sm:  1rem;
  --space-md:  1.5rem;
  --space-lg:  2.5rem;
  --space-xl:  4rem;
  --space-2xl: 6rem;
  --space-3xl: 10rem;

  --max-width: 1200px;

  --transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-slow: 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-main);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  overflow-x: hidden;
}

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

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

button {
  background: none;
  border: none;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* --- Section Titles --- */
.section-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  margin-bottom: var(--space-sm);
}

.section-sub {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--color-text-sub);
  max-width: 600px;
  margin-bottom: var(--space-xl);
  line-height: 1.7;
}

/* --- Scroll Animations --- */
.animate-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-in.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered animation delays for cards */
.animate-in[data-delay="1"] { transition-delay: 0.1s; }
.animate-in[data-delay="2"] { transition-delay: 0.2s; }
.animate-in[data-delay="3"] { transition-delay: 0.3s; }
.animate-in[data-delay="4"] { transition-delay: 0.4s; }

/* FAILSAFE: If JS hasn't added .is-visible after 3s, show everything anyway.
   Prevents content from being permanently hidden on slow mobile connections. */
@keyframes failsafe-reveal {
  to { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: failsafe-reveal 0.5s ease forwards;
  animation-delay: 2.5s;     /* Kick in after 2.5s if JS hasn't fired */
}

.animate-in.is-visible {
  animation: none;            /* JS took over — cancel the failsafe */
}


/* ============================================================
   NAVIGATION
   ============================================================ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  padding: var(--space-sm) 0;
  transition: background-color var(--transition), backdrop-filter var(--transition);
}

.nav--scrolled {
  background-color: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--color-border);
}

.nav__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__logo {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  list-style: none;
}

.nav__links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-sub);
  transition: color var(--transition);
  letter-spacing: 0.02em;
}

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

.nav__cta {
  color: var(--color-accent) !important;
  font-weight: 600 !important;
}

.nav__cta:hover {
  color: var(--color-text) !important;
}

/* Mobile nav toggle */
.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 24px;
  padding: 4px 0;
}

.nav__toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--color-text);
  transition: var(--transition);
  border-radius: 1px;
}

.nav__toggle.is-active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav__toggle.is-active span:nth-child(2) {
  opacity: 0;
}

.nav__toggle.is-active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}


/* ============================================================
   HERO
   ============================================================ */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  padding: var(--space-3xl) var(--space-md) var(--space-2xl);
  overflow: hidden;
}

.hero__content {
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  position: relative;
  z-index: 2;
}

.hero__name {
  font-size: clamp(3.5rem, 12vw, 9rem);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  margin-bottom: var(--space-md);
}

.hero__name-line {
  display: block;
}

.hero__name-line:last-child {
  color: var(--color-accent);
}

.hero__title {
  font-size: clamp(0.95rem, 2vw, 1.25rem);
  font-weight: 500;
  color: var(--color-text-sub);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: var(--space-lg);
}

.hero__statement {
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  line-height: 1.7;
  color: var(--color-text-sub);
  max-width: 700px;
  margin-bottom: var(--space-xl);
}

.hero__ctas {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* Hero background decorative accent */
.hero__bg-accent {
  position: absolute;
  top: -30%;
  right: -10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--color-accent-dim) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}


/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 2rem;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 4px;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.btn--primary {
  background: var(--color-accent);
  color: #fff;
}

.btn--primary:hover {
  background: #c94e24;
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(224, 90, 43, 0.3);
}

.btn--outline {
  border: 1.5px solid var(--color-border);
  color: var(--color-text);
}

.btn--outline:hover {
  border-color: var(--color-text);
  transform: translateY(-2px);
}


/* ============================================================
   BRAND CAROUSEL
   ============================================================ */
.brands {
  padding: var(--space-2xl) 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  overflow: hidden;
}

.brands__label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-sub);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  text-align: center;
  margin-bottom: var(--space-lg);
}

.brands__track-wrapper {
  overflow: hidden;
  /* Fade edges */
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0%,
    black 10%,
    black 90%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0%,
    black 10%,
    black 90%,
    transparent 100%
  );
}

.brands__track {
  display: flex;
  gap: var(--space-xl);
  white-space: nowrap;
  animation: scroll-brands 40s linear infinite;
  width: max-content;
}

.brands__item {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;            /* Consistent visual height for all logos */
  user-select: none;
  transition: opacity var(--transition), filter var(--transition);
  opacity: 0.5;            /* Subdued by default — premium feel */
  filter: brightness(0) invert(1); /* Force white on dark bg */
}

.brands__item:hover {
  opacity: 1;
}

.brands__item img {
  height: 100%;
  width: auto;
  max-width: 160px;        /* Cap wide wordmarks (C4, Subway, etc.) */
  object-fit: contain;
  display: block;
}

@keyframes scroll-brands {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}


/* ============================================================
   THE PLAYBOOK
   ============================================================ */
.playbook {
  padding: var(--space-3xl) 0;
}

.playbook__grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr); /* 5 equal columns in a single row */
  gap: var(--space-sm);
}

.playbook__card {
  position: relative;
  overflow: hidden;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  aspect-ratio: 1 / 1;      /* Square cards — uniform size */
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-md);
  transition: all var(--transition);
  cursor: default;
}

/* Background image layer at 25% opacity — keeps title text fully opaque */
.playbook__card::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--card-bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.25;
  transition: opacity var(--transition);
  pointer-events: none;
}

.playbook__card:hover::before {
  opacity: 0.35;             /* Subtle reveal on hover */
}

.playbook__card:hover {
  border-color: var(--color-accent);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.playbook__card-title {
  position: relative;        /* Sit above the ::before layer */
  z-index: 1;
  font-size: clamp(0.95rem, 1.5vw, 1.3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--color-text);  /* Full white, 100% opaque */
}


/* ============================================================
   CASE STUDIES — 2x2 Card Grid (index.html)
   ============================================================ */
.case-studies {
  padding: var(--space-3xl) 0;
  background: var(--color-bg-alt);
}

.cs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
}

/* --- Individual card --- */
.cs-card {
  position: relative;
  display: flex;
  align-items: flex-end;         /* Content pinned to bottom */
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--color-border);
  cursor: pointer;
  text-decoration: none;
  color: var(--color-text);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.cs-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

/* Brand logo — original colors, centered in upper portion of card */
.cs-card__logo {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 35%;                    /* Keep logos above the text area */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  z-index: 1;
  pointer-events: none;
}

.cs-card__logo img {
  height: 60px;                   /* Consistent logo height across all tiles */
  width: auto;
  max-width: 70%;
  object-fit: contain;
}

/* Dual logo layout for Nike / Jordan */
.cs-card__logo--dual {
  gap: var(--space-lg);
}

.cs-card__logo--dual img {
  height: 50px;                   /* Slightly smaller when paired */
  max-width: 40%;
}

/* Dark gradient overlay — heavy at bottom for text, transparent at top for logos */
.cs-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.92) 0%,
    rgba(0, 0, 0, 0.6) 40%,
    rgba(0, 0, 0, 0.35) 100%
  );
  pointer-events: none;
}

/* Text content — bottom-left aligned */
.cs-card__content {
  position: relative;
  z-index: 2;
  padding: var(--space-lg);
  width: 100%;
}

.cs-card__name {
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.cs-card__blurb {
  font-size: clamp(0.8rem, 1.3vw, 0.95rem);
  line-height: 1.5;
  color: var(--color-text-sub);
  max-width: 420px;
}

/* CTA text at bottom of each tile */
.cs-card__cta {
  display: inline-block;
  margin-top: var(--space-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-accent);
  letter-spacing: 0.04em;
  transition: letter-spacing var(--transition), color var(--transition);
}

.cs-card:hover .cs-card__cta {
  letter-spacing: 0.1em;
  color: #f0774d;           /* Slightly lighter accent on hover for pop */
}


/* ============================================================
   CASE STUDY DETAIL PAGE (case-studies/*.html)
   ============================================================ */
.cs-detail {
  padding: calc(var(--space-3xl) + 2rem) 0 var(--space-3xl);  /* Extra top for fixed nav */
}

.cs-detail__back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-sub);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-lg);
  transition: color var(--transition);
}

.cs-detail__back:hover {
  color: var(--color-accent);
}

.cs-detail__title {
  font-size: clamp(2.5rem, 7vw, 5rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: var(--space-xl);
}

/* 3-column image row */
.cs-detail__images {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-2xl);
}

.cs-detail__img-placeholder {
  aspect-ratio: 16 / 9;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cs-detail__img-placeholder span {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-sub);
  letter-spacing: 0.05em;
}

/* Vertical content sections */
.cs-detail__content {
  max-width: 720px;
}

.cs-detail__section {
  margin-bottom: var(--space-xl);
}

.cs-detail__section:last-child {
  margin-bottom: 0;
}

.cs-detail__label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-accent);
  margin-bottom: var(--space-xs);
}

.cs-detail__section p {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--color-text-sub);
}


/* ============================================================
   HOW I WORK
   ============================================================ */
.how-i-work {
  padding: var(--space-3xl) 0;
}

.principles__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-md);
}

.principle {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: var(--space-lg);
  transition: all var(--transition);
}

.principle:hover {
  border-color: var(--color-accent);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.principle__number {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-accent);
  letter-spacing: 0.1em;
  margin-bottom: var(--space-md);
}

.principle__title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-sm);
  line-height: 1.3;
}

.principle__text {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--color-text-sub);
}


/* ============================================================
   ABOUT
   ============================================================ */
.about {
  padding: var(--space-3xl) 0;
  background: var(--color-bg-alt);
}

.about__grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: var(--space-xl);
  align-items: start;
}

.about__portrait {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center top;
  border-radius: 8px;
  border: 1px solid var(--color-border);
}

.about__text p {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--color-text-sub);
  margin-bottom: var(--space-md);
}

.about__text p:last-child {
  margin-bottom: 0;
}


/* ============================================================
   CONTACT
   ============================================================ */
.contact {
  padding: var(--space-3xl) 0;
}

.contact__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-sm);
}

.contact__link {
  display: block;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: var(--space-lg);
  transition: all var(--transition);
}

.contact__link:hover {
  border-color: var(--color-accent);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.contact__link-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--color-accent);
  margin-bottom: var(--space-xs);
}

.contact__link-value {
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text);
}


/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  padding: var(--space-lg) 0;
  border-top: 1px solid var(--color-border);
  text-align: center;
}

.footer p {
  font-size: 0.8rem;
  color: var(--color-text-sub);
}


/* ============================================================
   RESPONSIVE
   ============================================================ */

/* --- Tablet & small laptops (≤768px) --- */
@media (max-width: 768px) {

  /* Reduce oversized section padding on smaller screens */
  :root {
    --space-3xl: 5rem;
    --space-2xl: 3.5rem;
  }

  /* --- Mobile Nav --- */
  .nav__toggle {
    display: flex;
  }

  .nav__links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 320px;
    height: 100vh;
    height: 100dvh;                        /* Dynamic viewport height for iOS Safari */
    background: var(--color-bg);
    border-left: 1px solid var(--color-border);
    flex-direction: column;
    align-items: flex-start;
    padding: 5rem var(--space-lg) var(--space-lg);
    gap: var(--space-md);
    transition: right var(--transition-slow);
    z-index: 1001;
  }

  .nav__links.is-open {
    right: 0;
  }

  .nav__links a {
    font-size: 1.1rem;
    padding: 0.5rem 0;                     /* Bigger tap targets */
  }

  /* Dark overlay behind open nav — click to close */
  .nav__overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
  }

  .nav__overlay.is-visible {
    display: block;
  }

  /* --- Hero --- */
  .hero {
    padding-top: 8rem;
    min-height: auto;                       /* Don't force 100vh on short phones */
    min-height: auto;
  }

  .hero__bg-accent {
    width: 300px;
    height: 300px;
    top: -10%;
    right: -20%;
  }

  /* --- Brands Carousel --- */
  .brands__item {
    height: 28px;
  }

  .brands__item img {
    max-width: 110px;
  }

  /* --- Playbook --- */
  .playbook__grid {
    grid-template-columns: repeat(3, 1fr); /* 3 columns on tablet */
  }

  /* --- Case Studies --- */
  .cs-grid {
    grid-template-columns: 1fr;            /* Stack cards vertically */
  }

  .cs-card {
    aspect-ratio: 16 / 9;
  }

  .cs-card__logo img {
    height: 45px;                           /* Smaller logos on stacked cards */
  }

  .cs-card__logo--dual img {
    height: 38px;
  }

  .cs-card__content {
    padding: var(--space-md);
  }

  /* --- Case Study Detail Pages --- */
  .cs-detail {
    padding-top: calc(5rem + 2rem);
  }

  .cs-detail__images {
    grid-template-columns: 1fr;            /* Stack images vertically */
  }

  .cs-detail__title {
    font-size: clamp(2rem, 8vw, 3.5rem);
    margin-bottom: var(--space-lg);
  }

  /* --- How I Work --- */
  .principles__grid {
    grid-template-columns: 1fr;            /* Stack principles */
  }

  /* --- About --- */
  .about__grid {
    grid-template-columns: 1fr;
  }

  .about__portrait {
    max-width: 320px;                       /* Don't let portrait dominate mobile */
    aspect-ratio: 4 / 5;
  }

  /* --- Contact --- */
  .contact__link {
    padding: var(--space-md);
  }
}

/* --- Small phones (≤480px) --- */
@media (max-width: 480px) {

  .container {
    padding: 0 var(--space-sm);             /* Tighter edge padding */
  }

  .playbook__grid {
    grid-template-columns: repeat(2, 1fr); /* 2 columns on small phone — better than 1 */
    gap: 0.5rem;
  }

  .playbook__card {
    aspect-ratio: 1 / 1;
    padding: var(--space-sm);
  }

  .playbook__card-title {
    font-size: 0.85rem;
  }

  .hero__name {
    font-size: clamp(2.8rem, 14vw, 4.5rem);
  }

  .hero__title {
    font-size: 0.8rem;
    letter-spacing: 0.1em;
  }

  .hero__statement {
    font-size: 0.95rem;
  }

  .hero__ctas {
    flex-direction: column;
  }

  .hero__ctas .btn {
    width: 100%;                            /* Full-width buttons on small phones */
    text-align: center;
  }

  .cs-card {
    aspect-ratio: 3 / 2;                    /* Slightly taller for more content room */
  }

  .cs-card__name {
    font-size: 1.1rem;
  }

  .cs-card__blurb {
    font-size: 0.8rem;
    /* Limit to 2 lines on small screens */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .cs-card__cta {
    font-size: 0.75rem;
    margin-top: 0.5rem;
  }

  .section-title {
    font-size: clamp(1.6rem, 7vw, 2.5rem);
  }

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

  .about__text p {
    font-size: 0.95rem;
  }
}

/* --- iPhone notch / home indicator safe areas --- */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .footer {
    padding-bottom: calc(var(--space-lg) + env(safe-area-inset-bottom));
  }

  .nav__links {
    padding-bottom: calc(var(--space-lg) + env(safe-area-inset-bottom));
  }
}
