/* ─── RESET ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── TOKENS ─────────────────────────────────────────── */
:root {
  --bg:          #09090b;
  --bg-card:     #0d0e11;
  --bg-elevated: #111318;
  --silver:      #A5AAB3;
  --blue:        #3D98B4;
  --violet:      #6157E1;
  --red:         #f12727;
  --border-red:  rgba(255, 0, 43, 0.4);
  --border-dim:  rgba(165, 170, 179, 0.1);
  --text:        #ECEEF2;
  --text-muted:  #7E8393;
  --text-soft:   #A5AAB3;
  --sans:        'Manrope', sans-serif;
  --serif:       'Droid Serif', serif;
  --mono:        'DM Mono', monospace;
}

/* ─── BASE ───────────────────────────────────────────── */
/* FIX: scroll-snap-type must live on the scroll container.
   Putting it on <html> makes the root viewport the snap container,
   which is exactly what we need for full-page card snapping. */
html {
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 300;
  overflow-x: hidden;
}

/* ─── DOT-GRID TEXTURE ───────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, rgba(165,170,179,0.07) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse 100% 80% at 50% 0%, black 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 100% 80% at 50% 0%, black 30%, transparent 100%);
}

/* ─── NAV ────────────────────────────────────────────── */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 3rem;
  border-bottom: 1px solid var(--border-red);
  background: rgba(9, 9, 11, 0.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.nav-logo {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  font-style: italic;
  color: var(--text);
}
.nav-logo em {
  color: var(--red);
  font-style: normal;
}

nav ul {
  display: flex;
  gap: 2rem;
  list-style: none;
}
nav ul a {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.1em;
  transition: color 0.2s;
  position: relative;
  padding-bottom: 3px;
}
nav ul a::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 100%; height: 1px;
  background: var(--blue);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
nav ul a:hover { color: var(--blue); }
nav ul a:hover::after { transform: scaleX(1); }

.nav-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  border: 1px solid var(--border-dim);
  border-radius: 20px;
  padding: 5px 14px;
}

/* ─── BLINK DOT ──────────────────────────────────────── */
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3ecf8e;
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(62, 207, 142, 0.6);
  animation: blink 2.4s ease-in-out infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px rgba(62, 207, 142, 0.6); }
  50%       { opacity: 0.25; box-shadow: none; }
}

/* ─── HERO ───────────────────────────────────────────── */
/* FIX: height:100vh (not min-height) so it occupies exactly one snap slot */
.hero {
  position: relative;
  height: 100vh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 3rem;
  padding-top: 4rem;
  overflow: hidden;
  z-index: 1;
}

/* Violet ambient glow */
.hero::after {
  content: '';
  position: absolute;
  top: 5%; left: -10%;
  width: 60vw; height: 60vw;
  background: radial-gradient(ellipse at center, rgba(97,87,225,0.08) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}
.hero > * { position: relative; z-index: 1; }

.hero-bg-text {
  position: absolute;
  bottom: -0.05em;
  right: -0.02em;
  font-family: var(--serif);
  font-size: clamp(8rem, 22vw, 22rem);
  font-weight: 700;
  font-style: italic;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.035);
  pointer-events: none;
  user-select: none;
  line-height: 1;
  white-space: nowrap;
  z-index: 0;
}

.hero-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--blue);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 1.75rem;
  opacity: 0;
  animation: up 0.7s 0.1s forwards;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hero-eyebrow::before {
  content: '';
  display: inline-block;
  width: 24px; height: 1px;
  background: var(--blue);
  opacity: 0.7;
}

.hero-name {
  font-family: var(--serif);
  font-size: clamp(3.5rem, 9vw, 8rem);
  font-weight: 700;
  font-style: italic;
  line-height: 0.93;
  letter-spacing: -0.02em;
  opacity: 0;
  animation: up 0.7s 0.22s forwards;
}
.hero-name-line2 { color: var(--violet); }

