/* ============================================
   Julian Calleja — Portfolio
   Palette A2: near-black / cyan (web) / coral (game)
   Space Grotesk · IBM Plex Sans · IBM Plex Mono
   ============================================ */

:root {
  --ink:        #101214;
  --ink-soft:   #16191C;
  --card-dark:  #191C1F;
  --line-dark:  rgba(244, 244, 242, 0.1);

  --paper:      #F4F4F2;
  --paper-alt:  #ECECE8;
  --card-light: #FFFFFF;
  --line-light: #DDDDD6;

  --cyan:       #22D3EE;
  --cyan-deep:  #0E7490;
  --cyan-dark:  #083344;
  --coral:      #FF5D5D;
  --coral-deep: #C22E2E;

  --text-on-dark:   #F4F4F2;
  --muted-on-dark:  #9BA0A3;
  --text-on-light:  #17191B;
  --muted-on-light: #5C6165;

  --ff-head: 'Space Grotesk', system-ui, sans-serif;
  --ff-body: 'IBM Plex Sans', system-ui, sans-serif;
  --ff-mono: 'IBM Plex Mono', monospace;

  --max-w: 1140px;
  --nav-h: 68px;
  --section-pad: clamp(4rem, 10vw, 7rem);
  --radius: 12px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: var(--nav-h); }

body {
  font-family: var(--ff-body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-on-light);
  background: var(--ink);
}

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

.wrap { max-width: var(--max-w); margin: 0 auto; padding: 0 1.25rem; }

h1, h2, h3 { font-family: var(--ff-head); font-weight: 700; line-height: 1.1; }

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(16, 18, 20, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}
.nav.scrolled { border-bottom-color: var(--line-dark); }

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: var(--ff-head);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--text-on-dark);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.logo .dot { color: var(--cyan); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  list-style: none;
}
.nav-links a {
  font-family: var(--ff-mono);
  font-size: 0.85rem;
  color: var(--muted-on-dark);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text-on-dark); }

.nav-cta {
  background: var(--cyan);
  color: var(--ink) !important;
  padding: 0.5rem 1.1rem;
  border-radius: 8px;
  font-weight: 500;
  transition: filter 0.2s;
}
.nav-cta:hover { filter: brightness(1.1); }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 44px; height: 44px;
  position: relative;
  z-index: 110;
}
.nav-toggle span {
  display: block;
  width: 22px; height: 2px;
  background: var(--text-on-dark);
  margin: 5px auto;
  transition: transform 0.3s, opacity 0.3s;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--nav-h) + 3rem) 0 4rem;
  background-color: var(--ink);
  background-image: radial-gradient(rgba(244,244,242,0.05) 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--text-on-dark);
}
#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hero .wrap { position: relative; z-index: 1; }

