/* ==========================================================================
   SAMUEL — Portfolio
   Minimalist Black Design
   ========================================================================== */

/* ==========================================================================
   Self-hosted Inter Font
   ========================================================================== */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/inter-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/inter-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #000;
  --surface: #111;
  --surface-hover: #1a1a1a;
  --text: #f5f5f5;
  --text-secondary: #888;
  --text-muted: #666666;
  --border: rgba(255, 255, 255, 0.08);
  --accent: #fff;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);

  --duration-fast: 150ms;
  --duration: 300ms;

  --grid-gap: 28px;

  --glass-bg: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.15);
  --glass-blur: 20px;
}

/* ==========================================================================
   Reset
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

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

button {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

img, video, iframe {
  display: block;
  max-width: 100%;
}

/* ==========================================================================
   Custom Scrollbar
   ========================================================================== */

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

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.24);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

/* ==========================================================================
   Header
   ========================================================================== */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
}

.header__inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header__name {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  position: relative;
}

.header__name a {
  transition: opacity var(--duration-fast) var(--ease);
}

.header__name a:hover {
  opacity: 0.7;
}

.header__back {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
  transition: opacity var(--duration-fast) var(--ease);
}

.header__back:hover {
  opacity: 0.7;
}

.header__back span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.header__links {
  display: flex;
  gap: 4px;
}

.header__link {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  transition:
    color var(--duration-fast) var(--ease),
    background var(--duration-fast) var(--ease);
}

.header__link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.header__link svg {
  width: 18px;
  height: 18px;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 56px 24px 0;
  position: relative;
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  padding: 80px 0 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.hero__text {
  font-size: clamp(26px, 4.5vw, 38px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.3;
  max-width: 600px;
  color: var(--text-muted);
}

.hero__text span {
  color: var(--text);
}

.hero__sphere {
  flex-shrink: 0;
  width: 280px;
  height: 280px;
  opacity: 0;
  transition: opacity 1.2s var(--ease);
  pointer-events: auto;
  cursor: default;
}

.hero__sphere--visible {
  opacity: 1;
}

/* ==========================================================================
   Section
   ========================================================================== */

.section {
  margin-bottom: 80px;
  scroll-margin-top: 72px;
}

.section__label {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 20px;
  padding-left: 2px;
}

/* ==========================================================================
   Project Grid
   ========================================================================== */

.projects {
  display: flex;
  gap: var(--grid-gap);
}

.projects__col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--grid-gap);
  min-width: 0;
}

@media (max-width: 767px) {
  .projects {
    flex-direction: column;
  }
}

/*
.card--span-2 {  reserved for future full-width cards  }
*/

/* ==========================================================================
   Card — Base
   ========================================================================== */

.card {
  display: block;
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  transition: transform var(--duration) var(--ease);
  transform-style: preserve-3d;
  will-change: transform;
}

.card:hover {
  z-index: 1;
  transform: perspective(600px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
}

/* Glow overlay — edge-only border light following cursor */
.card__glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--duration) var(--ease);
  background: radial-gradient(
    400px circle at var(--glow-x, 50%) var(--glow-y, 50%),
    rgba(255, 255, 255, 0.28),
    transparent 50%
  );
  z-index: 2;
  padding: 1.5px;
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
}

.card:hover .card__glow {
  opacity: 1;
}

/* Inner fill glow — faint light following cursor inside the card */
.card__glow-fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--duration) var(--ease);
  background: radial-gradient(
    350px circle at var(--glow-x, 50%) var(--glow-y, 50%),
    rgba(255, 255, 255, 0.02),
    transparent 60%
  );
  z-index: 1;
}

.card:hover .card__glow-fill {
  opacity: 1;
}

@media (hover: none) {
  .card:hover {
    transform: none;
  }
  .card:hover .card__glow,
  .card:hover .card__glow-fill {
    opacity: 0;
  }
}



/* Card — Simple (no media) */
.card__inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 28px 28px;
}

.card__content {
  flex: 1;
  min-width: 0;
}

.card__meta {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.card__title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.card__desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card — With Media */
.card--media .card__media {
  aspect-ratio: 16 / 9;
  background: #050505;
  position: relative;
  overflow: hidden;
}

.card--media .card__media iframe,
.card--media .card__media video,
.card--media .card__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  object-fit: cover;
}

.card--media .card__media img,
.card--media .card__media video {
  pointer-events: none;
}

.card--media .card__body {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 28px 26px;
}

.card__actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-full);
  transition:
    background var(--duration-fast) var(--ease),
    color var(--duration-fast) var(--ease);
}

.btn--primary {
  background: var(--accent);
  color: var(--bg);
}

.btn--primary:hover {
  background: #ddd;
}

.btn--disabled {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  pointer-events: none;
  cursor: default;
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.18);
  color: var(--text);
}

.btn svg {
  width: 14px;
  height: 14px;
}

/* ==========================================================================
   Video Facade (YouTube click-to-load)
   ========================================================================== */

.video-facade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  cursor: pointer;
  background: #050505;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-facade img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-facade__play path:first-child {
  fill: #111;
}

.video-facade__play {
  position: absolute;
  width: 68px;
  height: 48px;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity var(--duration) var(--ease-out), transform var(--duration) var(--ease-out);
  pointer-events: none;
}

.video-facade:hover .video-facade__play {
  opacity: 0.8;
  transform: scale(1);
}

