/* =========================
   GLOBAL / BASE
========================= */
:root {
  --brand-red: #b52a18;
  --brand-red-dark: #941c10;
  --text-dark: #111111;
  --text-muted: #666666;
  --bg-soft: #f6f6f3;
  --bg-warm: #f8f5f1;
  --border-soft: rgba(0, 0, 0, 0.07);
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 14px 36px rgba(0, 0, 0, 0.07);
  --shadow-hover: 0 24px 56px rgba(0, 0, 0, 0.12);
  --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 88px;
}

body {
  min-width: 320px;
  line-height: 1.65;
  overflow-x: hidden;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

img {
  height: auto;
}

a,
button {
  -webkit-tap-highlight-color: transparent;
}

a {
  text-decoration: none;
  transition:
    color 0.22s ease,
    background-color 0.22s ease,
    border-color 0.22s ease,
    opacity 0.22s ease,
    transform 0.34s var(--ease-smooth),
    box-shadow 0.34s var(--ease-smooth);
}

button {
  font: inherit;
  color: inherit;
}

/* =========================
   SHARED SECTION STYLES
========================= */
.section-soft {
  position: relative;
  background: var(--bg-soft);
}

.section-soft::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0)),
    linear-gradient(to top, rgba(0, 0, 0, 0.015), rgba(0, 0, 0, 0));
}

.section-soft > * {
  position: relative;
  z-index: 1;
}

.section-label {
  display: inline-block;
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-red);
}

.section-title {
  margin: 0;
  font-size: clamp(1.85rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--text-dark);
}

.section-intro {
  max-width: 760px;
  margin-top: 1rem;
  font-size: clamp(0.98rem, 1.5vw, 1.05rem);
  line-height: 1.8;
  color: rgba(20, 20, 20, 0.72);
}

/* =========================
   HEADER / NAV
========================= */
header {
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0.52rem 0.82rem;
  color: var(--text-dark);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.012em;
  border-radius: 999px;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--brand-red);
  background: rgba(181, 42, 24, 0.055);
}

.mobile-nav-link {
  display: block;
  width: 100%;
  padding: 0.75rem 0.9rem;
  color: var(--text-dark);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 14px;
}

.mobile-nav-link:hover,
.mobile-nav-link:focus-visible {
  color: var(--brand-red);
  background: rgba(181, 42, 24, 0.055);
}

/* =========================
   BUTTONS
========================= */
.btn-brand,
.btn-outline-brand,
.btn-light-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0.88rem 1.35rem;
  font-size: 0.96rem;
  font-weight: 750;
  line-height: 1;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-brand {
  color: #ffffff;
  background: var(--brand-red);
  border-color: var(--brand-red);
}

.btn-brand:hover,
.btn-brand:focus-visible {
  color: #ffffff;
  background: var(--brand-red-dark);
  border-color: var(--brand-red-dark);
}

.btn-outline-brand {
  color: var(--text-dark);
  background: transparent;
  border-color: rgba(0, 0, 0, 0.16);
}

.btn-outline-brand:hover,
.btn-outline-brand:focus-visible {
  color: var(--brand-red);
  background: rgba(181, 42, 24, 0.035);
  border-color: var(--brand-red);
}

.btn-light-brand {
  color: var(--text-dark);
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
}

.btn-light-brand:hover,
.btn-light-brand:focus-visible {
  color: var(--brand-red);
  border-color: rgba(181, 42, 24, 0.24);
}

/* =========================
   PROJECT CARDS
========================= */
.project-card {
  position: relative;
  display: block;
  height: 100%;
  overflow: hidden;
  color: inherit;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.055);
  border-radius: 22px;
  box-shadow: var(--shadow-card);
}

.project-card:hover,
.project-card:focus-visible {
  color: inherit;
  box-shadow: var(--shadow-hover);
}

.project-card img {
  width: 100%;
  height: clamp(190px, 22vw, 250px);
  object-fit: cover;
  background: #f3f3f3;
  transition: transform 0.6s var(--ease-smooth);
}

.project-card::after {
  content: "View →";
  position: absolute;
  right: 18px;
  bottom: 16px;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--brand-red);
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.34s var(--ease-smooth),
    transform 0.34s var(--ease-smooth);
}

