@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=Inter:wght@400;600&display=swap');

:root {
  /* Colors */
  --color-bg-primary: #0A0A0F;
  --color-bg-secondary: #12121A;
  --color-surface: #1A1A24;
  --color-surface-raised: #242430;
  --color-text-primary: #F5F5F7;
  --color-text-secondary: #B0B0C0;
  --color-text-inverse: #0A0A0F;
  --color-accent: #7B2FBE;
  --color-accent-hover: #9B4DDF;
  --color-accent-soft: #2A1A3A;
  --color-border: #2E2E3A;
  --color-success: #4CAF50;
  --color-warning: #FFC107;
  --color-error: #F44336;

  /* Typography */
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;

  /* Type Scale */
  --text-display-size: 48px;
  --text-display-line: 1.1;
  --text-display-weight: 700;
  --text-h1-size: 36px;
  --text-h1-line: 1.2;
  --text-h1-weight: 700;
  --text-h2-size: 28px;
  --text-h2-line: 1.3;
  --text-h2-weight: 600;
  --text-h3-size: 22px;
  --text-h3-line: 1.4;
  --text-h3-weight: 600;
  --text-body-large-size: 18px;
  --text-body-large-line: 1.6;
  --text-body-large-weight: 400;
  --text-body-size: 16px;
  --text-body-line: 1.6;
  --text-body-weight: 400;
  --text-small-size: 14px;
  --text-small-line: 1.5;
  --text-small-weight: 400;
  --text-caption-size: 12px;
  --text-caption-line: 1.4;
  --text-caption-weight: 400;

  /* Spacing Scale */
  --space-4: 4px;
  --space-8: 8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-24: 24px;
  --space-32: 32px;
  --space-48: 48px;
  --space-64: 64px;
  --space-96: 96px;
  --space-128: 128px;

  /* Containers */
  --container-max: 1200px;
  --container-padding-desktop: 48px;
  --container-padding-mobile: 24px;
  --section-padding-desktop: 96px;
  --section-padding-tablet: 64px;
  --section-padding-mobile: 48px;
  --card-padding-desktop: 24px;
  --card-padding-mobile: 16px;
  --gutter-desktop: 24px;
  --gutter-mobile: 16px;

  /* Surfaces */
  --shadow-raised: 0 2px 8px rgba(0, 0, 0, 0.3);
  --glow-accent: 0 0 20px rgba(123, 47, 190, 0.2);

  /* Corners */
  --radius-small: 4px;
  --radius-medium: 8px;
  --radius-large: 16px;
  --radius-pill: 999px;

  /* Transitions */
  --transition-fast: 0.2s ease-in-out;
}

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

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-body-size);
  font-weight: var(--text-body-weight);
  line-height: var(--text-body-line);
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

