/* ===================================================
   MY PORTFOLIO WEBSITE - STYLES
   =================================================== */

:root {
  --red: #e60012;
  --black: #1a1a1a;
  --charcoal: #262626;
  --paper: #f5f2ea;
  --grey: #8a8a8a;
  --line: rgba(245, 242, 234, 0.14);
}

/* -------- RESET & BASE -------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  background: var(--black);
  color: var(--paper);
  font-family: 'Work Sans', sans-serif;
  overflow: hidden;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

a,
button {
  touch-action: manipulation; /* removes the ~300ms tap delay on mobile browsers */
}

body::before {
  content: "";
  position: fixed;
  inset: -20px;
  z-index: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: radial-gradient(var(--paper) 1px, transparent 1px);
  background-size: 14px 14px;
}

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

::selection {
  background: var(--red);
  color: var(--paper);
}

/* -------- BACKGROUND PARALLAX -------- */
.hero-slab,
.about-slab,
.designs-bg,
.work-bg,
.education-bg,
.education-bg-grey::before,
.contact-slab,
#work::before,
#work::after,
body::before {
  transform: translate3d(calc(var(--par-x, 0px) * var(--depth, 1)), calc(var(--par-y, 0px) * var(--depth, 1)), 0);
  will-change: transform;
}

body::before             { --depth: 0.35; }
.hero-slab               { --depth: 1; }
.about-slab              { --depth: 1; }
.contact-slab            { --depth: 1; }
.designs-bg              { --depth: 1.3; }
.work-bg                 { --depth: 1.1; }
.education-bg            { --depth: 0.9; }
.education-bg-grey::before { --depth: 1.3; }
#work::before             { --depth: 0.9; }
#work::after              { --depth: 0.55; }

/* Performance optimization: pause transform on inactive screens */
.screen:not(.active) .hero-slab,
.screen:not(.active) .about-slab,
.screen:not(.active) .designs-bg,
.screen:not(.active) .work-bg,
.screen:not(.active) .education-bg,
.screen:not(.active) .contact-slab,
.screen:not(.active) .education-bg-grey::before,
#work:not(.active)::before,
#work:not(.active)::after {
  transform: none;
}

/* -------- KEYFRAMES -------- */
@keyframes stripe-drift {
  from { background-position: 0 0; }
  to   { background-position: 300px 150px; }
}

@keyframes stripe-drift-transform {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(300px, 150px, 0); }
}

@keyframes slice-in {
  from { clip-path: inset(0 100% 0 0); opacity: 0; }
  to   { clip-path: inset(0 0 0 0); opacity: 1; }
}

@keyframes slice-in-up {
  from { clip-path: inset(0 0 100% 0); opacity: 0; }
  to   { clip-path: inset(0 0 0% 0); opacity: 1; }
}

@keyframes card-flutter {
  0%, 100% { transform: scale(1.04) rotate(-1deg); }
  50%      { transform: scale(1.04) rotate(1deg); }
}

/* -------- HERO SECTION -------- */
.hero {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: flex-start;
  padding: 3.5rem clamp(1.25rem, 6vw, 6rem) 6.5rem;
  overflow-y: auto;
  overflow-x: hidden;
  isolation: isolate;
}

.hero-inner {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1.4rem;
}

.hero-slab {
  position: fixed;
  inset: -40px;
  z-index: -1;
  background: url("assets/City.png") center/cover no-repeat;
  clip-path: polygon(0 0, 100% 0, 100% 62%, 0 78%);
}

.hero-slab::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--red);
  opacity: 0.7;
}

.hero-slab::after {
  content: "";
  position: absolute;
  inset: -350px;
  background: repeating-linear-gradient(115deg, rgba(0, 0, 0, 0.12) 0px, rgba(0, 0, 0, 0.12) 2px, transparent 2px, transparent 14px);
  animation: stripe-drift-transform 10s linear infinite;
  will-change: transform;
  contain: paint;
}

.hero-content {
  max-width: 640px;
  animation: slice-in 0.7s cubic-bezier(.2, .9, .25, 1) both;
}

