:root {
  --blue: #0066ff;
  --blue-deep: #002b80;
  --black: #0b0b0d;
  --white: #f6f4ef;
  --ink: #111;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  height: 100dvh;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--black);
  color: var(--white);
  font-family: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  touch-action: manipulation;
}

.display {
  font-family: 'Archivo Black', 'Arial Black', Impact, sans-serif;
}

/* ============ BACKGROUND LAYERS (GPU-ACCELERATED) ============ */
#bg {
  position: fixed;
  inset: -6vmax;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  contain: strict;
}

.bg-layer {
  position: absolute;
  inset: 0;
  will-change: transform;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
}

#bg-stripes {
  background: repeating-linear-gradient(115deg,
    var(--blue) 0 46px, var(--blue-deep) 46px 52px,
    var(--blue) 52px 120px, #004ecc 120px 126px);
}

#bg-stripes::before {
  content: "";
  position: absolute;
  inset: -100px;
  background: inherit;
  animation: stripeDrift 25s linear infinite;
  will-change: transform;
}

@keyframes stripeDrift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(240px, 0, 0); }
}

#bg-halftone {
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.38) 1.6px, transparent 1.7px);
  background-size: 14px 14px;
  mix-blend-mode: multiply;
}

#bg-vignette {
  background: radial-gradient(ellipse at 32% 40%, transparent 30%, rgba(0, 0, 0, 0.72) 100%);
}

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

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

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

/* Big black slash behind the menu */
#slash {
  position: fixed;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  background: var(--black);
  clip-path: polygon(58% 0, 100% 0, 100% 100%, 40% 100%, 52% 62%, 45% 60%, 60% 24%, 51% 22%);
  transition: clip-path 0.7s cubic-bezier(0.8, 0, 0.15, 1);
  will-change: clip-path;
}

body[data-screen]:not([data-screen="home"]) #slash {
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 0 62%, 0 60%, 0 24%, 0 22%);
}

/* ============ SHELL / HUD ============ */
#shell {
  position: relative;
  z-index: 2;
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

#hud-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px 0;
  letter-spacing: 0.12em;
  font-weight: 600;
  gap: 12px;
  flex-shrink: 0;
}

.hud-tag {
  background: var(--black);
  color: var(--white);
  padding: 5px 12px;
  transform: rotate(-1.5deg);
  font-size: clamp(11px, 1.4vw, 13px);
  text-transform: uppercase;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}

.hud-tag.alt {
  background: var(--white);
  color: var(--black);
  transform: rotate(1.2deg);
}

#hud-bottom {
  padding: 6px 24px 14px;
  display: flex;
  gap: 18px;
  align-items: center;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.95;
  flex-shrink: 0;
}

#hud-bottom .key {
  display: inline-block;
  background: var(--white);
  color: var(--black);
  padding: 2px 7px;
  margin-right: 6px;
  font-weight: 700;
  transform: skewX(-8deg);
  border-radius: 2px;
  font-size: 11px;
}

.hud-mobile-only {
  display: none;
}

#stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

/* ============ SCREENS ============ */
.screen {
  position: absolute;
  inset: 0;
  padding: 2vh 4vw;
  display: none;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--blue) transparent;
}

.screen.active {
  display: block;
}

.screen::-webkit-scrollbar {
  width: 6px;
}

.screen::-webkit-scrollbar-thumb {
  background: var(--blue);
}

/* ---------- HOME ---------- */
#screen-home {
  display: none;
  padding: 2vh 4vw;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#screen-home.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100%;
}

#intro-eyebrow {
  font-size: clamp(12px, 1.5vw, 19px);
  letter-spacing: clamp(0.15em, 0.5vw, 0.45em);
  text-transform: uppercase;
  margin-bottom: 1.2vh;
  font-weight: 700;
  text-shadow: 2px 2px 0 var(--black);
  word-break: break-word;
}

#big-name {
  line-height: 0.92;
  margin-bottom: 2.2vh;
  cursor: pointer;
  width: max-content;
  max-width: 100%;
}