img {
  object-fit: cover;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

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

ul,
ol {
  list-style: none !important;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  letter-spacing: 0.01em;
  overflow-wrap: break-word;
}

h1 {
  font-size: clamp(28px, 5vw, var(--text-h1-size));
  font-weight: var(--text-h1-weight);
  line-height: var(--text-h1-line);
  margin-block-end: var(--space-24);
}

h2 {
  font-size: clamp(24px, 4vw, var(--text-h2-size));
  font-weight: var(--text-h2-weight);
  line-height: var(--text-h2-line);
  margin-block-end: var(--space-16);
}

h3 {
  font-size: clamp(20px, 3vw, var(--text-h3-size));
  font-weight: var(--text-h3-weight);
  line-height: var(--text-h3-line);
  margin-block-end: var(--space-12);
}

.display {
  font-family: var(--font-heading);
  font-size: clamp(32px, 6vw, var(--text-display-size));
  font-weight: var(--text-display-weight);
  line-height: var(--text-display-line);
  letter-spacing: 0.02em;
  margin-block-end: var(--space-32);
}

p {
  font-size: var(--text-body-size);
  font-weight: var(--text-body-weight);
  line-height: var(--text-body-line);
  margin-block-end: var(--space-16);
}

p:last-child {
  margin-block-end: 0;
}

blockquote {
  margin-block-end: var(--space-24);
  padding-inline-start: var(--space-16);
  border-inline-start: 3px solid var(--color-accent);
  color: var(--color-text-secondary);
}

blockquote:last-child {
  margin-block-end: 0;
}

.text-large {
  font-size: var(--text-body-large-size);
  font-weight: var(--text-body-large-weight);
  line-height: var(--text-body-large-line);
}

.text-small {
  font-size: var(--text-small-size);
  font-weight: var(--text-small-weight);
  line-height: var(--text-small-line);
}

.text-caption {
  font-size: var(--text-caption-size);
  font-weight: var(--text-caption-weight);
  line-height: var(--text-caption-line);
}

strong, b {
  font-weight: 600;
}

/* Content list spacing scoped to prose-like contexts */
.content-list,
article ul,
article ol {
  margin-block-end: var(--space-16);
  padding-inline-start: var(--space-24);
}

.content-list:last-child,
article ul:last-child,
article ol:last-child {
  margin-block-end: 0;
}

.content-list li,
article ul li,
article ol li {
  margin-block-end: var(--space-8);
}

.content-list li:last-child,
article ul li:last-child,
article ol li:last-child {
  margin-block-end: 0;
}

/* Forms */
label {
  display: block;
  font-size: var(--text-small-size);
  font-weight: 600;
  margin-block-end: var(--space-8);
  color: var(--color-text-secondary);
}

input,
textarea,
select {
  width: 100%;
  padding: var(--space-12) var(--space-16);
  background-color: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  color: var(--color-text-primary);
  font-size: var(--text-body-size);
  line-height: var(--text-body-line);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(123, 47, 190, 0.15);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-text-secondary);
  opacity: 0.7;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  padding: var(--space-12) var(--space-24);
  font-family: var(--font-body);
  font-size: var(--text-body-size);
  font-weight: 600;
  line-height: 1.2;
  border-radius: var(--radius-pill);
  background-color: var(--color-accent);
  color: #FFFFFF;
  transition: background-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
  white-space: nowrap;
  min-height: 44px;
  cursor: pointer;
  border: none;
  text-align: center;
}

.btn:hover {
  background-color: var(--color-accent-hover);
  transform: scale(1.02);
}

.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--color-accent);
  color: var(--color-accent);
}

.btn-outline:hover {
  background-color: var(--color-accent-soft);
  color: var(--color-accent-hover);
}

.btn-ghost {
  background-color: transparent;
  color: var(--color-text-primary);
}

.btn-ghost:hover {
  background-color: var(--color-surface-raised);
}

/* Containers */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-padding-mobile);
}

@media (min-width: 768px) {
  .container {
    padding-inline: var(--container-padding-desktop);
  }
}

/* Section spacing */
.section {
  padding-block: var(--section-padding-mobile);
}

@media (min-width: 768px) {
  .section {
    padding-block: var(--section-padding-tablet);
  }
}

@media (min-width: 1024px) {
  .section {
    padding-block: var(--section-padding-desktop);
  }
}

/* Surfaces */
.surface {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-medium);
  padding: var(--card-padding-mobile);
}

@media (min-width: 768px) {
  .surface {
    padding: var(--card-padding-desktop);
  }
}

.surface-raised {
  background-color: var(--color-surface-raised);
  box-shadow: var(--shadow-raised);
}

/* Flex utilities */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

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

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-end {
  justify-content: flex-end;
}

.gap-8 { gap: var(--space-8); }
.gap-12 { gap: var(--space-12); }
.gap-16 { gap: var(--space-16); }
.gap-24 { gap: var(--space-24); }
.gap-32 { gap: var(--space-32); }
.gap-48 { gap: var(--space-48); }

/* Self-contained grid primitive */
.grid-auto-fit {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: var(--gutter-mobile);
}

@media (min-width: 768px) {
  .grid-auto-fit {
    gap: var(--gutter-desktop);
  }
}

.grid-auto-fit > * {
  min-width: 0;
}

/* Dividers */
.divider {
  height: 1px;
  background: linear-gradient(to right, transparent, var(--color-accent), transparent);
  border: none;
  margin-block: var(--space-24);
}

/* Nav toggle base */
.nav-toggle {
  flex-direction: column;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--color-text-primary);
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Selection */
::selection {
  background-color: var(--color-accent);
  color: #FFFFFF;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--color-surface-raised);
  border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent);
}