.hero-title-img {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.hero-title-img:hover {
  transform: scale(1.03) rotate(-1deg);
  filter: drop-shadow(6px 6px 0 var(--red));
}

.calling-card {
  display: block;
  width: auto;
  max-width: min(100%, 420px);
  height: auto;
  margin-top: 1.6rem;
  margin-left: 1rem;
  transition: filter 0.25s ease;
}

.calling-card:hover {
  animation: card-flutter 0.5s ease-in-out infinite;
  cursor: default;
}

.command-stack {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  max-width: 640px;
  flex-shrink: 0;
  margin-left: clamp(-3rem, -5vw, -1rem);
  animation: slice-in-up 0.7s 0.15s cubic-bezier(.2, .9, .25, 1) both;
}

.command-stack li {
  list-style: none;
  position: relative;
}

.command-stack li:hover {
  z-index: 10;
}

.command-stack a {
  display: inline-flex;
  align-items: center;
  position: relative;
  z-index: 1;
  padding: 0.05rem 2.3rem 0.05rem 1.1rem;
}

.command-stack a::before {
  content: "▶";
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.3rem;
  color: var(--paper);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.command-stack a::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--black);
  transform: skewX(-16deg) scaleX(0);
  transform-origin: left center;
  z-index: -1;
  transition: transform 0.2s cubic-bezier(.7, 0, .3, 1);
}

.command-stack a:hover::before,
.command-stack a:focus-visible::before {
  opacity: 1;
}

.command-stack a:hover::after,
.command-stack a:focus-visible::after {
  transform: skewX(-16deg) scaleX(1);
}

.command-stack img {
  display: block;
  height: 88px;
  width: auto;
  filter: drop-shadow(6px 6px 0 rgba(0, 0, 0, 0.4));
  transition: transform 0.25s cubic-bezier(.2, .8, .2, 1), filter 0.25s ease;
  transform: scale(1) translateX(0);
  transform-origin: center left;
}

.command-stack a:hover img,
.command-stack a:focus-visible img {
  transform: scale(1.08) translateX(6px);
  filter: drop-shadow(9px 9px 0 rgba(0, 0, 0, 0.45));
}

/* -------- GENERIC SECTION LAYOUT -------- */
section {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  padding: 7rem clamp(1.25rem, 6vw, 6rem);
  padding-left: calc(clamp(1.25rem, 6vw, 6rem) + env(safe-area-inset-left));
  padding-right: calc(clamp(1.25rem, 6vw, 6rem) + env(safe-area-inset-right));
}

.screen {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 1;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 2;
}

.screen-scroll {
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 2rem clamp(1.25rem, 6vw, 6rem) 7rem;
  padding-left: calc(clamp(1.25rem, 6vw, 6rem) + env(safe-area-inset-left));
  padding-right: calc(clamp(1.25rem, 6vw, 6rem) + env(safe-area-inset-right));
}

.section-header {
  position: relative;
  z-index: 1;
  margin-bottom: 2.5rem;
}

.title-wrap {
  position: relative;
  display: inline-block;
}

.section-title {
  display: block;
  width: clamp(190px, 22vw, 320px);
  height: auto;
  filter: drop-shadow(3px 3px 0 rgba(0, 0, 0, 0.5));
}

.title-wrap::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -10px;
  width: 100%;
  height: 6px;
  background: var(--red);
  transform: skewX(-18deg);
}

/* -------- ABOUT SECTION -------- */
#about,
#education {
  padding: 0;
}

.about-scroll {
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0;
}

.about-scroll .section-header {
  padding: 2rem clamp(1.25rem, 6vw, 6rem) 0;
  margin-bottom: 0;
}

.about-slab {
  position: fixed;
  inset: -40px;
  z-index: 0;
  background: url("assets/maruki.png") center/cover no-repeat;
  clip-path: polygon(0 8%, 100% 0, 100% 92%, 0 100%);
}

.about-slab::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--red);
  opacity: 0.7;
}