#big-name .ransom {
  font-size: clamp(40px, 8.5vw, 118px);
  display: block;
}

#big-name:hover .ch { animation: jitter 0.35s ease both; }
#big-name:hover .ch:nth-child(odd) { animation-delay: 0.03s; }
#big-name:hover .ch:nth-child(3n) { animation-delay: 0.06s; }
#big-name:active { transform: scale(0.985); }

#tagline {
  max-width: 520px;
  font-size: clamp(14px, 1.4vw, 19px);
  line-height: 1.45;
  background: var(--black);
  padding: 12px 18px;
  transform: rotate(-1deg);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.3);
  margin-bottom: 2vh;
}

#menu {
  margin-top: 2vh;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.8vh;
}

.menu-item {
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--white);
  text-align: left;
  position: relative;
  padding: 4px 18px 4px 6px;
  transform: translateX(-40px);
  opacity: 0;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.menu-item .ransom {
  font-size: clamp(28px, 4.2vw, 54px);
}

.loaded .menu-item {
  animation: menuIn 0.5s cubic-bezier(0.2, 1.2, 0.3, 1) forwards;
}

.menu-item:nth-child(1) { animation-delay: 0.1s; }
.menu-item:nth-child(2) { animation-delay: 0.2s; }
.menu-item:nth-child(3) { animation-delay: 0.3s; }
.menu-item:nth-child(4) { animation-delay: 0.4s; }

@keyframes menuIn {
  to { transform: translateX(0); opacity: 1; }
}

.menu-item::before {
  content: "";
  position: absolute;
  left: -4%;
  top: 15%;
  height: 72%;
  width: 0;
  background: var(--black);
  transform: skewX(-16deg);
  z-index: -1;
  transition: width 0.18s cubic-bezier(0.7, 0, 0.3, 1);
}

.menu-item.sel::before,
.menu-item:active::before {
  width: 108%;
}

.menu-item.sel {
  transform: translateX(12px) !important;
}

.menu-item.sel .ch { color: var(--white); }
.menu-item.sel .ch.box { background: var(--blue); color: var(--white); }
.menu-item.sel .ch.boxw { background: var(--white); color: var(--black); }
.menu-item:focus-visible { outline: 3px dashed var(--white); outline-offset: 4px; }

.cursor-mark {
  position: absolute;
  right: -36px;
  top: 50%;
  transform: translateY(-50%) rotate(8deg);
  font-size: clamp(16px, 2.2vw, 26px);
  opacity: 0;
  transition: opacity 0.12s;
  color: var(--white);
  text-shadow: 2px 2px 0 var(--black);
}

.menu-item.sel .cursor-mark {
  opacity: 1;
  animation: pulse 0.9s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: translateY(-50%) rotate(8deg) scale(1); }
  50% { transform: translateY(-50%) rotate(8deg) scale(1.18); }
}

/* ---------- RANSOM LETTERS ---------- */
.ransom {
  display: inline-block;
  white-space: nowrap;
}

.ransom .ch {
  display: inline-block;
  line-height: 1;
  padding: 0 0.01em;
  transition: transform 0.15s;
}

.ransom .ch.box { background: var(--black); color: var(--white); padding: 0.02em 0.08em; margin: 0 0.03em; }
.ransom .ch.boxw { background: var(--white); color: var(--black); padding: 0.02em 0.08em; margin: 0 0.03em; }
.ransom .ch.blue, .ransom .ch.red { color: var(--blue); text-shadow: 1px 1px 0 var(--black); }

.menu-item:hover .ch, .menu-item.sel .ch {
  animation: jitter 0.35s ease both;
}
.menu-item:hover .ch:nth-child(odd) { animation-delay: 0.03s; }
.menu-item:hover .ch:nth-child(3n) { animation-delay: 0.06s; }

