/* ============================================================
   Ghostwritten Studios — style.css
   Dark "ink & spectre" theme
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  --bg:         #0a0c12;
  --bg-deep:    #06070b;
  --surface:    #11141d;
  --surface-2:  #171b27;
  --line:       rgba(233, 230, 223, 0.08);
  --line-hover: rgba(139, 124, 247, 0.55);

  --text:       #e9e6df;   /* warm paper white */
  --muted:      #9a97a8;
  --faint:      #6d6a7c;

  --accent:     #8b7cf7;   /* ghost violet */
  --accent-soft:rgba(139, 124, 247, 0.14);
  --accent-2:   #5fd4c4;   /* spectral teal */

  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body:    "Inter", -apple-system, "Segoe UI", sans-serif;

  --radius: 12px;
  --header-h: 72px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html { scroll-behavior: smooth; }

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

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; }

.container {
  width: min(1140px, 92%);
  margin-inline: auto;
}

/* Small caps section label, e.g. "SELECTED WORK" */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--accent-2);
}
.eyebrow::before {
  content: "";
  width: 2rem;
  height: 1px;
  background: var(--accent-2);
  opacity: 0.6;
}

.section-title {
  font-size: clamp(2rem, 4.5vw, 3rem);
  margin: 0.5rem 0 1rem;
}

.section-intro { color: var(--muted); max-width: 62ch; }

section { padding: 5.5rem 0; }

/* ---------- Header / navigation ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  z-index: 100;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(10, 12, 18, 0.72);
  border-bottom: 1px solid transparent;
  transition: border-color 0.4s var(--ease), background 0.4s var(--ease);
}
.site-header.scrolled {
  background: rgba(6, 7, 11, 0.85);
  border-bottom-color: var(--line);
}

.nav-wrap {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
}
.brand img { width: 34px; height: 34px; }
.brand .brand-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.brand .brand-name em {
  font-style: normal;
  color: var(--accent);
  transition: color 0.3s var(--ease), text-shadow 0.3s var(--ease);
}
.brand:hover .brand-name em {
  color: var(--accent-2);
  text-shadow: 0 0 18px rgba(95, 212, 196, 0.5);
}

.site-nav ul {
  display: flex;
  gap: 2.25rem;
  list-style: none;
}

/* Ink-stroke rollover: underline draws in from the left,
   text lifts to full white with a soft spectral glow */
.site-nav a {
  position: relative;
  display: inline-block;
  padding: 0.4rem 0;
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.3s var(--ease), text-shadow 0.3s var(--ease);
}
.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.35s var(--ease);
}
.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--text);
  text-shadow: 0 0 16px rgba(139, 124, 247, 0.55);
}
.site-nav a:hover::after,
.site-nav a:focus-visible::after {
  transform: scaleX(1);
}
/* Current page: underline stays, drawn from center */
.site-nav a.active {
  color: var(--text);
}
.site-nav a.active::after {
  transform: scaleX(1);
  transform-origin: center;
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0.5rem;
}
.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  margin: 5px 0;
  border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 92vh;
  display: flex;
  align-items: center;
  padding: calc(var(--header-h) + 3rem) 0 4rem;
  background:
    radial-gradient(ellipse 60% 45% at 70% 20%, rgba(139, 124, 247, 0.13), transparent 65%),
    radial-gradient(ellipse 50% 40% at 20% 85%, rgba(95, 212, 196, 0.07), transparent 60%),
    var(--bg-deep);
  overflow: hidden;
}

/* Drifting spirit orbs — soft radial gradients, no blur filter.
   (Animating a blur()ed element causes visible re-raster shimmer,
   so the softness is baked into the gradient instead.) */
.orb {
  position: absolute;
  pointer-events: none;
  animation: drift 100s ease-in-out infinite alternate;
  will-change: transform;
}
.orb-1 { width: 640px; height: 640px; top: 0;   left: 48%;
         background: radial-gradient(circle, rgba(139, 124, 247, 0.14) 0%, rgba(139, 124, 247, 0.05) 40%, transparent 68%);
         animation-duration: 100s; }
.orb-2 { width: 460px; height: 460px; top: 45%; left: 2%;
         background: radial-gradient(circle, rgba(95, 212, 196, 0.09) 0%, rgba(95, 212, 196, 0.03) 40%, transparent 68%);
         animation-delay: -35s; animation-duration: 125s; }
.orb-3 { width: 340px; height: 340px; top: 18%; left: 24%;
         background: radial-gradient(circle, rgba(139, 124, 247, 0.08) 0%, transparent 65%);
         animation-delay: -70s; animation-duration: 115s; }

@keyframes drift {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(38px, -30px, 0); }
}

.hero-inner { position: relative; z-index: 1; max-width: 780px; }