.about-slab::after {
  content: "";
  position: absolute;
  inset: -350px;
  background: repeating-linear-gradient(115deg, rgba(0, 0, 0, 0.12) 0px, rgba(0, 0, 0, 0.12) 2px, transparent 2px, transparent 14px);
  animation: stripe-drift-transform 14s steps(24) infinite;
  will-change: transform;
  contain: paint;
}

.confidant-stack {
  position: relative;
  z-index: 1;
  width: 100%;
  margin-top: 0;
}

.confidant-img {
  display: block;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  top: -75px;
  left: 0;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.confidant-img:hover {
  transform: scale(1.02) rotate(-1deg);
  filter: drop-shadow(6px 6px 0 var(--red));
}

/* -------- DESIGNS SECTION -------- */
.designs-bg {
  position: fixed;
  inset: -50px;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg-star {
  position: absolute;
  opacity: 0.14;
  transform-origin: center;
  animation: star-spin 60s linear infinite;
}

.bg-star.s2 {
  opacity: 0.09;
  animation-duration: 90s;
  animation-direction: reverse;
}

@keyframes star-spin {
  to { transform: rotate(360deg); }
}

.phone-showcase {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
}

.phone-btn {
  position: relative;
  z-index: 2;
  width: clamp(140px, 22vw, 260px);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.phone-img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(4px 4px 0 rgba(0, 0, 0, 0.5));
  animation: phone-ring 1.1s ease-in-out infinite;
}

@keyframes phone-ring {
  0%, 100% { transform: rotate(0deg); }
  10% { transform: rotate(-8deg); }
  20% { transform: rotate(7deg); }
  30% { transform: rotate(-6deg); }
  40% { transform: rotate(5deg); }
  50% { transform: rotate(-3deg); }
  60%, 100% { transform: rotate(0deg); }
}

.phone-showcase.is-answered .phone-btn {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.7);
}

.line-panel {
  position: absolute;
  top: 50%;
  left: 48%;
  width: min(90%, 900px);
  opacity: 0;
  transform: translate(-50%, calc(-50% + 90px)) rotate(16deg) scale(0.82);
  transform-origin: bottom center;
  pointer-events: none;
  transition: opacity 0.45s ease, transform 0.65s cubic-bezier(.34, 1.56, .64, 1);
}

.line-panel.is-active {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0deg) scale(1);
  pointer-events: auto;
}

.line-img {
  display: block;
  width: 100%;
  height: auto;
}

.metanav-grid {
  position: absolute;
  inset: 0;
  transition: opacity 0.25s ease;
}

.metanav-grid.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.metanav-btn {
  position: absolute;
  width: 15%;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  z-index: 2;
  transform: rotate(6deg);
  transition: opacity 0.2s ease;
}

.metanav-img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(3px 3px 0 rgba(0, 0, 0, 0.5));
  transition: transform 0.25s ease, filter 0.25s ease;
}

.metanav-btn:hover .metanav-img,
.metanav-btn:focus-visible .metanav-img {
  transform: scale(1.14) translateY(-4px);
  filter: drop-shadow(5px 7px 0 rgba(0, 0, 0, 0.5));
}

@keyframes metanav-pulse {
  0% { transform: scale(1) rotate(6deg); }
  40% { transform: scale(0.78) rotate(6deg); }
  70% { transform: scale(1.1) rotate(6deg); }
  100% { transform: scale(1) rotate(6deg); }
}

.metanav-btn.is-clicked .metanav-img {
  animation: metanav-pulse 0.35s ease;
}

.metanav-btn[data-index="0"] { top: 10%; left: 35%; }
.metanav-btn[data-index="1"] { top: 13%; left: 53%; }
.metanav-btn[data-index="2"] { top: 16%; left: 71%; }
.metanav-btn[data-index="3"] { top: 33%; left: 33%; }
.metanav-btn[data-index="4"] { top: 35%; left: 51%; }
.metanav-btn[data-index="5"] { top: 37%; left: 69%; }
.metanav-btn[data-index="6"] { top: 55%; left: 31%; }
.metanav-btn[data-index="7"] { top: 57.5%; left: 49%; }
.metanav-btn[data-index="8"] { top: 60%; left: 67%; }

