/* ========== THEME VARIABLES ========== */
:root {
  --soft-purple: #b99ac5;
  --accent-purple: #b623d7;
  --bg-dark: #050509;
  --bg-light: #f5f3f8;
  /* Text colors checked against the dark backgrounds (WCAG AA needs 4.5:1). */
  --text-main: #e5e7eb;
  --text-muted: #a8b3c7;
  --link: #c9a8d6;
  --link-visited: #b99ac5;
  /* Darker end for gradient buttons so light text stays readable on them. */
  --btn-end: #8e5fa8;
  /* The light gradient used on highlighted words in the hero. */
  --highlight-gradient: linear-gradient(120deg, #f9fafb, #e5d4ff, #f472ff);
  /* Same colors for Home card titles, but the pink starts sooner so there is less white. */
  --card-title-gradient: linear-gradient(120deg, #f9fafb 0%, #e5d4ff 18%, #f472ff 55%);
  --max-width: 1120px;
  --radius-lg: 16px;
  --radius-md: 10px;
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.28);
  --transition-fast: 180ms ease-out;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
  color: var(--text-main);
  background: radial-gradient(
    circle at top left,
    #2b1644 0%,
    #050509 60%,
    #020106 100%
  );
  min-height: 100vh;
}

/* ========== LAYOUT ========== */

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem;
}

.main {
  min-height: calc(100vh - 120px);
}

/* ========== ACCESSIBILITY ========== */

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* The skip link is hidden until a keyboard user tabs to it. */
a.sr-only:focus,
a.sr-only:focus-visible {
  position: fixed !important;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 1000;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0.6rem 1rem;
  overflow: visible;
  clip: auto;
  border-radius: 8px;
  background: #f9fafb;
  color: #050509;
  font-weight: 600;
  text-decoration: none;
}

/* A visible focus ring for every keyboard-focusable element. */
:focus-visible {
  outline: 2px solid var(--soft-purple);
  outline-offset: 3px;
}

/* Links with no class of their own (for example the GitHub link). Zero
   specificity, so buttons and nav links keep their own colors. */
:where(a:not([class])) {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
:where(a:not([class])):visited {
  color: var(--link-visited);
}

/* Respect the "reduce motion" setting. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ========== HEADER & NAV ========== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
  background: linear-gradient(
    to bottom,
    rgba(5, 5, 15, 0.92),
    rgba(5, 5, 15, 0.78),
    transparent
  );
  border-bottom: 1px solid rgba(185, 154, 197, 0.45);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-mark {
  width: 100px;
  height: 100px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 0, #ffffff, var(--soft-purple));
  box-shadow: 0 0 0 3px rgba(182, 35, 215, 0.6),
    0 0 40px rgba(182, 35, 215, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}

.brand-mark img {
  width: 100px;
  height: 100px;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.9rem;
  color: #f9fafb;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: #e5e7eb;
  opacity: 0.85;
}

.nav-toggle {
  display: none;
  border: 1px solid rgba(185, 154, 197, 0.6);
  background: rgba(5, 5, 15, 0.9);
  color: #f9fafb;
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  list-style: none;
  margin: 0;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: radial-gradient(
    circle at top left,
    rgba(185, 154, 197, 0.25),
    transparent
  );
}

.nav-link {
  display: block;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.9rem;
  text-decoration: none;
  color: #e5e7eb;
  position: relative;
  transition: background var(--transition-fast), color var(--transition-fast),
    transform var(--transition-fast);
}

.nav-link:hover,
.nav-link.active {
  background: linear-gradient(135deg, var(--accent-purple), var(--btn-end));
  color: #f9fafb;
}

/* ========== HERO & CARDS ========== */

.hero {
  padding: 3.5rem 0 2rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(0, 1.6fr);
  gap: 2.25rem;
  align-items: center;
}

.hero-title {
  font-size: clamp(2.35rem, 4vw, 3rem);
  line-height: 1.1;
  letter-spacing: 0.01em;
  color: #f9fafb;
  margin: 0 0 1rem;
}

.hero-highlight {
  background-image: var(--highlight-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Home page card titles use the hero gradient colors, shifted so the pink starts earlier. */
[data-page="home"] .card h3 {
  background-image: var(--card-title-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  width: fit-content;
}

.hero-text {
  font-size: 0.98rem;
  line-height: 1.7;
  color: #e5e7eb;
  max-width: 34rem;
}

.hero-badges,
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.hero-badge {
  font-size: 0.75rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(185, 154, 197, 0.6);
  background: rgba(17, 24, 39, 0.9);
  color: #e5e7eb;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.6rem 1.35rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast),
    transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-purple), var(--btn-end));
  color: #f9fafb;
  box-shadow: 0 12px 35px rgba(15, 23, 42, 0.7);
}

.btn-ghost {
  background: transparent;
  color: #e5e7eb;
  border-color: rgba(148, 163, 184, 0.6);
}

.section {
  padding: 1rem 0 2.5rem;
}

.section-title {
  font-size: 1.15rem;
  color: #f9fafb;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.section-subtitle {
  font-size: 0.9rem;
  color: #cbd5f5;
  max-width: 30rem;
}

.section-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.card {
  border-radius: var(--radius-md);
  background: radial-gradient(
    circle at top left,
    rgba(185, 154, 197, 0.16),
    #020617
  );
  border: 1px solid rgba(148, 163, 184, 0.6);
  padding: 1rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.8);
}

/* ========== PANELS & LAYOUTS ========== */

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.6fr);
  gap: 2rem;
}