.hero h1 {
  position: relative;
  font-size: clamp(3rem, 8.5vw, 5.75rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 1.25rem 0 1.5rem;
}
/* Ghost echo behind the wordmark */
.hero h1 .ghost-echo {
  position: absolute;
  inset: 0;
  color: var(--accent);
  filter: blur(10px);
  transform: translate(5px, -5px);
  animation: haunt 48s ease-in-out infinite alternate;
  user-select: none;
  pointer-events: none;
}
/* Fade only — moving a blurred layer causes re-raster shimmer */
@keyframes haunt {
  from { opacity: 0.13; }
  to   { opacity: 0.22; }
}

.hero .tagline {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 56ch;
  margin-bottom: 2.5rem;
}
.hero .tagline strong { color: var(--text); font-weight: 500; }

/* ---------- Buttons ---------- */
.btn-row { display: flex; flex-wrap: wrap; gap: 1rem; }

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1.9rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease),
              background 0.3s var(--ease), color 0.3s var(--ease),
              border-color 0.3s var(--ease);
}
.btn-primary {
  background: var(--accent);
  color: #0d0b1a;
  border: 1px solid var(--accent);
}
.btn-primary:hover {
  transform: translateY(-3px);
  background: #a396ff;
  box-shadow: 0 10px 34px rgba(139, 124, 247, 0.4);
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn-ghost:hover {
  transform: translateY(-3px);
  border-color: var(--accent-2);
  color: var(--accent-2);
  box-shadow: 0 10px 30px rgba(95, 212, 196, 0.18);
}
.btn-small { padding: 0.5rem 1.1rem; font-size: 0.72rem; }

/* ---------- Project cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.75rem;
  margin-top: 3rem;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.4s var(--ease), border-color 0.4s var(--ease),
              box-shadow 0.4s var(--ease);
}
.card:hover {
  transform: translateY(-7px);
  border-color: var(--line-hover);
  box-shadow:
    0 22px 44px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(139, 124, 247, 0.18),
    0 0 42px rgba(139, 124, 247, 0.10);
}

.card-media {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-2);
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: scale(1.01);
  transition: transform 0.6s var(--ease), filter 0.6s var(--ease);
  filter: saturate(0.9);
}
.card:hover .card-media img {
  transform: scale(1.06);
  filter: saturate(1.1);
}
/* Show the upper part of a tall screenshot instead of dead center */
.card-media img.pos-upper { object-position: center 22%; }

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.4rem 1.5rem 1.6rem;
}

.card-tag {
  align-self: flex-start;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-2);
  background: rgba(95, 212, 196, 0.08);
  border: 1px solid rgba(95, 212, 196, 0.25);
  border-radius: 999px;
  padding: 0.22rem 0.7rem;
  margin-bottom: 0.9rem;
}
.card-tag.tag-violet {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(139, 124, 247, 0.35);
}

.card h3 {
  font-size: 1.55rem;
  margin-bottom: 0.4rem;
  transition: color 0.3s var(--ease);
}
.card:hover h3 { color: var(--accent); }

.card p {
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 1.4rem;
}

.card-links {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* Status chip for unreleased work */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 10px var(--accent-2);
  animation: pulse 12s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

/* ---------- Feature strip (home page) ---------- */
.feature-strip {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg-deep);
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 2.5rem;
}
.feature h3 {
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
}
.feature h3 a { color: inherit; transition: color 0.3s var(--ease); }
.feature h3 a:hover { color: var(--accent-2); }
.feature p { font-size: 0.92rem; color: var(--muted); }
.feature .num {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--accent);
  letter-spacing: 0.2em;
  display: block;
  margin-bottom: 0.75rem;
}

/* ---------- Page hero (inner pages) ---------- */
.page-hero {
  padding: calc(var(--header-h) + 5rem) 0 3.5rem;
  background:
    radial-gradient(ellipse 55% 60% at 75% 0%, rgba(139, 124, 247, 0.10), transparent 65%),
    var(--bg-deep);
  border-bottom: 1px solid var(--line);
}
.page-hero h1 { font-size: clamp(2.5rem, 6vw, 4rem); margin: 0.75rem 0 1rem; }
.page-hero p  { color: var(--muted); max-width: 62ch; }

/* ---------- About page ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 3.5rem;
  align-items: start;
}
.portrait {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  transition: border-color 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.portrait:hover {
  border-color: var(--line-hover);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5), 0 0 40px rgba(139, 124, 247, 0.12);
}
/* Tall source image: crop from the top, overflow trimmed below */
.portrait img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: top;
}
.about-copy h2 { font-size: 2.1rem; margin-bottom: 1rem; }
.about-copy p  { color: var(--muted); margin-bottom: 1.1rem; }
.about-copy p strong { color: var(--text); font-weight: 500; }

