/* ==========================================================================
   Richard Ehresman — Personal Website
   Design system: charcoal + teal, warm neutral paper, serif display + sans body
   ========================================================================== */

:root {
  /* ---- Brand palette — EDIT ME to re-theme the whole site ---- */
  --ink: #12181f;
  --ink-soft: #1c242e;
  --ink-elevated: #232c37;
  --paper: #ffffff;
  --cream: #f7f5f1;
  --cream-dim: #efece5;
  --gray-600: #5b6670;
  --gray-500: #7a8792;
  --line: #e4e1da;
  --line-dark: rgba(247, 245, 241, 0.14);

  --teal-400: #2dd4bf;
  --teal-500: #14b8a6;
  --teal-600: #0d9488;
  --teal-700: #0b7c72;
  --teal-contrast: #f7fffd;

  --gold: #cda15a;

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --shadow-sm: 0 2px 8px rgba(18, 24, 31, 0.06);
  --shadow-md: 0 12px 32px rgba(18, 24, 31, 0.12);
  --shadow-lg: 0 24px 60px rgba(18, 24, 31, 0.22);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 28px;

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

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

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

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

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

button {
  font: inherit;
  cursor: pointer;
}

section {
  scroll-margin-top: var(--header-h);
}

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

.container {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: 24px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal-600);
}

.eyebrow::before {
  content: '';
  width: 28px;
  height: 2px;
  background: var(--teal-500);
  display: inline-block;
}

.section-head {
  max-width: 640px;
  margin-bottom: 56px;
}

.section-head.center {
  margin-inline: auto;
  text-align: center;
}

.section-title {
  font-size: clamp(1.9rem, 3.6vw, 2.6rem);
  margin-top: 14px;
  color: var(--ink);
}

.section-title.on-dark {
  color: var(--paper);
}

.section-sub {
  margin-top: 16px;
  color: var(--gray-600);
  font-size: 1.05rem;
}

.section-sub.on-dark {
  color: rgba(247, 245, 241, 0.72);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 30px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.98rem;
  border: 1px solid transparent;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), background 0.35s var(--ease), color 0.35s var(--ease);
  white-space: nowrap;
}

.btn-primary {
  background: var(--teal-500);
  color: var(--teal-contrast);
  box-shadow: 0 10px 30px rgba(20, 184, 166, 0.35);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(20, 184, 166, 0.45);
  background: var(--teal-600);
}

.btn-ghost {
  background: transparent;
  border-color: rgba(247, 245, 241, 0.35);
  color: var(--paper);
}

.btn-ghost:hover {
  background: rgba(247, 245, 241, 0.1);
  border-color: rgba(247, 245, 241, 0.6);
  transform: translateY(-3px);
}

.btn-dark {
  background: var(--ink);
  color: var(--paper);
}

.btn-dark:hover {
  background: var(--teal-600);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

/* ==========================================================================
   Header / Nav
   ========================================================================== */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  transition: background 0.4s var(--ease), box-shadow 0.4s var(--ease), backdrop-filter 0.4s var(--ease);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header.is-scrolled {
  background: rgba(18, 24, 31, 0.85);
  backdrop-filter: blur(14px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--paper);
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal-400), var(--teal-700));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--teal-contrast);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.nav-desktop {
  display: none;
}

.nav-desktop ul {
  display: flex;
  gap: 8px;
}

.nav-desktop a {
  position: relative;
  padding: 10px 16px;
  font-size: 0.94rem;
  font-weight: 500;
  color: rgba(247, 245, 241, 0.86);
  transition: color 0.25s var(--ease);
}

.nav-desktop a::after {
  content: '';
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 4px;
  height: 2px;
  background: var(--teal-400);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}

.nav-desktop a:hover,
.nav-desktop a.is-active {
  color: var(--paper);
}

.nav-desktop a:hover::after,
.nav-desktop a.is-active::after {
  transform: scaleX(1);
}

.nav-cta {
  display: none;
}

.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(247, 245, 241, 0.1);
  border-radius: 50%;
  flex-shrink: 0;
}

.nav-toggle span {
  width: 18px;
  height: 2px;
  background: var(--paper);
  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);
}

.nav-mobile {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  background: rgba(18, 24, 31, 0.98);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-16px);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease), visibility 0.35s;
  z-index: 90;
}

.nav-mobile.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-mobile a {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--paper);
  padding: 14px 0;
}