.terminal-line {
  font-family: var(--ff-mono);
  font-size: 0.9rem;
  color: var(--cyan);
  margin-bottom: 1.25rem;
}
.terminal-line .cursor {
  display: inline-block;
  width: 0.6em;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero h1 {
  font-size: clamp(2.6rem, 7.5vw, 4.8rem);
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
}
.hero h1 .web { color: var(--cyan); }
.hero h1 .game { color: var(--coral); }

.hero-tags {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.pill {
  font-family: var(--ff-mono);
  font-size: 0.75rem;
  padding: 0.3rem 0.85rem;
  border-radius: 99px;
  border: 1px solid;
}
.pill-cyan  { color: var(--cyan);  border-color: rgba(34, 211, 238, 0.4); }
.pill-coral { color: var(--coral); border-color: rgba(255, 93, 93, 0.4); }

.hero-sub {
  max-width: 30rem;
  color: var(--muted-on-dark);
  margin-bottom: 2.25rem;
}

.hero-ctas { display: flex; gap: 0.9rem; flex-wrap: wrap; }

.btn {
  font-family: var(--ff-head);
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  padding: 0.8rem 1.6rem;
  border-radius: 8px;
  display: inline-block;
  transition: filter 0.2s, background 0.2s, color 0.2s;
  cursor: pointer;
  border: none;
}
.btn-cyan { background: var(--cyan); color: var(--ink); }
.btn-cyan:hover { filter: brightness(1.1); }
.btn-ghost {
  border: 1px solid rgba(244, 244, 242, 0.3);
  color: var(--text-on-dark);
  background: transparent;
}
.btn-ghost:hover { background: rgba(244, 244, 242, 0.08); }
.btn-coral { background: var(--coral); color: var(--ink); }
.btn-coral:hover { filter: brightness(1.08); }

/* ---------- Sections ---------- */
section { padding: var(--section-pad) 0; }

.section-eyebrow {
  font-family: var(--ff-mono);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}
.section-title {
  font-size: clamp(1.9rem, 4.5vw, 2.8rem);
  letter-spacing: -0.02em;
  margin-bottom: 0.9rem;
}
.section-intro { max-width: 38rem; margin-bottom: 3rem; }

/* Light sections */
.section-light { background: var(--paper); color: var(--text-on-light); }
.section-light .section-eyebrow { color: var(--cyan-deep); }
.section-light .section-intro { color: var(--muted-on-light); }

/* Dark sections */
.section-dark { background: var(--ink); color: var(--text-on-dark); }
.section-dark .section-intro { color: var(--muted-on-dark); }

/* ---------- Work grid ---------- */
.work-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
}

.work-card {
  background: var(--card-light);
  border: 1px solid var(--line-light);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s, border-color 0.25s;
}
.work-card:hover { transform: translateY(-4px); border-color: var(--cyan-deep); }

.work-thumb {
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ff-mono);
  font-size: 0.8rem;
  overflow: hidden;
}
.work-thumb img { width: 100%; height: 100%; object-fit: contain; object-position: center; }

.work-body { padding: 1.4rem 1.5rem 1.6rem; }

.work-num {
  font-family: var(--ff-mono);
  font-size: 0.75rem;
  color: var(--cyan-deep);
  margin-bottom: 0.4rem;
}
.work-body h3 { font-size: 1.3rem; margin-bottom: 0.4rem; }
.work-body p { font-size: 0.95rem; color: var(--muted-on-light); margin-bottom: 0.9rem; }

.work-tags { display: flex; gap: 0.45rem; flex-wrap: wrap; margin-bottom: 1rem; }
.work-tag {
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  background: var(--paper-alt);
  color: var(--muted-on-light);
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
}

.status {
  font-family: var(--ff-mono);
  font-size: 0.68rem;
  padding: 0.18rem 0.6rem;
  border-radius: 99px;
  border: 1px solid;
  vertical-align: middle;
  margin-left: 0.5rem;
}
.status-pending { color: var(--muted-on-light); border-color: var(--line-light); }
.status-live { color: var(--cyan-deep); border-color: var(--cyan-deep); }

.work-link {
  font-family: var(--ff-head);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--cyan-deep);
}

/* ---------- Game section ---------- */
.game-card {
  border: 1px solid rgba(255, 93, 93, 0.35);
  border-radius: var(--radius);
  background: var(--card-dark);
  padding: clamp(1.75rem, 5vw, 3rem);
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: center;
}
.game-card .section-eyebrow { color: var(--coral); }
.game-title {
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}
.game-copy p { color: var(--muted-on-dark); margin-bottom: 1.5rem; }
.game-shot {
  aspect-ratio: 16 / 9;
  background: var(--ink);
  border: 1px dashed rgba(255, 93, 93, 0.3);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ff-mono);
  font-size: 0.8rem;
  color: var(--coral);
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
}
.about-copy p { color: var(--muted-on-light); margin-bottom: 1.1rem; }
.about-copy .btn { margin-top: 0.75rem; }