.hero-sub {
  margin-top: 2.25rem;
  font-size: clamp(0.88rem, 1.4vw, 1rem);
  color: var(--text-soft);
  max-width: 480px;
  line-height: 1.85;
  font-weight: 300;
  opacity: 0;
  animation: up 0.7s 0.36s forwards;
  border-left: 2px solid rgba(255,77,61,0.35);
  padding-left: 1.1rem;
}

.hero-actions {
  margin-top: 2.75rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  opacity: 0;
  animation: up 0.7s 0.48s forwards;
}

/* UPGRADE: metrics as a unified bordered row */
.hero-metrics {
  margin-top: 4.5rem;
  display: flex;
  opacity: 0;
  animation: up 0.7s 0.6s forwards;
  border: 1px solid var(--border-dim);
  border-radius: 8px;
  overflow: hidden;
  width: fit-content;
}
.metric-item {
  padding: 1rem 2rem;
  border-right: 1px solid var(--border-dim);
}
.metric-item:last-child { border-right: none; }
.metric-val {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 700;
  font-style: italic;
  color: var(--text);
  line-height: 1;
}
.metric-lbl {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 6px;
  letter-spacing: 0.08em;
}

@keyframes up {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── BUTTONS ────────────────────────────────────────── */
.btn {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 11px 24px;
  border-radius: 5px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.22s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
}
.btn-primary {
  background: var(--violet);
  color: #fff;
  box-shadow: 0 0 20px rgba(97,87,225,0.3);
}
.btn-primary:hover {
  background: #7068f0;
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(97,87,225,0.45);
}
.btn-outline {
  background: transparent;
  color: var(--text-soft);
  border: 1px solid var(--border-red);
}
.btn-outline:hover {
  color: var(--text);
  border-color: var(--red);
  background: rgba(255,77,61,0.05);
}

/* ─── SECTION HEADER ─────────────────────────────────── */
.section-head {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 3rem 3rem 2rem;
}
.section-idx {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--red);
  letter-spacing: 0.1em;
}
.section-title {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  font-style: italic;
  color: var(--text);
}
.section-rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--border-red), transparent);
}

/* ─── PROJECT CARDS ──────────────────────────────────── */
/* Single page scroll. Each card is a compact snap target.
   scroll-snap-align: center means the browser centers the
   snapped card in the viewport — neighbors peek above/below. */
#projects-stack {
  display: flex;
  flex-direction: column;
}

.card-viewport {
  scroll-snap-align: center;
  scroll-snap-stop: always;
  flex-shrink: 0;
  width: 100%;
  padding: 0;
  position: relative;
  z-index: 1;
}

.project-card {
  width: 100%;
  height: clamp(340px, 44vh, 500px);
  background: var(--bg-card);
  border: none;
  border-radius: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  overflow: hidden;
  transition: box-shadow 0.3s;
  position: relative;
}
/* Thin gradient line — the visible seam, fades at edges */
.project-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: radial-gradient(ellipse 55% 100% at 50% 50%, rgba(255,77,61,0.6) 0%, transparent 100%);
  pointer-events: none;
  z-index: 2;
}
/* Bloom — same center axis as the line, radiates symmetrically above & below */
.project-card::before {
  content: '';
  position: absolute;
  bottom: -10px; left: 15%; right: 15%;
  height: 20px;
  background: radial-gradient(ellipse 80% 100% at 50% 50%, rgba(255,77,61,0.35) 0%, transparent 100%);
  filter: blur(7px);
  pointer-events: none;
  z-index: 2;
}
.project-card:hover {
  box-shadow: inset 0 0 80px rgba(255,77,61,0.04);
}