.panel {
  background: radial-gradient(
    circle at top left,
    rgba(185, 154, 197, 0.16),
    #020617
  );
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.6);
  padding: 1.5rem;
  box-shadow: var(--shadow-soft);
  color: #e5e7eb;
}

/* ========== TOOL FORM (IRIS MOCKUP) ========== */

.tool-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tool-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}

.tool-form label {
  font-size: 0.85rem;
  color: #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.tool-form input,
.tool-form textarea,
.tool-form select {
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  padding: 0.45rem 0.6rem;
  background: rgba(15, 23, 42, 0.9);
  color: #f9fafb;
  font-size: 0.85rem;
}

.tool-output {
  width: 100%;
  resize: vertical;
}

/* ========== RPG IFRAME ========== */

.rpg-frame-wrapper {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.7);
  overflow: hidden;
  background: #020617;
  box-shadow: var(--shadow-soft);
}

.rpg-frame {
  width: 100%;
  min-height: 600px;
  border: none;
}

/* ========== FOOTER ========== */

.site-footer {
  border-top: 1px solid rgba(148, 163, 184, 0.7);
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.95), #020617);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.8rem;
  color: #9ca3af;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer-links a {
  color: #cbd5f5;
  text-decoration: none;
}

/* ========== RESPONSIVE ========== */

@media (max-width: 900px) {
  .hero-grid,
  .split,
  .card-grid {
    grid-template-columns: 1fr;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .nav {
    position: absolute;
    inset-inline: 0;
    top: 100%;
    padding: 0.75rem 1.5rem 1rem;
    background: rgba(5, 5, 15, 0.98);
    border-bottom: 1px solid rgba(185, 154, 197, 0.5);
    display: none;
  }

  .nav.open {
    display: flex;
  }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    background: transparent;
  }

  .tool-form-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Projects page ===== */
[data-page="projects"] .card-embed {
  margin-top: 1rem;
  position: relative;
  padding-bottom: 60%; /* controls height / aspect ratio */
  height: 0;
  overflow: hidden;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

[data-page="projects"] .card-embed-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

[data-page="projects"] .section-title {
  color: var(--soft-purple);
}

/* ===== Resume page ===== */
[data-page="resume"] .resume-actions a {
  color: var(--soft-purple);
}

/* ===== RPG demo page ===== */
/* src/app/pages/rpg-demo/rpg-demo.component.css */
.rpg-demo {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

.rpg-demo__header h1 {
  margin-bottom: 0.5rem;
}

.rpg-demo__header p {
  max-width: 700px;
  margin-bottom: 1rem;
}

.rpg-demo__open-link {
  color: #cbd5e1;
  display: inline-block;
  margin-bottom: 1rem;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid #b99ac5;
  font-weight: 500;
}

.rpg-demo__frame-wrapper {
  position: relative;
  padding-bottom: 65%; /* aspect ratio */
  height: 0;
  overflow: hidden;
  border-radius: 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.rpg-demo__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.rpg-demo__notice {
  padding: 1rem 1.25rem;
  border: 1px solid #b99ac5;
  border-radius: 0.75rem;
}

/* Headings and <main> receive focus from script after navigation. They are not
   interactive, so no focus ring is drawn on them. */
h1[tabindex="-1"]:focus,
h2[tabindex="-1"]:focus,
main[tabindex="-1"]:focus {
  outline: none;
}