.project-tag {
  margin-bottom: 0.7rem;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.45;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-red);
}

.project-title {
  margin: 0 0 0.8rem;
  font-size: clamp(1.12rem, 1.7vw, 1.24rem);
  font-weight: 800;
  line-height: 1.32;
  color: var(--text-dark);
}

.project-text {
  margin: 0;
  padding-bottom: 1.1rem;
  font-size: 0.98rem;
  line-height: 1.78;
  color: var(--text-muted);
}

/* =========================
   PORTFOLIO FILTER
========================= */
.filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0.55rem 1rem;
  color: var(--text-dark);
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  font-size: 0.96rem;
  font-weight: 750;
  line-height: 1;
  cursor: pointer;
  transition:
    color 0.25s ease,
    background-color 0.25s ease,
    border-color 0.25s ease,
    transform 0.25s ease,
    box-shadow 0.25s ease;
}

.filter-btn:hover,
.filter-btn:focus-visible {
  color: var(--brand-red);
  background: rgba(181, 42, 24, 0.06);
  border-color: rgba(181, 42, 24, 0.22);
}

.filter-btn.active {
  color: #ffffff;
  background: var(--brand-red);
  border-color: var(--brand-red);
}

/* =========================
   SKILL CARDS
   Keep this only if other pages use .skill-card.
========================= */
.skill-card {
  height: 100%;
  padding: 1.6rem 1.5rem 1.5rem;
  background: #ffffff;
  border: 1px solid var(--border-soft);
  border-radius: 24px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.04);
  transition:
    transform 0.34s var(--ease-smooth),
    border-color 0.25s ease,
    box-shadow 0.34s var(--ease-smooth);
}

.skill-icon {
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-red);
  background: rgba(181, 42, 24, 0.08);
  border-radius: 16px;
}

.skill-title {
  margin: 1.05rem 0 0.85rem;
  font-size: clamp(1.2rem, 1.5vw, 1.45rem);
  font-weight: 800;
  line-height: 1.25;
  color: var(--text-dark);
}

.skill-text {
  margin: 0 0 1rem;
  line-height: 1.75;
  color: var(--text-muted);
}

.skill-list {
  margin: 0;
  padding-left: 1.1rem;
  list-style: disc;
  color: var(--text-dark);
}

.skill-list li {
  margin-bottom: 0.55rem;
  line-height: 1.65;
}

/* =========================
   FEATURED WORK BACKGROUND
========================= */
.featured-work-bg {
  position: relative;
  overflow: hidden;
  isolation: isolate;

  background:
    linear-gradient(
      rgba(255, 255, 255, 0.98),
      rgba(255, 255, 255, 0.98)
    ),
    url("imgs/Cover/featured_background.webp");

  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;

  perspective: 1200px;
}

.featured-work-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;

  background:
    radial-gradient(
      circle at 20% 20%,
      rgba(181, 42, 24, 0.08),
      transparent 25%
    ),
    radial-gradient(
      circle at 80% 70%,
      rgba(255, 255, 255, 0.65),
      transparent 38%
    );
}

.featured-work-bg > * {
  position: relative;
  z-index: 1;
  transform-style: preserve-3d;
}

.featured-work-bg .project-card {
  transform-style: preserve-3d;
}

@media (hover: hover) and (pointer: fine) {
  .featured-work-bg .project-card:hover {
    transform: translateY(-12px) translateZ(28px) scale(1.015);
  }
}

@media (max-width: 767.98px) {
  .featured-work-bg {
    background-attachment: scroll;
  }
}
/* =========================
   PROCESS SECTION
========================= */
.process-section {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: #0f0f0f;
}

.process-bg {
  position: absolute;
  inset: -12%;
  z-index: -2;
  background:
    linear-gradient(rgba(15, 15, 15, 0.68), rgba(15, 15, 15, 0.82)),
    url("imgs/Cover/section_background.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transform: scale(1.18);
  will-change: transform;
  transition: transform 0.18s linear;
  filter: saturate(1.08) contrast(1.05) brightness(0.95);
}

.process-section::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.1), transparent 30%),
    radial-gradient(circle at 82% 72%, rgba(181, 42, 24, 0.18), transparent 36%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.25));
}