/* images panel — sized by its content, fills full card height */
.card-images {
  display: flex;
  align-items: center;
  padding: 1.25rem 1.25rem 1.25rem 3.25rem;
  gap: 1.25rem;
  background: var(--bg);
  overflow: hidden;
  height: 100%;
  box-sizing: border-box;
}
.card-images-row {
  display: contents; /* slots become direct flex children of .card-images */
}
.card-img-slot {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  background: var(--bg-elevated);
  /* Height = card height minus top+bottom padding (2 × 1.25rem = 2.5rem) */
  height: calc(clamp(340px, 44vh, 500px) - 2.5rem);
  flex-shrink: 0;
  width: auto; /* width is derived from aspect-ratio below */
}
/* Mobile — portrait 9:17 */
.card-img-slot:first-child {
  aspect-ratio: 9 / 17;
}
/* Laptop — landscape 16:10 */
.card-img-slot:last-child {
  aspect-ratio: 16 / 10;
}
.card-img-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s ease, filter 0.4s ease;
  filter: brightness(0.8) saturate(0.82);
}
.card-img-slot:hover img {
  transform: scale(1.06);
  filter: brightness(1) saturate(1.05);
}
.card-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

/* card info */
.card-info {
  padding: 2.5rem 2.75rem;
  display: flex;
  flex-direction: column;
}
.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.4rem;
}
.card-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--red);
  letter-spacing: 0.12em;
}
.card-badge {
  font-family: var(--mono);
  font-size: 10px;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.05em;
}
.status-live     { background: rgba(62,207,142,0.1);   color: #3ecf8e;        border: 1px solid rgba(62,207,142,0.3); }
.status-wip      { background: rgba(61,152,180,0.1);   color: var(--blue);    border: 1px solid rgba(61,152,180,0.3); }
.status-archived { background: rgba(165,170,179,0.07); color: var(--silver);  border: 1px solid rgba(165,170,179,0.2); }

.card-title {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 700;
  font-style: italic;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 1.1rem;
}
.card-desc {
  font-size: 13.5px;
  color: var(--text-soft);
  line-height: 1.85;
  font-weight: 300;
  flex: 1;
  margin-bottom: 1.75rem;
}
.stack-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.65rem;
}
.stack-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 2rem;
}
.stack-tag {
  font-family: var(--mono);
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}
.tag-blue   { background: rgba(61,152,180,0.1);   color: var(--blue);   border: 1px solid rgba(61,152,180,0.28); }
.tag-violet { background: rgba(97,87,225,0.1);    color: var(--violet); border: 1px solid rgba(97,87,225,0.28); }
.tag-silver { background: rgba(165,170,179,0.07); color: var(--silver); border: 1px solid rgba(165,170,179,0.2); }
.tag-red    { background: rgba(255,77,61,0.07);   color: var(--red);    border: 1px solid rgba(255,77,61,0.25); }

.card-links { display: flex; gap: 1rem; }
.card-link {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px;
  letter-spacing: 0.05em;
  transition: color 0.2s;
}
.card-link:hover { color: var(--blue); }

/* ─── CONTACT ────────────────────────────────────────── */
/* FIX: contact section snaps as one unit */
#contact {
  scroll-snap-align: start;
  scroll-snap-stop: always;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1rem;
}

/* Footer sits inside the contact snap zone — no separate snap needed */
footer {
  border-top: 1px solid var(--border-red);
  padding: 1.5rem 3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 1;
  margin-top: auto;
}

.contact-wrap { padding: 0 3rem 4rem;}

/* ITEM 1: .contact-intro removed — intro paragraph replaced by headline in item 2 */

/* ITEM 2: Contact headline — large serif italic CTA, sits above the contact links */
.contact-headline {
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 3.75rem);
  font-weight: 700;
  font-style: italic;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 2.75rem;
}
/* Accent word colored in violet — matches hero name accent pattern */
.contact-headline span { color: var(--violet); }
/* ITEM 3: Contact grid — 3 columns on desktop, 2 on tablet, 1 on mobile.
   Each cell is a self-contained card: label on top, value below.
   Hover: left border accent slides in, value brightens. */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  /* Gap background creates the grid line color between cells */
  background: var(--border-dim);
  border: 1px solid var(--border-dim);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