.line-content {
  position: absolute;
  inset: 12% 14%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 1;
}

.line-content.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.line-content-inner {
  position: relative;
  width: 100%;
  height: 100%;
}

.line-content-img {
  position: absolute;
  display: block;
  width: 55%;
  height: auto;
  transform: rotate(6deg);
  filter: drop-shadow(4px 4px 0 rgba(0, 0, 0, 0.5));
}

.line-content-img[data-index="0"] { top: 7%; left: 30%; }
.line-content-img[data-index="1"] { top: 35%; left: 27%; width: 68%; }
.line-content-img[data-index="2"] { top: 5%; left: 33%; width: 50%; }
.line-content-img[data-index="3"] { top: 35%; left: 26%; width: 68%; }
.line-content-img[data-index="4"] { top: 18%; left: 32%; }
.line-content-img[data-index="5"] { top: 18%; left: 32%; }
.line-content-img[data-index="6"] { top: 18%; left: 32%; }
.line-content-img[data-index="7"] { top: 14%; left: 28%; width: 60%; }
.line-content-img[data-index="8"] { top: 14%; left: 28%; width: 60%; }

.esc-hint {
  position: absolute;
  top: 50%;
  left: -20%;
  width: 34%;
  min-width: 130px;
  max-width: 300px;
  transform: translateY(-50%) translateX(-8px);
  opacity: 0;
  pointer-events: none;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: opacity 0.4s ease, transform 0.4s ease;
  z-index: 3;
}

.esc-hint.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0);
}

.esc-hint-img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(3px 3px 0 rgba(0, 0, 0, 0.5));
  transition: transform 0.2s ease;
}

.esc-hint:hover .esc-hint-img,
.esc-hint:focus-visible .esc-hint-img {
  transform: scale(1.08);
}

/* -------- EDUCATION SECTION BACKGROUND -------- */
.education-bg {
  position: fixed;
  inset: -30px;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: var(--charcoal);
}

.education-bg-red,
.education-bg-grey {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.education-bg-red {
  clip-path: polygon(0 0, 58% 0, 42% 100%, 0 100%);
}

.education-bg-grey {
  clip-path: polygon(58% 0, 100% 0, 100% 100%, 42% 100%);
}

.education-bg-red::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--red);
  opacity: 0.7;
}

.edu-tiles {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 160%;
  height: 160%;
  transform-origin: center center;
  animation: work-star-spin 110s linear infinite;
}

.education-bg-grey::before {
  content: "";
  position: absolute;
  inset: -40px;
  opacity: 0.65;
  background-image: radial-gradient(#0d0d0d 1.5px, transparent 1.5px);
  background-size: 16px 16px;
}

/* -------- PROJECTS / WORK SECTION -------- */
#work {
  background: var(--charcoal);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.8rem;
}

.project-card {
  display: block;
  line-height: 0;
}

.project-img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.3s cubic-bezier(.2, .8, .2, 1), filter 0.3s ease;
}

.project-card:hover .project-img {
  transform: scale(1.06) rotate(-1deg);
  filter: drop-shadow(8px 8px 0 rgba(0, 0, 0, 0.4));
}

.work-bg {
  position: fixed;
  inset: -30px;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.work-bg svg {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 160%;
  height: 160%;
  transform-origin: center center;
  animation: work-star-spin 90s linear infinite;
}

@keyframes work-star-spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to   { transform: translate(-50%, -50%) rotate(360deg); }
}

#work::before {
  content: "";
  position: fixed;
  top: -20%;
  right: -15%;
  width: 65%;
  height: 160%;
  background: var(--red);
  opacity: 0.14;
  clip-path: polygon(35% 0, 100% 0, 100% 100%, 0 100%);
  z-index: 0;
  pointer-events: none;
}