.process-content {
  position: relative;
  z-index: 2;
}

.process-step {
  position: relative;
  min-height: 250px;
  padding: 32px 30px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.075);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition:
    transform 0.4s var(--ease-smooth),
    border-color 0.35s ease,
    background 0.35s ease,
    box-shadow 0.4s var(--ease-smooth);
}

.process-number {
  position: absolute;
  top: 22px;
  right: 24px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.42);
}

.process-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  margin-bottom: 26px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  font-size: 1.1rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 10px 24px rgba(0, 0, 0, 0.18);
}

.process-title {
  margin: 0 0 14px;
  font-size: 1.22rem;
  font-weight: 800;
  color: #ffffff;
}

.process-text {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.98rem;
  line-height: 1.75;
}

.process-connector {
  position: relative;
  height: 2px;
  background:
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.08),
      rgba(255, 255, 255, 0.42),
      rgba(255, 255, 255, 0.08)
    );
}

.process-connector::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -1px;
  width: 9px;
  height: 9px;
  border-top: 2px solid rgba(255, 255, 255, 0.55);
  border-right: 2px solid rgba(255, 255, 255, 0.55);
  transform: translateY(-50%) rotate(45deg);
}

/* =========================
   PORTFOLIO HERO VIDEO
========================= */
.portfolio-hero {
  position: relative;
  min-height: 72vh;
  min-height: 72svh;
  display: flex;
  align-items: center;
  background: #111111;
}

.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.36;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.26), rgba(0, 0, 0, 0.36));
}

.portfolio-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.04), transparent 60%);
}

/* =========================
   RESUME / FOOTER / SOCIAL
========================= */
.resume-box {
  padding: 2.2rem;
  background: #ffffff;
  border: 1px solid var(--border-soft);
  border-radius: 24px;
  box-shadow: var(--shadow-card);
}

.footer-link {
  color: #ffffff;
}

.footer-link:hover,
.footer-link:focus-visible {
  color: #ffffff;
  opacity: 0.86;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  color: #ffffff;
  font-size: 1.1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.social-link:hover,
.social-link:focus-visible {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  opacity: 0.95;
}

/* =========================
   REVEAL ANIMATION
========================= */
.reveal-up,
.reveal-card {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 0.65s var(--ease-smooth),
    transform 0.65s var(--ease-smooth);
  transition-delay: var(--delay, 0s);
  will-change: opacity, transform;
}

.reveal-up.is-visible,
.reveal-card.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* =========================
   HOVER ONLY ON DEVICES THAT SUPPORT HOVER
========================= */
@media (hover: hover) and (pointer: fine) {
  .btn-brand:hover,
  .btn-outline-brand:hover,
  .btn-light-brand:hover,
  .filter-btn:hover {
    transform: translateY(-1px);
  }

  .project-card:hover {
    transform: translateY(-8px);
  }

  .project-card:hover img {
    transform: scale(1.05);
  }

  .project-card:hover::after,
  .project-card:focus-visible::after {
    opacity: 1;
    transform: translateY(0);
  }

  .project-card:hover .project-title {
    color: var(--brand-red);
  }

  .skill-card:hover {
    transform: translateY(-4px);
    border-color: rgba(181, 42, 24, 0.18);
    box-shadow:
      0 16px 34px rgba(0, 0, 0, 0.08),
      0 30px 60px rgba(0, 0, 0, 0.1);
  }

  .process-step:hover {
    transform: translateY(-10px) scale(1.015);
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow:
      0 28px 80px rgba(0, 0, 0, 0.34),
      inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }
}

/* =========================
   RESPONSIVE: iPad / TABLET
========================= */
@media (max-width: 1024px) {
  html {
    scroll-padding-top: 84px;
  }

  .portfolio-hero {
    min-height: 62vh;
    min-height: 62svh;
  }

  .process-bg {
    inset: -6%;
    transform: scale(1.08);
  }

  .process-step {
    min-height: auto;
  }
}

/* =========================
   RESPONSIVE: iPhone / MOBILE
========================= */
@media (max-width: 767.98px) {
  html {
    scroll-padding-top: 82px;
  }

  .section-label {
    font-size: 0.76rem;
  }

  .section-title {
    font-size: clamp(1.75rem, 8vw, 2.25rem);
  }

  .section-intro {
    font-size: 0.98rem;
    line-height: 1.75;
  }

  .btn-brand,
  .btn-outline-brand,
  .btn-light-brand {
    width: 100%;
    min-height: 48px;
  }

  .project-card {
    border-radius: 20px;
  }

  .project-card img {
    height: clamp(185px, 58vw, 230px);
  }

  .project-card::after {
    opacity: 1;
    transform: translateY(0);
  }

  .portfolio-hero {
    min-height: 58vh;
    min-height: 58svh;
  }

  .hero-video {
    opacity: 0.3;
  }

  .hero-overlay {
    background: rgba(0, 0, 0, 0.36);
  }

  .process-step {
    padding: 28px 24px;
    border-radius: 24px;
  }

  .process-icon {
    width: 54px;
    height: 54px;
    margin-bottom: 22px;
  }

  .resume-box {
    padding: 1.5rem;
  }

  .social-link {
    width: 40px;
    height: 40px;
  }

  /* =========================
     HERO STABILITY FIX
  ========================= */

  #top {
    min-height: auto;
  }

  #rotating-word {
    min-height: 1.2em;
    line-height: 1;
    overflow: hidden;
  }

  #top .reveal-up,
  #top .reveal-card {
    transform: none;
  }

  #top h1 {
    line-height: 1;
  }
}

