/* ==============================
   RESET & VARIABLES
============================== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

:root {
  --bg: #0b0b0b;
  --fg: #e8e8e8;
  --muted: #8a8a8a;
  --accent: #ff59c8;
  --left-max: 550px;
  --ring: color-mix(in srgb, var(--accent) 70%, transparent);
}

.light {
  --bg: #f8f8f8;
  --fg: #0b0b0b;
  --muted: #666;
  --accent: #9b2cff;
}

body {
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ==============================
   ACCESSIBILITY
============================== */
.skip {
  position: absolute;
  left: -9999px;
  top: -9999px;
}
.skip:focus {
  left: 12px; top: 12px;
  background: var(--bg); color: var(--fg);
  border: 1px dashed var(--ring);
  padding: 6px 10px; z-index: 999;
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ==============================
   LAYOUT
============================== */
.wrap {
  display: grid;
  grid-template-columns: minmax(280px, var(--left-max)) 1fr;
  height: 100svh;
}

.left {
  position: relative;
  padding: 32px clamp(16px, 3vw, 28px) max(96px, calc(32px + env(safe-area-inset-bottom)));
  overflow-wrap: anywhere;
  word-break: break-word;
}

.right {
  position: relative;
  overflow: hidden;
}

/* ==============================
   TYPOGRAPHY
============================== */
h1 {
  margin-bottom: 6px;
  font-size: clamp(18px, 2vw, 22px);
  letter-spacing: 0.02em;
}
.muted { opacity: .6; }

.role {
  margin-bottom: 24px;
  font-weight: 600;
  font-size: clamp(12px, 1.2vw, 15px);
  letter-spacing: 0.08em;
}

/* ==============================
   EXPERIENCE GRID
============================== */
.experience ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 18px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.experience li {
  background: color-mix(in srgb, var(--fg) 3%, transparent);
  border: 1px dashed color-mix(in srgb, var(--fg) 20%, transparent);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: background .2s ease;
}

.experience li:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.experience .co {
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 2px;
}

.experience .ti {
  font-size: 13px;
  color: var(--muted);
}

.experience .yrs {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.arrow { display: none; }

/* ==============================
   LINKS & INTERACTIONS
============================== */
.links {
  position: absolute;
  left: 24px; right: 24px; bottom: 24px;
  display: flex; flex-wrap: wrap; gap: 18px;
  align-items: center;
  font-size: 14px;
}
.links a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.links a:hover { border-bottom-color: currentColor; }

/* ==============================
   THEME BUTTON
============================== */
.theme {
  position: absolute;
  top: 16px; right: 16px;
  padding: 6px 10px;
  font-size: 14px;
  border-radius: 999px;
  border: 1px dashed color-mix(in srgb, var(--fg) 28%, transparent);
  background: color-mix(in srgb, var(--fg) 6%, transparent);
  color: var(--fg);
  cursor: pointer;
  backdrop-filter: blur(2px);
}
.theme:focus-visible { outline: 2px dashed var(--ring); outline-offset: 2px; }
.theme:active { transform: translateY(1px); }

/* ==============================
   CANVAS & RETRO FX
============================== */
#dither { width: 100%; height: 100%; display: block; image-rendering: pixelated; }

.fx-link {
  position: relative;
  transition: text-shadow .15s steps(2, jump-none);
}
.fx-link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 33%, transparent 0) 0 0/6px 100% repeat-x;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity .2s, transform .2s;
}
.fx-link:hover {
  text-shadow: -1px 0 var(--accent), 1px 0 #00e6ff;
}
.fx-link:hover::after { opacity: 1; transform: translateY(0); }

.fx-btn { transition: filter .25s steps(3, jump-end), transform .2s; }
.fx-btn:hover { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 45%, transparent)); }
.fx-btn:active { transform: translateY(1px) scale(0.98); }

/* CRT / SCANLINE FX */
.fx-crt::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom,
    rgba(0,0,0,.18), rgba(0,0,0,.18) 1px,
    transparent 1px, transparent 3px);
  mix-blend-mode: multiply;
  opacity: .6;
}

/* Flash effect for theme toggle */
.flash { animation: flash .35s steps(6, jump-start); }
@keyframes flash {
  0% { filter: contrast(120%) saturate(130%); }
  50% { filter: contrast(200%) saturate(180%) hue-rotate(-8deg); }
  100% { filter: none; }
}

/* ==============================
   RESPONSIVE
============================== */
@media (max-width: 1024px) {
  .wrap {
    grid-template-columns: 1fr;
    grid-template-rows: auto 45svh;
    height: auto;
  }
  .left {
    padding-left: clamp(16px, 5vw, 40px);
    padding-right: clamp(16px, 5vw, 40px);
    text-align: center;
  }
  .links {
    position: static;
    justify-content: center;
    margin-top: 24px;
  }
  .right {
    border-top: 1px solid color-mix(in srgb, var(--fg) 14%, transparent);
    height: 45svh;
  }
}

@media (max-width: 600px) {
  .wrap { display: flex; flex-direction: column; height: auto; }
  .left { padding: 20px 16px 40px; text-align: center; }
  h1 { font-size: 18px; line-height: 1.2; }
  .role { font-size: 12px; margin-bottom: 16px; }
  .experience ul { grid-template-columns: 1fr; }
  .links { flex-direction: column; align-items: center; gap: 10px; margin-top: 24px; }
  .theme {
    position: fixed; top: 12px; right: 12px;
    font-size: 12px; padding: 4px 8px;
    backdrop-filter: blur(6px);
  }
  .right { height: 36svh; border-top: 1px solid color-mix(in srgb, var(--fg) 14%, transparent); }
}

/* ==============================
   ACCESSIBILITY / MOTION
============================== */
@media (prefers-reduced-motion: reduce) {
  .fx-link, .fx-btn { transition: none !important; }
  .fx-crt::after { opacity: .25; }
  .flash { animation: none; }
}
