/* ========================================
   Damien Sullins — Premium Portfolio
   Dark · Minimal · Cinematic
======================================== */

:root {
  --bg: #050505;
  --bg-elevated: #0a0a0a;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  --text: #f5f5f5;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;
  --accent: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.35);
  --accent-soft: rgba(99, 102, 241, 0.12);
  --white: #ffffff;
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-serif: "Playfair Display", Georgia, serif;
  --radius: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --nav-h: 72px;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

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

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

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

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

button, input, textarea {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
}

/* ---------- Grain Overlay ---------- */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 180px;
}

/* ---------- Cursor Glow ---------- */
.cursor-glow {
  position: fixed;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity 0.4s ease;
  mix-blend-mode: screen;
}

body:hover .cursor-glow {
  opacity: 0.4;
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 120px 0;
  position: relative;
}

.section-header {
  margin-bottom: 64px;
}

.section-label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}

.section-title {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--white);
}

.section-desc {
  margin-top: 16px;
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 480px;
}

/* ---------- Navigation ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-h);
  transition: background 0.4s var(--ease), border-color 0.4s, backdrop-filter 0.4s;
  border-bottom: 1px solid transparent;
}

.nav.scrolled {
  background: rgba(5, 5, 5, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom-color: var(--border);
}

.nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--white);
  transition: opacity 0.2s;
}

.nav-logo:hover {
  opacity: 0.7;
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-links a {
  font-size: 0.875rem;
  font-weight: 450;
  color: var(--text-muted);
  transition: color 0.2s;
  position: relative;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s var(--ease);
}

.nav-links a:hover {
  color: var(--white);
}

.nav-links a:hover::after {
  width: 100%;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 6px;
  width: 28px;
  cursor: pointer;
  padding: 4px 0;
}

.nav-toggle span {
  display: block;
  height: 1.5px;
  background: var(--white);
  border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.3s;
}

.nav-toggle[aria-expanded="true"] span:first-child {
  transform: translateY(3.75px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:last-child {
  transform: translateY(-3.75px) rotate(-45deg);
}

/* Mobile Menu */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(5, 5, 5, 0.97);
  backdrop-filter: blur(24px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s var(--ease), visibility 0.4s;
}

.mobile-menu.open {
  opacity: 1;
  visibility: visible;
}

.mobile-menu nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.mobile-menu a {
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s;
}

.mobile-menu a:hover {
  color: var(--white);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent);
  color: var(--white);
  box-shadow: 0 0 0 0 var(--accent-glow);
}

.btn-primary:hover {
  background: #818cf8;
  box-shadow: 0 0 32px var(--accent-glow);
  transform: translateY(-1px);
}

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

.btn-ghost:hover {
  border-color: var(--border-hover);
  background: var(--bg-glass);
}

.btn-sm {
  padding: 10px 20px;
  font-size: 0.8125rem;
}

.btn-full {
  width: 100%;
}

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  padding: calc(var(--nav-h) + 40px) 24px 80px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-gradient {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.18), transparent),
    radial-gradient(ellipse 60% 40% at 80% 60%, rgba(139, 92, 246, 0.08), transparent);
}

.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  animation: float 12s ease-in-out infinite;
}

.hero-orb-1 {
  width: 500px;
  height: 500px;
  background: var(--accent);
  top: -10%;
  left: -10%;
  opacity: 0.12;
}

.hero-orb-2 {
  width: 400px;
  height: 400px;
  background: #8b5cf6;
  bottom: 10%;
  right: -5%;
  opacity: 0.1;
  animation-delay: -4s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(30px, -20px); }
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 780px;
}

.hero-eyebrow {
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 24px;
}

.hero-title {
  font-size: clamp(3.5rem, 12vw, 7rem);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.04em;
  color: var(--white);
  margin-bottom: 20px;
}

.hero-title .line {
  display: block;
}

.hero-sub {
  font-size: clamp(0.9375rem, 2vw, 1.125rem);
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  margin-bottom: 28px;
}

.hero-text {
  font-size: 1.0625rem;
  color: var(--text-dim);
  max-width: 540px;
  margin: 0 auto 40px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
}

.scroll-indicator {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-dim);
  font-size: 0.6875rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.scroll-line {
  width: 1px;
  height: 48px;
  background: linear-gradient(to bottom, var(--text-dim), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0.4; transform: scaleY(1); }
  50% { opacity: 1; transform: scaleY(1.1); }
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 64px;
  align-items: start;
}

.about-text p {
  font-size: 1.0625rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.75;
}

.about-text p:last-child {
  margin-bottom: 0;
}

.about-stats {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  transition: border-color 0.3s, background 0.3s;
}

.stat-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-glass);
}

.stat-number {
  display: block;
  font-size: 2.75rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--white);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-dim);
}

/* ---------- Projects ---------- */
.projects {
  display: flex;
  flex-direction: column;
  gap: 96px;
}

.project-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}

.project-card-reverse {
  direction: rtl;
}

.project-card-reverse > * {
  direction: ltr;
}

.project-visual {
  position: relative;
}