@keyframes jitter {
  0% { transform: var(--t) translateY(0); }
  35% { transform: var(--t) translateY(-5px) rotate(3deg); }
  70% { transform: var(--t) translateY(2px) rotate(-2deg); }
  100% { transform: var(--t) translateY(0); }
}

/* ---------- SUB-SCREEN CHROME & HEADER ---------- */
.sub {
  background: transparent;
}

.screen-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1vh 0 3vh;
  gap: 16px;
  flex-wrap: wrap;
}

.sub .screen-head {
  position: relative;
  display: inline-block;
  margin: 0;
}

.sub .screen-head .ransom {
  font-size: clamp(34px, 5.5vw, 76px);
}

.sub .screen-head::after {
  content: "";
  position: absolute;
  left: -4px;
  bottom: -8px;
  height: 8px;
  width: 105%;
  background: var(--blue);
  transform: skewX(-24deg);
}

.back-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: var(--white);
  color: var(--black);
  padding: 6px 14px;
  transform: rotate(-1.5deg);
  cursor: pointer;
  border: 0;
  font-weight: 700;
  font-family: inherit;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.4);
  transition: background 0.15s, color 0.15s, transform 0.15s;
}

.back-hint .back-key {
  background: var(--black);
  color: var(--white);
  padding: 1px 5px;
  font-size: 10px;
  border-radius: 2px;
}

.back-hint:hover, .back-hint:active {
  background: var(--blue);
  color: var(--white);
  transform: rotate(0) scale(1.04);
}

.back-hint:hover .back-key {
  background: var(--white);
  color: var(--black);
}

/* ---------- PROJECTS ---------- */
#repo-status {
  font-size: 14px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 2vh;
  opacity: 0.85;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 310px), 1fr));
  gap: 22px 28px;
  padding-top: 10px;
}

#repo-grid {
  padding-bottom: 6vh;
  padding-top: 10px;
}

.card {
  color: var(--ink);
  position: relative;
  padding: 18px 20px 16px;
  cursor: pointer;
  text-decoration: none;
  display: block;
  transform: rotate(var(--tilt, 0deg)) translateY(20px);
  opacity: 0;
  transition: transform 0.18s cubic-bezier(0.7, 0, 0.3, 1), filter 0.18s;
  filter: drop-shadow(6px 6px 0 rgba(0, 0, 0, 0.45));
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--white);
  clip-path: polygon(0 6%, 3% 0, 100% 0, 100% 88%, 97% 100%, 0 100%);
}

.card > * {
  position: relative;
}

.screen.active .card {
  animation: cardIn 0.45s cubic-bezier(0.2, 1.1, 0.3, 1) forwards;
  animation-delay: var(--d, 0ms);
}

@keyframes cardIn {
  to { transform: rotate(var(--tilt, 0deg)) translateY(0); opacity: 1; }
}

.card:hover {
  transform: rotate(0deg) scale(1.02) !important;
  filter: drop-shadow(8px 8px 0 var(--black));
  z-index: 3;
}

.card:active {
  transform: rotate(0deg) scale(0.99) !important;
}

.card .lang {
  position: absolute;
  top: -10px;
  right: 12px;
  background: var(--black);
  color: var(--white);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 10px;
  transform: rotate(1.5deg);
}

.card .lang::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lc, var(--blue));
  margin-right: 6px;
}

.card h3 {
  font-family: 'Archivo Black', 'Arial Black', Impact, sans-serif;
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.1;
  text-transform: uppercase;
  margin-bottom: 8px;
  word-break: break-word;
}

.card h3 em {
  font-style: normal;
  color: var(--blue);
}

.card p {
  font-size: 15px;
  line-height: 1.4;
  min-height: 42px;
  color: #2c2c2c;
}

.card .meta {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  gap: 8px;
}

.card .meta .go {
  background: var(--blue);
  color: var(--white);
  padding: 4px 10px;
  transform: skewX(-10deg);
  transition: background 0.15s;
  white-space: nowrap;
}

.card:hover .meta .go {
  background: var(--black);
}