#work::after {
  content: "";
  position: fixed;
  inset: -350px;
  background: repeating-linear-gradient(115deg, rgba(230, 0, 18, 0.05) 0px, rgba(230, 0, 18, 0.05) 2px, transparent 2px, transparent 16px);
  animation: stripe-drift 14s steps(24) infinite;
  z-index: 0;
  pointer-events: none;
  will-change: transform;
  contain: paint;
}

#work .project-grid {
  position: relative;
  z-index: 1;
}

/* -------- EDUCATION / CV VIEW -------- */
.education-side-art {
  position: absolute;
  top: 50%;
  right: -6%;
  transform: translateY(-50%);
  height: 148vh;
  width: auto;
  max-width: 44vw;
  z-index: 0;
  pointer-events: none;
  object-fit: contain;
  filter: drop-shadow(10px 10px 0 rgba(0, 0, 0, 0.4));
}

.cv-viewer {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 620px;
  max-height: min(78vh, 820px);
  margin-top: 1.75rem;
  overflow-y: auto;
  background: var(--charcoal);
  border-left: 4px solid var(--red);
  padding: 1.6rem;
  display: flex;
  align-items: flex-start;
}

.cv-image {
  display: block;
  width: 100%;
  height: auto;
}

.cv-btn {
  display: inline-block;
  margin-top: 2rem;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.cv-btn:hover {
  transform: translateY(-2px);
}

.cv-btn-img {
  display: block;
  width: clamp(140px, 18vw, 200px);
  height: auto;
}

/* -------- CONTACT SECTION -------- */
#contact {
  background: var(--charcoal);
  padding-top: 2rem;
}

.contact-slab {
  position: fixed;
  inset: -40px;
  z-index: -1;
  background: url("assets/Steven1.png") center/cover no-repeat;
  clip-path: polygon(0 100%, 100% 100%, 100% 38%, 0 22%);
}

.contact-slab::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--red);
  opacity: 0.7;
}

.contact-slab::after {
  content: "";
  position: absolute;
  inset: -350px;
  background: repeating-linear-gradient(115deg, rgba(0, 0, 0, 0.12) 0px, rgba(0, 0, 0, 0.12) 2px, transparent 2px, transparent 14px);
  animation: stripe-drift-transform 10s linear infinite;
  will-change: transform;
  contain: paint;
}

.contact-side-art {
  position: absolute;
  top: 80%;
  left: 5%;
  transform: translateY(-50%);
  height: 148vh;
  width: auto;
  max-width: 44vw;
  z-index: 0;
  pointer-events: none;
  object-fit: contain;
  filter: drop-shadow(-10px 10px 0 rgba(0, 0, 0, 0.4));
  opacity: 0;
  transition: opacity 0.4s ease;
}

.calling-card-showcase.is-open ~ .contact-side-art {
  opacity: 1;
}

.calling-card-showcase {
  position: relative;
  z-index: 1;
  min-height: 52vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calling-card-showcase.is-open {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  min-height: 0;
}

.calling-card-btn {
  background: none;
  border: none;
  padding: 0;
  width: clamp(210px, 34vw, 380px);
  cursor: pointer;
  transition: transform 0.25s ease;
}

.calling-card-btn:hover,
.calling-card-btn:focus-visible {
  transform: scale(1.08) translateY(-4px);
}

.calling-card-showcase.is-open .calling-card-btn {
  display: none;
}

.calling-card-img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(4px 4px 0 rgba(0, 0, 0, 0.5));
  transition: filter 0.25s ease;
}

.calling-card-btn:hover .calling-card-img,
.calling-card-btn:focus-visible .calling-card-img {
  filter: drop-shadow(6px 9px 0 rgba(0, 0, 0, 0.55));
}