.cred {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.2rem 1.5rem;
  margin: 1.75rem 0;
}
.cred .cred-title { font-weight: 600; color: var(--text); }
.cred p { font-size: 0.9rem; margin: 0; }

.skills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.5rem;
  list-style: none;
}
.skills li {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.95rem;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease),
              background 0.3s var(--ease), transform 0.3s var(--ease);
}
.skills li:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
}

/* ---------- Former works (about page) ---------- */
.history-section {
  border-top: 1px solid var(--line);
  background: var(--bg-deep);
}
.history {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  margin-top: 3rem;
}
.history-item {
  display: grid;
  grid-template-columns: 360px 1fr;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.4s var(--ease), border-color 0.4s var(--ease),
              box-shadow 0.4s var(--ease);
}
.history-item:hover {
  transform: translateY(-5px);
  border-color: var(--line-hover);
  box-shadow:
    0 22px 44px rgba(0, 0, 0, 0.45),
    0 0 42px rgba(139, 124, 247, 0.10);
}
.history-media {
  background: var(--surface-2);
  overflow: hidden;
  min-height: 240px;
}
.history-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transform: scale(1.01);
  transition: transform 0.6s var(--ease), filter 0.6s var(--ease);
  filter: saturate(0.85);
}
.history-item:hover .history-media img {
  transform: scale(1.04);
  filter: saturate(1);
}
.history-body {
  padding: 1.8rem 2rem;
}
.history-body h3 {
  font-size: 1.7rem;
  margin: 0.9rem 0 0.6rem;
}
.history-body p {
  font-size: 0.92rem;
  color: var(--muted);
}
.history-body p strong { color: var(--text); font-weight: 500; }
.history-body .skills { margin-top: 1.2rem; }

@media (max-width: 860px) {
  .history-item { grid-template-columns: 1fr; }
  .history-media { max-height: 260px; }
}

/* ---------- CTA band ---------- */
.cta-band {
  text-align: center;
  background:
    radial-gradient(ellipse 50% 90% at 50% 100%, rgba(139, 124, 247, 0.12), transparent 70%),
    var(--bg-deep);
  border-top: 1px solid var(--line);
}
.cta-band h2 { font-size: clamp(1.9rem, 4vw, 2.8rem); margin-bottom: 0.75rem; }
.cta-band p  { color: var(--muted); margin-bottom: 2rem; }
.cta-band .btn-row { justify-content: center; }

/* ---------- Social buttons ---------- */
.socials {
  display: flex;
  gap: 0.9rem;
  list-style: none;
}
.socials a {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--muted);
  transition: transform 0.3s var(--ease), color 0.3s var(--ease),
              border-color 0.3s var(--ease), box-shadow 0.3s var(--ease),
              background 0.3s var(--ease);
}
.socials a svg { width: 19px; height: 19px; fill: currentColor; }
.socials a:hover {
  transform: translateY(-4px);
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 8px 22px rgba(139, 124, 247, 0.25);
}
/* Discord gets its own hover tint */
.socials a.discord:hover {
  border-color: #5865f2;
  background: rgba(88, 101, 242, 0.12);
  box-shadow: 0 8px 22px rgba(88, 101, 242, 0.3);
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-deep);
  padding: 3.5rem 0 2.5rem;
}
.footer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}
.footer-brand {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--text);
}
.footer-brand em { font-style: normal; color: var(--accent); }
.footer-note {
  width: 100%;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--faint);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
}
.footer-note a { color: var(--faint); transition: color 0.3s; }
.footer-note a:hover { color: var(--accent-2); }

/* ---------- Scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.visible {
  opacity: 1;
  transform: none;
}
/* Stagger children inside grids */
.card-grid .reveal:nth-child(2) { transition-delay: 0.08s; }
.card-grid .reveal:nth-child(3) { transition-delay: 0.16s; }
.card-grid .reveal:nth-child(4) { transition-delay: 0.24s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important; /* without this, infinite 0.01ms animations strobe every frame */
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; }
  .portrait { max-width: 320px; }
}

@media (max-width: 880px) {
  .nav-toggle { display: block; }

  .site-nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--bg-deep);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 24px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(-12px);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.35s var(--ease), opacity 0.35s var(--ease),
                visibility 0.35s;
  }
  .site-nav.open {
    transform: none;
    opacity: 1;
    visibility: visible;
  }
  .site-nav ul {
    flex-direction: column;
    gap: 0;
    padding: 1rem 4%;
  }
  .site-nav li { border-bottom: 1px solid var(--line); }
  .site-nav li:last-child { border-bottom: 0; }
  .site-nav a { display: block; padding: 1rem 0; }
  .site-nav a::after { display: none; }

  section { padding: 4rem 0; }
  .hero { min-height: 80vh; }
}