/* Featured cards */
.card.feat {
  color: var(--white);
  filter: drop-shadow(6px 6px 0 var(--blue-deep));
}

.card.feat::before {
  background: var(--black);
}

.card.feat:hover {
  filter: drop-shadow(8px 8px 0 var(--blue));
}

.card.feat p {
  color: #d8d5cf;
}

.card.feat h3 {
  color: var(--white);
}

.card.feat .lang {
  background: var(--blue);
}

.card.feat .meta .go {
  background: var(--white);
  color: var(--black);
}

.card.feat:hover .meta .go {
  background: var(--blue);
  color: var(--white);
}

.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3dff6e;
  margin-right: 6px;
  animation: liveBlink 1.1s ease-in-out infinite;
}

@keyframes liveBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.grid-label {
  font-family: 'Archivo Black', 'Arial Black', Impact, sans-serif;
  font-size: clamp(14px, 1.6vw, 19px);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 3vh 0 1.6vh;
  text-shadow: 2px 2px 0 var(--black);
}

.grid-label .bar {
  display: inline-block;
  width: 28px;
  height: 10px;
  background: var(--white);
  transform: skewX(-24deg);
  margin-right: 10px;
  vertical-align: baseline;
}

/* Card Thumbnails */
.card .thumb {
  margin: -18px -20px 12px;
  height: 140px;
  overflow: hidden;
  position: relative;
  clip-path: polygon(0 0, 100% 0, 100% 84%, 0 100%);
  background: var(--black);
}

.card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(0.9) contrast(1.15);
  transition: filter 0.2s, transform 0.3s;
}

.card:hover .thumb img {
  filter: grayscale(0) contrast(1.05);
  transform: scale(1.05);
}

.card .thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 78%, var(--blue) 78.5%);
}

/* ---------- SKILLS ---------- */
.skill-group {
  margin-bottom: 4.5vh;
  max-width: 920px;
}

.skill-group h3 {
  display: inline-block;
  background: var(--white);
  color: var(--black);
  font-family: 'Archivo Black', 'Arial Black', Impact, sans-serif;
  font-size: clamp(16px, 2vw, 24px);
  text-transform: uppercase;
  padding: 5px 14px;
  transform: rotate(-1.2deg);
  margin-bottom: 2vh;
  box-shadow: 4px 4px 0 var(--black);
}

.skill-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.skill-row .name {
  width: 220px;
  flex-shrink: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 1px 1px 0 var(--black);
}

.skill-bar {
  flex: 1;
  height: 18px;
  background: rgba(0, 0, 0, 0.55);
  position: relative;
  transform: skewX(-18deg);
  overflow: hidden;
  max-width: 520px;
}

.skill-bar .fill {
  position: absolute;
  inset: 0;
  width: 0;
  background: var(--white);
  background-image: repeating-linear-gradient(90deg, transparent 0 24px, rgba(0, 102, 255, 0.25) 24px 28px);
  transition: width 0.85s cubic-bezier(0.2, 1, 0.3, 1);
}

.skill-row .lv {
  font-family: 'Archivo Black', 'Arial Black', Impact, sans-serif;
  font-size: 14px;
  width: 60px;
  text-align: right;
  text-shadow: 2px 2px 0 var(--black);
}

/* ---------- ABOUT / CONTACT ---------- */
.paper {
  max-width: 760px;
  background: var(--white);
  color: var(--ink);
  padding: 26px 30px;
  font-size: 17px;
  line-height: 1.55;
  clip-path: polygon(0 3%, 2% 0, 100% 0, 100% 95%, 98% 100%, 0 100%);
  transform: rotate(-0.5deg);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.5);
  margin-bottom: 3.5vh;
}

.paper strong { color: var(--blue); }
.paper .stamp {
  display: inline-block;
  background: var(--black);
  color: var(--white);
  padding: 2px 7px;
  transform: rotate(-1.5deg);
  font-weight: 700;
  font-size: 13px;
}