/* =========================
   RESPONSIVE: SMALL iPhone / SE
========================= */
@media (max-width: 390px) {
  .nav-link,
  .mobile-nav-link {
    font-size: 0.9rem;
  }

  .section-title {
    font-size: 1.68rem;
  }

  .project-card img {
    height: 180px;
  }

  .project-tag {
    font-size: 0.72rem;
  }

  .project-text,
  .process-text,
  .skill-text {
    font-size: 0.95rem;
  }
}



/* =========================
   CASE STUDY OUTPUT CARDS
   For project detail pages: horizontal image cards / selected outputs.
========================= */
.case-output-grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .case-output-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.case-output-card {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  text-align: left;
  color: inherit;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 28px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition:
    transform 0.34s var(--ease-smooth),
    box-shadow 0.34s var(--ease-smooth),
    border-color 0.25s ease;
}

.case-output-card:hover,
.case-output-card:focus-visible {
  color: inherit;
  box-shadow: var(--shadow-hover);
}

.case-output-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #f3f3f3;
}

.case-output-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.6s var(--ease-smooth);
}

.case-output-content {
  padding: 1.5rem;
}

.case-output-title {
  margin: 0;
  font-size: clamp(1.15rem, 1.5vw, 1.25rem);
  font-weight: 800;
  line-height: 1.25;
  color: var(--text-dark);
}

.case-output-text {
  margin: 0.75rem 0 0;
  font-size: 0.98rem;
  line-height: 1.75;
  color: var(--text-muted);
}

@media (hover: hover) and (pointer: fine) {
  .case-output-card:hover {
    transform: translateY(-6px);
  }

  .case-output-card:hover .case-output-media img {
    transform: scale(1.05);
  }
}

@media (max-width: 767.98px) {
  .case-output-content {
    padding: 1.35rem;
  }

  .case-output-media {
    aspect-ratio: 16 / 10;
  }
}

/* =========================
   IMAGE / CARD STABILITY FIX
   Prevents card media from leaving visual gaps in case-study layouts.
========================= */
.reveal-card > img,
.reveal-card picture > img {
  width: 100%;
}

button.reveal-card {
  width: 100%;
  cursor: pointer;
}

/* Tailwind arbitrary aspect utilities work best when the image itself fills its wrapper. */
.reveal-card .aspect-\[16\/10\] img,
.reveal-card .aspect-\[16\/9\] img,
.reveal-card .aspect-\[4\/3\] img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* =========================
   ACCESSIBILITY
========================= */
:focus-visible {
  outline: 3px solid rgba(181, 42, 24, 0.35);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .process-bg {
    transform: scale(1.06) !important;
  }

  .reveal-up,
  .reveal-card {
    opacity: 1;
    transform: none;
  }
}