@media (hover: none) {
  .video-facade__play {
    opacity: 0.8;
    transform: scale(1);
  }
}


/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  padding: 24px 0 48px;
  text-align: center;
  font-size: 11px;
  color: var(--text);
  opacity: 0.4;
}

/* ==========================================================================
   Page Load Animations
   ========================================================================== */



/* ==========================================================================
   About Grid
   ========================================================================== */

.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--grid-gap);
}

@media (min-width: 768px) {
  .about-grid {
    grid-template-columns: repeat(2, 1fr);
    align-items: start;
  }
}

/* ==========================================================================
   Contact Form
   ========================================================================== */

.contact {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px;
}

@media (min-width: 768px) {
  .contact {
    flex-direction: row;
    align-items: flex-start;
    gap: 40px;
  }

  .contact__text {
    flex: 1;
    min-width: 0;
    padding-top: 4px;
  }

  .contact__form {
    flex: 1;
    min-width: 0;
  }
}

.contact__form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.contact__form input,
.contact__form textarea {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--duration-fast) var(--ease);
  resize: vertical;
}

.contact__form input::placeholder,
.contact__form textarea::placeholder {
  color: var(--text-muted);
}

.contact__form input:focus,
.contact__form textarea:focus {
  border-color: rgba(255, 255, 255, 0.25);
}

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

.contact__form .btn {
  align-self: flex-start;
}

/* ==========================================================================
   Dev Stack Page
   ========================================================================== */

.stack-columns {
  display: flex;
  flex-direction: column;
  gap: 48px;
}

@media (min-width: 768px) {
  .stack-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
  }
}

.stack-column__title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* ==========================================================================
   Node Architecture
   Every [data-node] element can be individually targeted by external systems
   (animation, physics, drag-and-drop, etc.).
   ========================================================================== */

[data-node]:not(.header) {
  position: relative;
}

.stack-item {
  margin-bottom: 20px;
}

.stack-item:last-child {
  margin-bottom: 0;
}

.stack-item__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.stack-item__specs {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.stack-item__use {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 4px;
}

/* ==========================================================================
   CHIP-8 Emulator Page
   ========================================================================== */

.emu-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

.emu-page__header {
  padding: 96px 0 32px;
}

.emu-page__title {
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
}

.emu-page__lead {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 540px;
}

.emu-wrapper {
  margin: 40px 0;
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  animation: emu-fade-in var(--duration) var(--ease) 0.5s both;
}

@keyframes emu-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.emu-wrapper__canvas-wrap {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.emu-wrapper canvas {
  width: 100%;
  max-width: 640px;
  aspect-ratio: 2 / 1;
  image-rendering: pixelated;
  border-radius: var(--radius-sm);
}

.emu-wrapper__controls {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.emu-wrapper__file {
  display: none;
}

.emu-info {
  margin-bottom: 64px;
}

.emu-info h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.emu-info p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 16px;
}

.emu-info__keys {
  display: grid;
  grid-template-columns: repeat(4, 48px);
  gap: 6px;
  margin-top: 16px;
}

.emu-info__key {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  font-family: monospace;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   Responsive — Mobile
   ========================================================================== */

@media (max-width: 640px) {
  .header__inner {
    padding: 0 16px;
    height: 52px;
  }

  .page {
    padding: 52px 16px 0;
  }

  .hero {
    padding: 48px 0 40px;
  }

  .hero__text {
    font-size: 24px;
  }

  .hero__sphere {
    display: none;
  }

  .section {
    margin-bottom: 48px;
  }

  .card__inner {
    padding: 18px 18px;
  }

  .card--media .card__body {
    padding: 14px 18px 18px;
    flex-direction: column;
    align-items: flex-start;
  }

  .card__title {
    font-size: 16px;
  }

  .emu-page {
    padding: 0 16px;
  }

  .emu-wrapper__canvas-wrap {
    padding: 12px;
  }

  .emu-wrapper__controls {
    padding: 16px;
    flex-wrap: wrap;
  }
}

/* ==========================================================================
   Responsive — Tablet & Up (two-column projects)
   ========================================================================== */

@media (min-width: 768px) {
  .projects {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    align-items: start;
    gap: 20px;
  }
}

/* ==========================================================================
   Responsive — Desktop
   ========================================================================== */

@media (min-width: 1024px) {
  .hero {
    padding: 100px 0 72px;
  }

  .hero__text {
    font-size: 38px;
  }

  .hero__sphere {
    display: block;
  }
}

/* ==========================================================================
   Project Detail Page (shared template)
   ========================================================================== */

.project-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

.project-page__hero {
  padding-top: 96px;
  margin-bottom: 48px;
}

.project-page__meta {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.project-page__title {
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 16px;
}

.project-page__lead {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 560px;
}

.project-page__body {
  margin-bottom: 64px;
}

.project-page__body h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  margin-top: 40px;
}

.project-page__body h2:first-child {
  margin-top: 0;
}

.project-page__body p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 16px;
}

.project-page__body .placeholder {
  aspect-ratio: 16 / 9;
  background: var(--surface);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-muted);
  margin: 24px 0;
}

@media (max-width: 640px) {
  .project-page {
    padding: 0 16px;
  }

  .project-page__hero {
    padding-top: 76px;
    margin-bottom: 36px;
  }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
  }
}