.paper a { color: var(--blue); font-weight: 700; }
.paper a:hover { background: var(--blue); color: var(--white); text-decoration: none; }
.paper .quote em {
  display: inline;
  background: var(--black);
  color: var(--white);
  font-style: italic;
  padding: 1px 6px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  line-height: 1.7;
}

/* Polaroid About Photo */
.about-photo {
  float: right;
  width: min(220px, 36%);
  margin: 0 0 12px 20px;
  background: var(--white);
  padding: 8px 8px 28px;
  transform: rotate(2.5deg);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.35);
  position: relative;
}

.about-photo img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center top;
  display: block;
  filter: contrast(1.05);
}

.about-photo::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%) rotate(-3deg);
  width: 80px;
  height: 22px;
  background: var(--blue);
  opacity: 0.9;
  clip-path: polygon(4% 0, 96% 8%, 100% 92%, 0 100%);
}

.about-photo figcaption {
  text-align: center;
  margin-top: 6px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--ink);
}

.contact-list {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 5vh;
}

.contact-chip {
  background: var(--black);
  color: var(--white);
  text-decoration: none;
  font-family: 'Archivo Black', 'Arial Black', Impact, sans-serif;
  font-size: clamp(14px, 1.8vw, 20px);
  text-transform: uppercase;
  padding: 12px 22px;
  transform: skewX(-8deg) rotate(-1deg);
  transition: transform 0.15s, background 0.15s, color 0.15s;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.4);
}

.contact-chip span {
  display: inline-block;
  transform: skewX(8deg);
}

.contact-chip:hover, .contact-chip:active {
  background: var(--white);
  color: var(--blue);
  transform: skewX(-8deg) rotate(0) scale(1.04);
}

/* ============ CV DOWNLOAD BUTTON ============ */
.cv-btn {
  display: inline-block;
  margin-bottom: 5vh;
  text-decoration: none;
  background: var(--blue);
  color: var(--white);
  font-family: 'Archivo Black', 'Arial Black', Impact, sans-serif;
  font-size: clamp(15px, 2vw, 22px);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 14px 26px;
  transform: skewX(-8deg) rotate(-1deg);
  box-shadow: 6px 6px 0 var(--black);
  transition: transform 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
}

.cv-btn span {
  display: inline-block;
  transform: skewX(8deg);
}

.cv-btn:hover {
  background: var(--white);
  color: var(--blue);
  transform: skewX(-8deg) rotate(0) scale(1.04);
  box-shadow: 8px 8px 0 var(--black);
}

.cv-btn:active {
  transform: skewX(-8deg) scale(0.98);
}

/* ============ CONTACT FORM ============ */
#contact-form {
  width: 100%;
}

.form-head {
  font-family: 'Archivo Black', 'Arial Black', Impact, sans-serif;
  font-size: clamp(17px, 2vw, 22px);
  text-transform: uppercase;
  margin-bottom: 16px;
  position: relative;
  display: inline-block;
}

.form-head::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -5px;
  height: 6px;
  width: 100%;
  background: var(--blue);
  transform: skewX(-24deg);
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field span {
  display: block;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 12px;
  margin-bottom: 5px;
}

.field input, .field textarea {
  width: 100%;
  border: 3px solid var(--black);
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 16px;
  transform: skewX(-2deg);
  transition: border-color 0.15s, box-shadow 0.15s;
}

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

.field textarea {
  resize: vertical;
  min-height: 100px;
}

.form-foot {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.form-send {
  border: 0;
  cursor: pointer;
  margin-bottom: 0;
  font-size: 16px;
  padding: 12px 24px;
}

.form-send:disabled {
  opacity: 0.55;
  cursor: wait;
}

#form-status {
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 13px;
  text-transform: uppercase;
  color: var(--ink);
}

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

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

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

#wipe.go .pane {
  animation: wipeAcross 0.68s cubic-bezier(0.75, 0, 0.2, 1) forwards;
}

