:root {
  --background: #0c0c0c;
  --text: #f5f5f5;
  --muted: #c4c4c4;
  --line: rgba(255, 255, 255, 0.16);
  --accent: #ffffff;
  --surface: #0c0c0c;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("assets/JetBrainsMono-Regular.woff2") format("woff2");
  font-display: swap;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; overflow-x: clip; background: var(--background); }

body {
  margin: 0;
  overflow-x: clip;
  position: relative;
  isolation: isolate;
  background: transparent;
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
  font-size: 16px;
  line-height: 1.45;
}

.loading-screen { position: fixed; z-index: 10; inset: 0; display: grid; place-items: center; background: #000; color: var(--text); transition: opacity 360ms ease, visibility 360ms ease; }
.loading-screen__label { font-size: 14px; letter-spacing: 0.14em; text-transform: uppercase; animation: loading-pulse 1.1s ease-in-out infinite alternate; }
body.is-loaded .loading-screen { visibility: hidden; opacity: 0; pointer-events: none; }
@keyframes loading-pulse { to { opacity: 0.35; } }
.dither-background { position: fixed; z-index: -2; inset: 0; width: 100%; height: 100%; opacity: 0.28; pointer-events: none; animation: background-breathe 14s ease-in-out infinite alternate; }
body::before { position: fixed; z-index: -1; top: 0; right: 0; left: 0; height: min(58vh, 620px); content: ""; background: linear-gradient(to bottom, rgba(12, 12, 12, 0.97) 0%, rgba(12, 12, 12, 0.78) 58%, transparent 100%); pointer-events: none; }
@keyframes background-breathe { to { opacity: 0.38; } }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
a { color: inherit; text-underline-offset: 0.18em; }
a:hover, a:focus-visible { color: var(--accent); }

.page { width: min(100% - 48px, 960px); margin: 0 auto; }

footer {
  display: flex;
  justify-content: center;
  padding: 22px 0;
  font-size: 14px;
  text-align: center;
}

section { padding: 104px 0 0; }
.intro { min-height: 100svh; padding: clamp(20px, 4vh, 52px) 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }

h1, h2, h3, p { margin-top: 0; }
.ascii-title { position: relative; width: min(100%, 840px); height: clamp(142px, 23vw, 230px); margin-bottom: 18px; overflow: hidden; perspective: var(--ascii-perspective, 700px); }
.ascii-content { position: absolute; inset: 0; transform-origin: center; transform-style: preserve-3d; will-change: transform; animation: ascii-rotate 6.6s ease-in-out infinite; }
.ascii-title pre { display: block; margin: 0; color: #fff; font-family: "JetBrains Mono", monospace; font-size: 6px; font-weight: 400; line-height: 1; white-space: pre; text-shadow: 0 0 8px rgba(255, 255, 255, 0.35); }
.ascii-hit-area { position: absolute; z-index: 2; }
@keyframes ascii-rotate { 0%, 100% { transform: rotateY(-7deg); } 50% { transform: rotateY(7deg); } }
.ascii-title .ascii-shine { position: absolute; inset: 0; color: #fff; opacity: 0.98; pointer-events: none; text-shadow: 0 0 4px #fff, 0 0 12px rgba(255, 255, 255, 0.95); clip-path: polygon(-36% 0, -18% 0, -64% 100%, -82% 100%); }
.ascii-title .ascii-shine.is-shining { animation: ascii-shine 2s ease-in-out; }
@keyframes ascii-shine { 0% { clip-path: polygon(-36% 0, -18% 0, -64% 100%, -82% 100%); } 100% { clip-path: polygon(154% 0, 172% 0, 126% 100%, 108% 100%); } }
h2 { margin-bottom: 30px; font-size: clamp(1.5rem, 2.8vw, 2.1rem); font-weight: 400; letter-spacing: -0.04em; }
h3 { margin-bottom: 5px; font-size: 16px; font-weight: 400; }
p, span, small, .tool-preview, .video-placeholder { transition: color 160ms ease; }
.lead { max-width: 760px; color: var(--muted); font-size: clamp(16px, 1.8vw, 18px); line-height: 1.65; }
.social-links { display: flex; gap: 10px; margin-top: 12px; }
.social-links a { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--line); border-radius: 4px; background: rgba(255, 255, 255, 0.04); text-decoration: none; transition: color 160ms ease, border-color 160ms ease, background 160ms ease, transform 160ms ease; }
.social-links a:hover, .social-links a:focus-visible { border-color: var(--accent); background: rgba(255, 255, 255, 0.12); transform: translateY(-2px); }
.social-links svg { width: 18px; height: 18px; fill: currentColor; }

.tool-rail { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tool-card, .project-card { min-width: 0; border: 0; border-radius: 5px; background: var(--surface); box-shadow: 0 14px 35px rgba(0, 0, 0, 0.16); }
.tool-card { padding: 14px; text-decoration: none; transition: background 160ms ease, transform 160ms ease; }
.tool-card:hover, .tool-card:focus-visible { background: rgba(255, 255, 255, 0.06); transform: translateY(-4px); }
.tool-preview { position: relative; display: grid; aspect-ratio: 16 / 9; place-items: center; overflow: hidden; margin-bottom: 14px; border-radius: 3px; background: rgba(0, 0, 0, 0.18); color: var(--muted); font-size: 13px; }
.tool-preview__image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tool-card span, .tool-card small { display: block; }
.tool-card small { margin-top: 3px; color: var(--muted); }
.projects-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.projects-header h2 { margin-bottom: 0; }
.project-filters { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.project-filter { padding: 7px 10px; border: 0; border-radius: 3px; background: rgba(255, 255, 255, 0.06); color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; transition: background 160ms ease, color 160ms ease; }
.project-filter:hover, .project-filter:focus-visible, .project-filter.is-active { background: rgba(255, 255, 255, 0.16); color: var(--text); }
.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.project-card { padding: 14px; }
.project-card[hidden] { display: none; }
.video-placeholder { position: relative; display: grid; aspect-ratio: 16 / 10; place-items: center; overflow: hidden; margin-bottom: 14px; border-radius: 3px; background: rgba(0, 0, 0, 0.18); color: var(--muted); font-size: 13px; }
.video-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.video-placeholder iframe { width: 100%; height: 100%; border: 0; border-radius: inherit; opacity: 0; transition: opacity 220ms ease; }
.video-placeholder.is-loaded iframe { opacity: 1; }
.video-trigger { position: absolute; z-index: 1; inset: 0; display: grid; gap: 8px; place-content: center; width: 100%; border: 0; background: rgba(0, 0, 0, 0.22); color: var(--text); font: inherit; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; text-shadow: 0 1px 8px #000; cursor: pointer; transition: background 160ms ease; }
.video-trigger:hover, .video-trigger:focus-visible { background: rgba(0, 0, 0, 0.08); }
.video-trigger__icon { width: 0; height: 0; margin: 0 auto; border-top: 7px solid transparent; border-bottom: 7px solid transparent; border-left: 11px solid currentColor; }
.video-placeholder.is-loading .video-trigger, .video-placeholder.is-loaded .video-preview { visibility: hidden; opacity: 0; }
.media-loader { position: absolute; z-index: 1; inset: 0; display: grid; place-items: center; overflow: hidden; background: #090909; color: var(--muted); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; transition: opacity 220ms ease, visibility 220ms ease; }
.media-loader::after { position: absolute; inset: -60% -100%; content: ""; background: linear-gradient(125deg, transparent 43%, rgba(255, 255, 255, 0.22) 50%, transparent 57%); animation: media-loading-shine 1.6s linear infinite; }
.video-placeholder.is-loaded .media-loader { visibility: hidden; opacity: 0; }
@keyframes media-loading-shine { from { transform: translateX(-38%); } to { transform: translateX(38%); } }
.project-card p, .experience-list p { color: var(--muted); }
.project-card--tiktok { display: block; color: inherit; text-decoration: none; transition: background 160ms ease, transform 160ms ease; }
.project-card--tiktok:hover, .project-card--tiktok:focus-visible { background: rgba(255, 255, 255, 0.06); transform: translateY(-4px); }
.video-placeholder--tiktok { border: 1px solid var(--line); background: transparent; }
.tiktok-logo { width: 42px; height: 42px; color: var(--text); transition: transform 160ms ease; }
.tiktok-logo, .tiktok-logo * { fill: currentColor !important; }
.project-card--tiktok:hover .tiktok-logo, .project-card--tiktok:focus-visible .tiktok-logo { transform: scale(1.08); }
p:hover, span:hover, small:hover, .tool-preview:hover, .video-placeholder:hover { color: #fff; }
.experience-list { border-top: 1px solid var(--line); }
.experience-list article { padding: 20px 0; border-bottom: 1px solid var(--line); }
.experience-list p { margin-bottom: 0; }
footer { border-top: 1px solid var(--line); color: var(--muted); }

@media (max-width: 540px) {
  .page { width: min(100% - 28px, 960px); }
  section { padding-top: 68px; }
  .tool-rail { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: 1fr; }
  .projects-header { align-items: flex-start; flex-direction: column; gap: 12px; }
  .project-filters { justify-content: flex-start; }
  .project-filter { min-height: 44px; padding: 10px 12px; }
  .social-links a { width: 44px; height: 44px; }
}

@media (min-width: 541px) and (max-width: 760px) {
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .projects-header { align-items: flex-start; flex-direction: column; gap: 12px; }
  .project-filters { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .ascii-content, .ascii-shine, .dither-background, .loading-screen__label, .media-loader::after { animation: none; } .loading-screen, .video-placeholder iframe, .media-loader { transition: none; } }