/* Link cell — row layout: text group on left, icon on right, both vertically centered */
.contact-cell {
  background: var(--bg-card);
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 1.25rem 1.5rem;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  min-height: 90px;
  border-left: 2px solid transparent;
  transition: background 0.22s, border-color 0.22s;
}
.contact-cell:hover {
  background: var(--bg-elevated);
  border-left-color: var(--blue);
}

/* Static cell (e.g. Location) — same row layout, not interactive 
.contact-cell-static {
  background: var(--bg-card);
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 1.25rem 1.5rem;
  position: relative;
  min-height: 90px;
  border-left: 2px solid transparent;
}
*/

/* Text group — grows to fill available space, pushing icon to the far right */
.contact-cell-text {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* ITEM 4 UPDATE: Icon size increased to 32px. Right end of cell, vertically centered.
   img-based icons (Simple Icons SVGs + CodinGame .ico) tinted blue via CSS filter.
   Inline SVG icons use currentColor = var(--blue). */
.contact-cell-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  margin-left: 1.25rem;
  opacity: 0.5;
  transition: opacity 0.22s;
}
/* Brand icons and CodinGame .ico — tinted to match --blue (#3D98B4) 
.contact-cell-icon[src] {
  filter: invert(55%) sepia(60%) saturate(400%) hue-rotate(160deg) brightness(1.1);
}
*/
/* Inline SVG icons — currentColor picks up the blue */
.contact-cell-icon:not([src]) {
  color: var(--blue);
}
.contact-cell:hover .contact-cell-icon { opacity: 1; }
/* Static cell icon stays dim — not interactive */
.contact-cell-static .contact-cell-icon { opacity: 0.2; }

.contact-cell-lbl {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 5px;
  transition: color 0.22s;
}
.contact-cell:hover .contact-cell-lbl { color: var(--silver); }

.contact-cell-val {
  font-size: 14px;
  font-weight: 400;
  color: var(--blue);
  transition: color 0.22s;
}
.contact-cell:hover .contact-cell-val { color: var(--text); }

/* Static value — not a link, softer color */
.contact-cell-static .contact-cell-lbl { color: var(--text-muted); }
.contact-cell-static .contact-cell-val { color: var(--text-soft); font-size: 14px; }
/* ITEM 4: Availability pill — stretched full width of the contact column.
   Larger padding, brighter green text, justified layout with dot on left
   and a subtle "open to work" label on the right for scannability. */
.availability {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: #3ecf8e;
  border: 1px solid rgba(62, 207, 142, 0.25);
  border-radius: 6px;
  padding: 1.1rem 1.5rem;
  width: 100%;
  background: rgba(62, 207, 142, 0.04);
}
.availability-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.availability-right {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(62, 207, 142, 0.5);
}

footer p {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
footer em { color: var(--red); font-style: normal; }

/* ─── REVEAL ANIMATION ───────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}

/* ─── RESPONSIVE ─────────────────────────────────────── */

/* Tablet — 2 columns for contact grid */
@media (max-width: 1024px) and (min-width: 541px) {
  .contact-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  nav { padding: 1rem 1.25rem; }
  .nav-pill { display: none; }
  nav ul { gap: 1.25rem; }
  .hero { padding: 0 1.5rem; padding-top: 4rem; }
  .hero-metrics { flex-direction: column; width: 100%; border-radius: 8px; }
  .metric-item { border-right: none; border-bottom: 1px solid var(--border-dim); }
  .metric-item:last-child { border-bottom: none; }
  .section-head { padding: 3rem 1.5rem 1.5rem; }
  .card-viewport { padding: 0; }
  .project-card { grid-template-columns: 1fr; height: auto; }
  .card-images { padding: 1.25rem; border-right: none; border-bottom: 1px solid var(--border-red); height: 200px; }
  .contact-wrap { padding: 0 1.5rem 3rem; }
  #contact { min-height: auto; }
  footer { padding: 1.25rem 1.5rem; flex-direction: column; gap: 0.5rem; text-align: center; }
}

/* Mobile — 1 column for contact grid */
@media (max-width: 540px) {
  .contact-grid { grid-template-columns: 1fr; }
}