#wipe.go .p2 { animation-delay: 0.05s; }
#wipe.go .p1 { animation-delay: 0.1s; }

@keyframes wipeAcross {
  0% { transform: translate3d(-130%, 0, 0) skewX(-14deg); }
  45% { transform: translate3d(0%, 0, 0) skewX(-14deg); }
  55% { transform: translate3d(0%, 0, 0) skewX(-14deg); }
  100% { transform: translate3d(130%, 0, 0) skewX(-14deg); }
}

#wipe .flash {
  position: absolute;
  inset: 0;
  background: var(--white);
  opacity: 0;
}

#wipe.go .flash {
  animation: flash 0.68s linear forwards;
}

@keyframes flash {
  0%, 44% { opacity: 0; }
  48% { opacity: 1; }
  56% { opacity: 0; }
  100% { opacity: 0; }
}

/* ============ PER-SCREEN MENU ARTWORK ============ */
.menu-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
  opacity: 0;
  will-change: opacity, transform;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

body[data-screen="home"]     #art-home,
body[data-screen="skills"]   #art-skills,
body[data-screen="about"]    #art-about,
body[data-screen="contact"]  #art-contact {
  opacity: 1;
}

body.has-art-home #slash { display: none; }

body.has-art-home[data-screen="home"] #bg-halftone,
body.has-art-skills[data-screen="skills"] #bg-halftone,
body.has-art-about[data-screen="about"] #bg-halftone,
body.has-art-contact[data-screen="contact"] #bg-halftone {
  opacity: 0.5;
}

body.has-art-home[data-screen="home"] #bg-vignette,
body.has-art-skills[data-screen="skills"] #bg-vignette {
  background:
    linear-gradient(100deg, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0.15) 36%, transparent 58%),
    radial-gradient(ellipse at 32% 40%, transparent 30%, rgba(0, 0, 0, 0.55) 100%);
}

body.has-art-contact[data-screen="contact"] #bg-vignette {
  background:
    linear-gradient(260deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.18) 38%, transparent 60%),
    radial-gradient(ellipse at 68% 40%, transparent 30%, rgba(0, 0, 0, 0.55) 100%);
}

body.has-art-about[data-screen="about"] #bg-vignette {
  background:
    linear-gradient(260deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.35) 42%, transparent 64%),
    radial-gradient(ellipse at 68% 40%, transparent 25%, rgba(0, 0, 0, 0.6) 100%);
}

body.has-art-home #menu .ch:not(.box):not(.boxw),
body.has-art-home #big-name .ch:not(.box):not(.boxw) {
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.6);
}

/* ============ RIGHT-ALIGNED SCREENS ============ */
.screen.align-right.active {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.screen.align-right .contact-list {
  justify-content: flex-end;
}

.screen.align-right .paper {
  transform: rotate(0.5deg);
}

.screen.align-right .about-photo {
  float: left;
  margin: 0 20px 12px 0;
  transform: rotate(-2.5deg);
}

/* ============ MOBILE-SPECIFIC ANIMATED BACKGROUND ============ */
#mobile-anim-layer {
  display: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.m-speedlines {
  position: absolute;
  inset: -60%;
  background: repeating-linear-gradient(
    130deg,
    transparent 0 28px,
    rgba(0, 212, 255, 0.28) 28px 32px,
    transparent 32px 85px,
    rgba(255, 255, 255, 0.18) 85px 88px,
    transparent 88px 150px,
    rgba(0, 102, 255, 0.35) 150px 158px,
    transparent 158px 210px
  );
  animation: mobileSpeed 14s linear infinite;
  will-change: transform;
}

@keyframes mobileSpeed {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-210px, 250px, 0); }
}

.m-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 212, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.08) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.8) 0%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.8) 0%, transparent 85%);
  animation: gridPulse 6s ease-in-out infinite alternate;
}

@keyframes gridPulse {
  0% { opacity: 0.35; }
  100% { opacity: 0.9; }
}