.nav-mobile .btn {
  margin-top: 20px;
}

@media (min-width: 900px) {
  .nav-desktop {
    display: block;
  }

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

  .nav-toggle {
    display: none;
  }
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  color: var(--paper);
  overflow: hidden;
  background: var(--ink);
}

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

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.hero-media::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(18, 24, 31, 0.94) 20%, rgba(18, 24, 31, 0.72) 55%, rgba(13, 148, 136, 0.35) 100%);
}

.hero-inner {
  position: relative;
  z-index: 1;
  padding-top: var(--header-h);
  max-width: 720px;
}

.hero-inner .eyebrow {
  color: var(--teal-400);
}

.hero-inner .eyebrow::before {
  background: var(--teal-400);
}

.hero-name {
  margin-top: 22px;
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  letter-spacing: -0.01em;
}

.hero-role {
  margin-top: 14px;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  color: var(--teal-400);
  font-weight: 500;
}

.hero-intro {
  margin-top: 24px;
  font-size: 1.12rem;
  color: rgba(247, 245, 241, 0.82);
  max-width: 560px;
}

.hero-actions {
  margin-top: 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.hero-scroll {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: rgba(247, 245, 241, 0.6);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-scroll .scroll-line {
  width: 1px;
  height: 40px;
  background: rgba(247, 245, 241, 0.35);
  overflow: hidden;
  position: relative;
}

.hero-scroll .scroll-line::after {
  content: '';
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--teal-400);
  animation: scrollDrip 2.2s ease-in-out infinite;
}

@keyframes scrollDrip {
  0% { top: -100%; }
  60% { top: 100%; }
  100% { top: 100%; }
}

/* ==========================================================================
   Reveal-on-scroll animation
   ========================================================================== */

[data-animate] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}

[data-animate].is-visible {
  opacity: 1;
  transform: translateY(0);
}

[data-animate-delay="1"] { transition-delay: 0.1s; }
[data-animate-delay="2"] { transition-delay: 0.2s; }
[data-animate-delay="3"] { transition-delay: 0.3s; }
[data-animate-delay="4"] { transition-delay: 0.4s; }
[data-animate-delay="5"] { transition-delay: 0.5s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-animate] {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .hero-scroll .scroll-line::after { animation: none; }
}

/* ==========================================================================
   About
   ========================================================================== */

.about {
  background: var(--cream);
  padding: 120px 0;
}

.about-grid {
  display: grid;
  gap: 56px;
  align-items: center;
}

.about-portrait {
  display: flex;
  justify-content: center;
}

.avatar-badge {
  position: relative;
  width: min(320px, 80vw);
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(150deg, var(--teal-400), var(--ink) 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
}

.avatar-badge::before {
  content: '';
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  border: 1px dashed rgba(247, 245, 241, 0.4);
}

.avatar-badge span {
  font-family: var(--font-display);
  font-size: 5rem;
  color: var(--paper);
  font-weight: 600;
}

.about-copy p {
  color: var(--gray-600);
  margin: 0 0 18px;
  font-size: 1.05rem;
}

.about-stats {
  margin-top: 36px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.stat {
  padding: 18px 6px;
  text-align: center;
  background: var(--paper);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.7rem;
  color: var(--teal-600);
}

.stat span {
  font-size: 0.82rem;
  color: var(--gray-500);
}

@media (min-width: 860px) {
  .about-grid {
    grid-template-columns: 0.85fr 1.15fr;
  }
}

/* ==========================================================================
   Services
   ========================================================================== */

.services {
  padding: 120px 0;
  background: var(--paper);
}

.services-grid {
  display: grid;
  gap: 28px;
  grid-template-columns: 1fr;
}

.service-card {
  position: relative;
  padding: 40px 32px;
  border-radius: var(--radius-md);
  background: var(--cream);
  border: 1px solid var(--line);
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease), background 0.4s var(--ease);
  overflow: hidden;
}

.service-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--teal-400), var(--teal-700));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease);
}

.service-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-md);
  background: var(--paper);
}

.service-card:hover::before {
  transform: scaleX(1);
}

.service-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--ink);
  color: var(--teal-400);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  transition: background 0.4s var(--ease), transform 0.4s var(--ease);
}

.service-card:hover .service-icon {
  background: var(--teal-600);
  color: var(--paper);
  transform: scale(1.08) rotate(-4deg);
}