@keyframes card-pop-in {
  0%   { opacity: 0; transform: scale(0.6) rotate(-10deg); }
  70%  { opacity: 1; transform: scale(1.06) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

@keyframes card-ring {
  0%, 100% { transform: rotate(0deg); }
  10% { transform: rotate(-8deg); }
  20% { transform: rotate(7deg); }
  30% { transform: rotate(-6deg); }
  40% { transform: rotate(5deg); }
  50% { transform: rotate(-3deg); }
  60%, 100% { transform: rotate(0deg); }
}

.calling-card-btn.is-entering .calling-card-img {
  animation:
    card-pop-in 0.55s cubic-bezier(.34, 1.56, .64, 1) both,
    card-ring 1.1s ease-in-out 0.55s infinite;
}

.contact-reveal {
  display: none;
  width: 100%;
  max-width: 620px;
}

.contact-reveal.is-visible {
  display: block;
  animation: reveal-fade-in 0.5s ease both;
}

@keyframes reveal-fade-in {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.contact-list {
  margin-top: clamp(1.5rem, 4vw, 2.5rem);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.contact-chip {
  --chip-size: 56px;
  --chip-radius: 14px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--chip-size);
  height: var(--chip-size);
  border-radius: var(--chip-radius);
  overflow: hidden;
  background: var(--charcoal);
  border: 1px solid var(--line);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.contact-chip:hover {
  transform: translateY(-2px);
  border-color: var(--red);
}

.contact-chip-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.contact-form {
  margin-top: 2.6rem;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.form-head-img {
  display: block;
  width: clamp(220px, 30vw, 340px);
  height: auto;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-family: 'Jost', sans-serif;
  font-size: 0.85rem;
  color: var(--grey);
}

.field-label-img {
  display: block;
  width: clamp(110px, 16vw, 160px);
  height: auto;
}

.field input,
.field textarea {
  background: var(--paper);
  border: 3px solid var(--black);
  color: var(--black);
  padding: 0.75rem 0.9rem;
  font-family: 'Jost', sans-serif;
  font-size: 0.95rem;
  resize: vertical;
  transform: skewX(-2deg);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea {
  min-height: 120px;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 4px 4px 0 var(--red);
}

.form-foot {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.form-send {
  display: inline-block;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.form-send:hover {
  transform: translateY(-2px);
}

.form-send-img {
  display: block;
  width: clamp(120px, 16vw, 170px);
  height: auto;
}

#form-status {
  font-family: 'Times New Roman', Times, serif;
  font-size: 0.85rem;
  color: var(--grey);
}

/* -------- FOOTER -------- */
footer {
  position: relative;
  z-index: 1;
  padding: 2rem clamp(1.25rem, 6vw, 6rem);
  display: flex;
  justify-content: space-between;
  color: var(--grey);
  font-size: 0.82rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* -------- BACK TO MAIN MENU BUTTON -------- */
.back-to-top {
  position: fixed;
  right: calc(clamp(1rem, 4vw, 2.5rem) + env(safe-area-inset-right));
  bottom: calc(clamp(1rem, 4vw, 2.5rem) + env(safe-area-inset-bottom));
  z-index: 60;
  display: block;
  line-height: 0;
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.back-to-top.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

body.preview-open .back-to-top {
  opacity: 0;
  pointer-events: none;
}

.back-to-top img {
  display: block;
  height: 48px;
  width: auto;
  filter: drop-shadow(4px 4px 0 rgba(0, 0, 0, 0.4));
}

.back-to-top.is-visible:hover,
.back-to-top.is-visible:focus-visible {
  transform: translateY(0) scale(1.08) rotate(-4deg);
}

/* -------- SCREEN WIPE TRANSITION -------- */
#wipe {
  position: fixed;
  inset: -10%;
  z-index: 999;
  pointer-events: none;
}

#wipe .pane {
  position: absolute;
  inset: 0;
  transform: translateX(-130%) skewX(-14deg);
}

#wipe .p1 { background: var(--red); }
#wipe .p2 { background: var(--black); }
#wipe .p3 { background: var(--paper); }

#wipe.go .pane {
  animation: wipe-across 0.72s cubic-bezier(.75, 0, .2, 1) forwards;
}

#wipe.go .p2 { animation-delay: 0.06s; }
#wipe.go .p1 { animation-delay: 0.12s; }

@keyframes wipe-across {
  0%   { transform: translateX(-130%) skewX(-14deg); }
  45%  { transform: translateX(0%) skewX(-14deg); }
  55%  { transform: translateX(0%) skewX(-14deg); }
  100% { transform: translateX(130%) skewX(-14deg); }
}

/* -------- ACCESSIBILITY & MEDIA QUERIES -------- */
@media (max-width: 1150px) {
  .education-side-art,
  .contact-side-art {
    display: none;
  }
}

@media (max-width: 900px) {
  .command-stack img {
    height: 70px;
  }
  .command-stack a {
    padding-left: 1.1rem;
    padding-right: 1.8rem;
  }
  .command-stack {
    margin-left: 0;
  }
}

@media (max-width: 860px) {
  .line-panel {
    width: min(94%, 420px);
  }
  .section-header {
    margin-bottom: 1.75rem;
  }
  .section-title {
    width: clamp(130px, 34vw, 200px);
  }
  .esc-hint {
    top: -14%;
    left: 50%;
    width: 40%;
    min-width: 80px;
    max-width: 160px;
    transform: translateX(-50%) translateY(8px);
  }
  .esc-hint.is-visible {
    transform: translateX(-50%) translateY(0);
  }
}

@media (max-width: 600px) {
  .contact-chip {
    --chip-size: 48px;
  }
  .form-head-img,
  .form-send-img {
    width: clamp(150px, 42vw, 240px);
  }
  .field-label-img {
    width: clamp(90px, 24vw, 140px);
  }
  .field input,
  .field textarea {
    font-size: 16px; /* keeps iOS Safari from auto-zooming in on focus */
  }
  .phone-showcase {
    min-height: 56vh;
  }
  .confidant-img {
    top: -30px;
  }
  .cv-btn-img {
    width: clamp(120px, 30vw, 170px);
  }
}

@media (max-width: 480px) {
  section,
  .screen-scroll,
  .about-scroll {
    padding-left: calc(1rem + env(safe-area-inset-left));
    padding-right: calc(1rem + env(safe-area-inset-right));
  }

  .hero {
    padding-left: calc(1rem + env(safe-area-inset-left));
    padding-right: calc(1rem + env(safe-area-inset-right));
    padding-top: 2.5rem;
  }

  .command-stack img {
    height: 60px;
  }

  .project-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.2rem;
  }

  .contact-form {
    max-width: 100%;
  }

  .cv-viewer {
    padding: 1.1rem;
  }

  .section-title {
    width: clamp(120px, 40vw, 170px);
  }
}

/* very short viewports — phones in landscape, folded devices */
@media (max-height: 480px) and (orientation: landscape) {
  .hero {
    padding-top: 1.4rem;
    padding-bottom: 2.5rem;
  }
  .hero-inner {
    gap: 0.8rem;
  }
  .command-stack img {
    height: 50px;
  }
  .section-header {
    margin-bottom: 1rem;
  }
  .about-scroll .section-header {
    padding-top: 1.2rem;
  }
  .phone-showcase {
    min-height: 42vh;
  }
  .confidant-img {
    top: 0;
  }
  .calling-card-showcase {
    min-height: 34vh;
  }
  .cv-viewer {
    max-height: min(60vh, 820px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-content {
    animation: none;
    clip-path: none;
    opacity: 1;
  }
  .hero-slab::after,
  .about-slab::after,
  .contact-slab::after,
  .bg-star,
  .work-bg svg,
  .edu-tiles,
  #work::after {
    animation: none;
  }
  .phone-img {
    animation: none;
  }
  .calling-card-btn.is-entering .calling-card-img,
  .contact-reveal.is-visible {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .project-card,
  .project-img,
  .back-to-top {
    transition: none;
  }
  #wipe {
    display: none;
  }
}

/* -------- FOCUS STYLES -------- */
.phone-btn:focus,
.metanav-btn:focus,
.calling-card-btn:focus,
.esc-hint:focus,
.back-to-top:focus {
  outline: none;
}

.phone-btn:focus-visible,
.metanav-btn:focus-visible,
.calling-card-btn:focus-visible,
.esc-hint:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 4px;
}

a:focus-visible, 
button:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}