/* Floating Persona 5 geometric shards */
.m-shard {
  position: absolute;
  pointer-events: none;
  will-change: transform;
}

.m-shard.s1 {
  top: 10%;
  right: -15px;
  width: 140px;
  height: 140px;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.38), rgba(0, 102, 255, 0.08));
  border: 2px solid rgba(0, 212, 255, 0.6);
  clip-path: polygon(30% 0, 100% 0, 70% 100%, 0% 100%);
  animation: floatShard1 8s ease-in-out infinite alternate;
}

@keyframes floatShard1 {
  0% { transform: translateY(0) rotate(-14deg) scale(1); }
  100% { transform: translateY(-24px) rotate(-8deg) scale(1.08); }
}

.m-shard.s2 {
  top: 48%;
  left: -20px;
  width: 110px;
  height: 60px;
  background: rgba(11, 11, 13, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.5);
  clip-path: polygon(0 0, 75% 0, 100% 50%, 75% 100%, 0 100%, 25% 50%);
  animation: floatShard2 10s ease-in-out infinite alternate;
}

@keyframes floatShard2 {
  0% { transform: translate3d(0, 0, 0) rotate(12deg); }
  100% { transform: translate3d(18px, -30px, 0) rotate(18deg); }
}

.m-shard.s3 {
  bottom: 18%;
  right: 8%;
  width: 80px;
  height: 80px;
  background: linear-gradient(45deg, rgba(0, 102, 255, 0.4), rgba(255, 255, 255, 0.15));
  border: 2px solid rgba(255, 255, 255, 0.7);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  animation: floatShard3 7s ease-in-out infinite alternate;
}

@keyframes floatShard3 {
  0% { transform: translateY(0) rotate(0deg) scale(0.9); }
  100% { transform: translateY(-36px) rotate(45deg) scale(1.15); }
}

.m-shard.s4 {
  top: 6%;
  left: 8%;
  width: 75px;
  height: 16px;
  background: var(--blue);
  transform: skewX(-28deg);
  box-shadow: 0 0 14px rgba(0, 102, 255, 0.85);
  animation: pulseRibbon 4s ease-in-out infinite alternate;
}

@keyframes pulseRibbon {
  0% { opacity: 0.4; transform: skewX(-28deg) translateX(0); }
  100% { opacity: 0.95; transform: skewX(-28deg) translateX(15px); }
}

.m-shard.s5 {
  bottom: 8%;
  left: 6%;
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.12);
  border: 1.5px solid rgba(0, 212, 255, 0.5);
  transform: rotate(25deg);
  animation: floatShard5 9s ease-in-out infinite alternate;
}

@keyframes floatShard5 {
  0% { transform: rotate(25deg) translateY(0); }
  100% { transform: rotate(70deg) translateY(-20px); }
}

/* Tactical HUD crosshairs */
.m-crosshair {
  position: absolute;
  width: 42px;
  height: 42px;
  pointer-events: none;
}

.m-crosshair.c1 {
  top: 22%;
  right: 14%;
  border: 1.5px dashed rgba(0, 212, 255, 0.4);
  border-radius: 50%;
  animation: spin 30s linear infinite;
}

.m-crosshair.c1::before, .m-crosshair.c1::after {
  content: "";
  position: absolute;
  background: rgba(0, 212, 255, 0.5);
}

.m-crosshair.c1::before {
  top: 50%; left: 15%; right: 15%; height: 1px; transform: translateY(-50%);
}

.m-crosshair.c1::after {
  left: 50%; top: 15%; bottom: 15%; width: 1px; transform: translateX(-50%);
}

.m-crosshair.c2 {
  bottom: 28%;
  left: 12%;
  border-left: 2px solid var(--white);
  border-top: 2px solid var(--white);
  width: 24px;
  height: 24px;
  opacity: 0.35;
  animation: pulseCrosshair 5s ease-in-out infinite alternate;
}

@keyframes pulseCrosshair {
  0% { opacity: 0.2; transform: scale(0.9); }
  100% { opacity: 0.6; transform: scale(1.15); }
}