.project-img-placeholder {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.04) 0%, transparent 50%),
    linear-gradient(to bottom right, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: transform 0.5s var(--ease), border-color 0.3s;
}

.project-card:hover .project-img-placeholder {
  transform: scale(1.02);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

.project-num {
  position: absolute;
  top: 24px;
  left: 24px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.project-icon {
  font-size: 4rem;
  opacity: 0.7;
  filter: grayscale(0.3);
}

.project-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.project-tag {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 12px;
  border-radius: 999px;
}

.project-year {
  font-size: 0.8125rem;
  color: var(--text-dim);
}

.project-title {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--white);
  margin-bottom: 4px;
}

.project-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.project-desc {
  font-size: 0.975rem;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 20px;
}

.project-focus {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.project-focus span {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 999px;
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------- Philosophy ---------- */
.philosophy {
  padding: 140px 0;
}

.philosophy-content {
  max-width: 820px;
  margin: 0 auto;
  text-align: center;
}

.philosophy-quote {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 400;
  font-style: italic;
  line-height: 1.35;
  color: var(--white);
  letter-spacing: -0.02em;
  margin-bottom: 36px;
}

.philosophy-text {
  font-size: 1.125rem;
  color: var(--text-muted);
  line-height: 1.8;
  max-width: 640px;
  margin: 0 auto;
}

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.skill-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px 16px;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.35s var(--ease);
  cursor: default;
}

.skill-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--white);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.12);
}

/* ---------- Timeline ---------- */
.timeline {
  position: relative;
  max-width: 640px;
  margin: 0 auto;
  padding-left: 32px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: linear-gradient(to bottom, var(--accent), var(--border));
}

.timeline-item {
  position: relative;
  padding-bottom: 48px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-marker {
  position: absolute;
  left: -32px;
  top: 6px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  transition: box-shadow 0.3s;
}

.timeline-item:hover .timeline-marker {
  box-shadow: 0 0 0 6px var(--accent-soft), 0 0 20px var(--accent-glow);
}

.timeline-year {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

.timeline-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.timeline-content p {
  font-size: 0.9375rem;
  color: var(--text-dim);
  line-height: 1.65;
}

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 64px;
  align-items: start;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-group input,
.form-group textarea {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  color: var(--white);
  transition: border-color 0.25s, box-shadow 0.25s;
  outline: none;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-dim);
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-group textarea {
  resize: vertical;
  min-height: 140px;
}

.form-note {
  font-size: 0.875rem;
  color: var(--text-muted);
  min-height: 1.5em;
}

.form-note.success {
  color: #34d399;
}

.form-note.error {
  color: #f87171;
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 36px;
  padding-top: 8px;
}

.contact-block h3,
.contact-social h3 {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.contact-block p,
.contact-block a {
  font-size: 1.0625rem;
  color: var(--text-muted);
  transition: color 0.2s;
}

.contact-block a:hover {
  color: var(--white);
}

.social-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.social-links a {
  font-size: 1.0625rem;
  color: var(--text-muted);
  transition: color 0.2s, transform 0.2s;
  display: inline-block;
}

.social-links a:hover {
  color: var(--accent);
  transform: translateX(4px);
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer-name {
  font-weight: 600;
  color: var(--white);
}

.footer-loc {
  font-size: 0.875rem;
  color: var(--text-dim);
}

.footer-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-size: 0.875rem;
  color: var(--text-dim);
}

.footer-tech {
  font-size: 0.8125rem;
}

/* ---------- Reveal Animations ---------- */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Project Pages ---------- */
.project-page {
  padding-top: calc(var(--nav-h) + 60px);
}

.project-hero {
  padding: 60px 0 80px;
  text-align: center;
}

.project-hero .project-tag {
  margin-bottom: 20px;
}

.project-hero h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--white);
  margin-bottom: 12px;
}

.project-hero .subtitle {
  font-size: 1.25rem;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.project-hero-visual {
  max-width: 900px;
  margin: 0 auto 48px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.04), transparent),
    linear-gradient(to bottom right, color-mix(in srgb, var(--accent, #6366f1) 20%, transparent), transparent);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
}

.project-content {
  max-width: 720px;
  margin: 0 auto;
  padding-bottom: 100px;
}

.project-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--white);
  margin: 48px 0 16px;
  letter-spacing: -0.02em;
}

.project-content p {
  font-size: 1.0625rem;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 16px;
}

.project-content ul {
  list-style: none;
  margin: 16px 0 24px;
}

.project-content li {
  position: relative;
  padding-left: 20px;
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.6;
}

.project-content li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.tech-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 24px;
}

.tech-list span {
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 999px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 32px;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--white);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .about-grid,
  .project-card,
  .project-card-reverse,
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .project-card-reverse {
    direction: ltr;
  }

  .about-stats {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .stat-card {
    flex: 1 1 140px;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .section {
    padding: 80px 0;
  }

  .hero-title {
    font-size: clamp(3rem, 14vw, 4.5rem);
  }

  .skills-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

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

@media (max-width: 480px) {
  .hero-actions {
    flex-direction: column;
    width: 100%;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .about-stats {
    flex-direction: column;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