.service-card h3 {
  font-size: 1.25rem;
  margin-bottom: 12px;
  color: var(--ink);
}

.service-card p {
  color: var(--gray-600);
  margin: 0;
  font-size: 0.98rem;
}

@media (min-width: 640px) {
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .services-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ==========================================================================
   Gallery
   ========================================================================== */

.gallery {
  padding: 120px 0;
  background: var(--ink);
}

.gallery-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, 1fr);
}

.gallery-item {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  cursor: pointer;
  border: none;
  padding: 0;
  background: var(--ink-soft);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}

.gallery-item:hover img {
  transform: scale(1.08);
}

.gallery-caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 20px 18px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.78));
  color: var(--paper);
  font-weight: 600;
  font-size: 0.95rem;
  text-align: left;
  transform: translateY(10px);
  opacity: 0;
  transition: transform 0.4s var(--ease), opacity 0.4s var(--ease);
}

.gallery-item:hover .gallery-caption {
  transform: translateY(0);
  opacity: 1;
}

.gallery-item:nth-child(1),
.gallery-item:nth-child(4) {
  grid-column: span 1;
}

@media (min-width: 640px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .gallery-item:first-child {
    grid-column: span 2;
    grid-row: span 2;
    aspect-ratio: auto;
  }
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 13, 17, 0.92);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s var(--ease), visibility 0.35s;
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox img {
  max-width: min(90vw, 1100px);
  max-height: 82vh;
  width: auto;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(247, 245, 241, 0.3);
  background: rgba(247, 245, 241, 0.08);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-close:hover {
  background: var(--teal-600);
  border-color: var(--teal-600);
}

/* ==========================================================================
   Contact
   ========================================================================== */

.contact {
  padding: 120px 0;
  background: var(--cream);
}

.contact-grid {
  display: grid;
  gap: 40px;
}

.contact-form-card {
  background: var(--paper);
  border-radius: var(--radius-md);
  padding: 40px;
  box-shadow: var(--shadow-md);
}

.form-row {
  display: grid;
  gap: 20px;
  margin-bottom: 20px;
}

@media (min-width: 560px) {
  .form-row.two-col {
    grid-template-columns: 1fr 1fr;
  }
}

.field label {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--ink);
}

.field input,
.field textarea {
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--cream);
  font-family: var(--font-body);
  font-size: 0.98rem;
  color: var(--ink);
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease);
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--teal-500);
  background: var(--paper);
  box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.15);
}

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

.form-note {
  margin-top: 16px;
  font-size: 0.84rem;
  color: var(--gray-500);
}

.form-success {
  display: none;
  align-items: center;
  gap: 14px;
  padding: 20px;
  border-radius: var(--radius-sm);
  background: rgba(20, 184, 166, 0.12);
  color: var(--teal-700);
  font-weight: 600;
}

.form-success.is-visible {
  display: flex;
}

.contact-form.is-hidden {
  display: none;
}

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

.info-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 24px;
  background: var(--paper);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.info-icon {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--ink);
  color: var(--teal-400);
  display: flex;
  align-items: center;
  justify-content: center;
}

.info-card h4 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.info-card a,
.info-card p {
  color: var(--gray-600);
  margin: 0;
  font-size: 0.96rem;
}

.info-card a:hover {
  color: var(--teal-600);
}

.social-row {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.social-link {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s var(--ease), background 0.3s var(--ease);
}

.social-link:hover {
  background: var(--teal-600);
  transform: translateY(-4px);
}

@media (min-width: 900px) {
  .contact-grid {
    grid-template-columns: 1.3fr 1fr;
  }
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  background: var(--ink);
  color: rgba(247, 245, 241, 0.72);
  padding: 64px 0 32px;
}

.footer-top {
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--line-dark);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--paper);
  font-family: var(--font-display);
  font-size: 1.2rem;
}

.footer-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-nav a:hover {
  color: var(--teal-400);
}

.footer-bottom {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  text-align: center;
  padding-top: 28px;
  font-size: 0.86rem;
}

.back-to-top {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(247, 245, 241, 0.08);
  border: 1px solid rgba(247, 245, 241, 0.2);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s var(--ease), transform 0.3s var(--ease);
}

.back-to-top:hover {
  background: var(--teal-600);
  transform: translateY(-3px);
}

@media (min-width: 760px) {
  .footer-top {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .footer-bottom {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}