.m-badge {
  position: absolute;
  bottom: 5%;
  right: 4%;
  font-family: 'Archivo Black', 'Arial Black', Impact, sans-serif;
  font-size: 10px;
  letter-spacing: 0.22em;
  color: rgba(255, 255, 255, 0.12);
  transform: rotate(-90deg);
  transform-origin: bottom right;
  pointer-events: none;
}

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

/* Tablet & Mobile Screens <= 820px */
@media (max-width: 820px) {
  /* Show dedicated mobile animation instead of oversized desktop art */
  #mobile-anim-layer {
    display: block;
  }
  .menu-art {
    display: none !important;
  }
  #slash {
    display: none !important;
  }

  .screen.align-right.active {
    align-items: stretch;
  }
  .screen.align-right .contact-list {
    justify-content: flex-start;
  }
  .screen.align-right .paper {
    transform: none;
  }
}

/* Mobile Screens <= 700px */
@media (max-width: 700px) {
  #hud-top {
    padding: 10px 14px 0;
    gap: 8px;
  }
  .hud-tag {
    font-size: 11px;
    padding: 4px 8px;
    transform: none;
  }
  .hud-tag.alt {
    transform: none;
  }

  #hud-bottom {
    font-size: 11px;
    gap: 10px;
    padding: 4px 14px 10px;
  }
  .hud-desktop-keys {
    display: none;
  }
  .hud-mobile-only {
    display: inline-block;
    opacity: 0.8;
  }

  .screen {
    padding: 1.5vh 3.5vw;
  }
  #screen-home {
    padding: 1.5vh 3.5vw;
    justify-content: flex-start;
  }

  #tagline {
    padding: 10px 12px;
    transform: none;
    max-width: 100%;
  }

  .cursor-mark {
    right: -28px;
    font-size: 18px;
  }

  .about-photo {
    float: none;
    width: min(190px, 60%);
    margin: 0 auto 16px;
    display: block;
    transform: rotate(1deg);
  }

  .screen.align-right .about-photo {
    float: none;
    margin: 0 auto 16px;
    transform: rotate(1deg);
  }

  .paper {
    padding: 20px 16px;
    font-size: 16px;
    clip-path: none;
    transform: none !important;
    border-left: 4px solid var(--blue);
  }

  .field input, .field textarea {
    transform: none;
    font-size: 16px;
  }

  .contact-chip {
    padding: 10px 16px;
    font-size: 14px;
    transform: none;
  }
  .contact-chip span {
    transform: none;
  }
  .contact-chip:hover, .contact-chip:active {
    transform: scale(1.03);
  }

  .cv-btn {
    width: 100%;
    text-align: center;
    padding: 14px 18px;
    transform: none;
  }
  .cv-btn span {
    transform: none;
  }
  .cv-btn:hover, .cv-btn:active {
    transform: scale(1.02);
  }

  .card {
    transform: none !important;
    filter: drop-shadow(4px 4px 0 rgba(0, 0, 0, 0.5));
  }
}

/* Small Phones <= 580px */
@media (max-width: 580px) {
  .grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  #repo-grid {
    grid-template-columns: 1fr;
  }

  .screen-header-bar {
    margin-bottom: 2vh;
  }

  .back-hint .back-key {
    display: none;
  }

  /* Two-line responsive layout for skills */
  .skill-row {
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
  }
  .skill-row .name {
    width: auto;
    flex: 1;
    font-size: 15px;
  }
  .skill-row .lv {
    width: auto;
    font-size: 14px;
  }
  .skill-bar {
    flex-basis: 100%;
    width: 100%;
    max-width: 100%;
    height: 14px;
    transform: skewX(-12deg);
  }
}

/* Touch & Reduced Motion Defaults */
@media (pointer: coarse) {
  .card:hover {
    transform: none !important;
  }
  .menu-item.sel {
    transform: translateX(6px) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}