.skills-block h3 {
  font-family: var(--ff-mono);
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--cyan-deep);
  margin-bottom: 0.75rem;
}
.skills-list { list-style: none; margin-bottom: 1.75rem; }
.skills-list li {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line-light);
  font-size: 0.95rem;
}

/* ---------- Contact ---------- */
.contact-info { max-width: 34rem; }
.contact-info p { color: var(--muted-on-dark); margin-bottom: 1.25rem; }
.contact-info a { color: var(--cyan); text-decoration: none; }
.contact-info a:hover { text-decoration: underline; }

.contact-detail {
  font-family: var(--ff-mono);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

/* ---------- Footer ---------- */
.footer {
  background: var(--ink);
  border-top: 1px solid var(--line-dark);
  padding: 1.75rem 0;
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.footer p {
  font-family: var(--ff-mono);
  font-size: 0.8rem;
  color: var(--muted-on-dark);
}

/* ---------- Case study pages ---------- */
.case-hero {
  padding: calc(var(--nav-h) + 4rem) 0 4rem;
  background: var(--ink);
  color: var(--text-on-dark);
}
.case-crumb {
  font-family: var(--ff-mono);
  font-size: 0.85rem;
  color: var(--cyan);
  margin-bottom: 1rem;
}
.case-crumb a { color: var(--muted-on-dark); text-decoration: none; }
.case-crumb a:hover { color: var(--text-on-dark); }
.case-hero h1 { font-size: clamp(2.4rem, 6vw, 4rem); margin-bottom: 1rem; }
.case-hero .case-sub { max-width: 34rem; color: var(--muted-on-dark); }

.case-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1.25rem;
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line-dark);
}
.case-meta h3 {
  font-family: var(--ff-mono);
  font-weight: 400;
  font-size: 0.72rem;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.3rem;
}
.case-meta p { font-size: 0.92rem; }

.case-body h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); margin: 3rem 0 1rem; }
.case-body h2:first-child { margin-top: 0; }
.case-body p { color: var(--muted-on-light); max-width: 44rem; margin-bottom: 1.1rem; }
.case-body ul { max-width: 44rem; margin: 0 0 1.1rem 1.25rem; color: var(--muted-on-light); }
.case-body li { margin-bottom: 0.5rem; }

.swatches { display: flex; gap: 0.75rem; flex-wrap: wrap; margin: 1.25rem 0 1.5rem; }
.swatch { text-align: center; }
.swatch-chip {
  width: 72px; height: 72px;
  border-radius: 10px;
  border: 1px solid var(--line-light);
  margin-bottom: 0.4rem;
}
.swatch span {
  font-family: var(--ff-mono);
  font-size: 0.68rem;
  color: var(--muted-on-light);
}

.case-shot {
  background: var(--paper-alt);
  border: 1px dashed var(--line-light);
  border-radius: var(--radius);
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ff-mono);
  font-size: 0.8rem;
  color: var(--muted-on-light);
  margin: 1.5rem 0;
  overflow: hidden;
}
.case-shot img { width: 100%; height: auto; display: block; }
.case-shot:has(img) {
  aspect-ratio: auto;
  border-style: solid;
  padding: 0;
  background: none;
}

.case-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line-light);
}
.case-nav a {
  font-family: var(--ff-head);
  font-weight: 500;
  color: var(--cyan-deep);
  text-decoration: none;
}
.case-nav a:hover { text-decoration: underline; }

/* ---------- Reveal animation ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Responsive ---------- */
@media (min-width: 640px) {
  .work-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 860px) {
  .game-card { grid-template-columns: 1.1fr 1fr; }
  .about-grid { grid-template-columns: 1.3fr 1fr; }
}

@media (max-width: 767px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: fixed;
    inset: 0;
    background: var(--ink);
    flex-direction: column;
    justify-content: center;
    gap: 2rem;
    transform: translateX(100%);
    transition: transform 0.3s ease;
  }
  .nav-links.open { transform: translateX(0); }
  .nav-links a { font-size: 1.1rem; }
}
