/* =========================================
   Joe Davine — Portfolio & Blog
   Clean, editorial, premium.
   ========================================= */

:root {
  --color-bg: #FAFAF8;
  --color-surface: #FFFFFF;
  --color-text: #1A1A1A;
  --color-text-secondary: #6B6B6B;
  --color-accent: #2A2A2A;
  --color-border: #E8E8E4;
  --color-highlight: #D4FF2B;
  --font-serif: 'DM Serif Display', Georgia, serif;
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --max-width: 860px;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;
  --space-xl: 6rem;
  --space-2xl: 10rem;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-bg);
}

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

strong {
  font-weight: 700;
}

/* ---- Navigation ---- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2.5rem;
  background: rgba(250, 250, 248, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
  transition: all 0.3s ease;
}

.nav-logo {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.nav-links a {
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.nav-links a:hover {
  opacity: 1;
}

.nav-cta {
  opacity: 1 !important;
  padding: 0.5rem 1.25rem;
  background: var(--color-accent);
  color: var(--color-bg) !important;
  border-radius: 100px;
  font-weight: 500;
  transition: background 0.2s ease, transform 0.2s ease !important;
}

.nav-cta:hover {
  background: #000;
  transform: translateY(-1px);
}

/* ---- Hero ---- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: var(--space-xl) 2.5rem;
  padding-top: calc(var(--space-xl) + 60px);
  position: relative;
  overflow: hidden;
}

.hero-circuit {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  will-change: transform;
}

.circuit-group {
  opacity: 0.55;
}

.circuit-group line,
.circuit-group rect {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: drawLine 8s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

.circuit-group--1 line,
.circuit-group--1 rect { animation-delay: 0.1s; }

.circuit-group--2 line,
.circuit-group--2 rect { animation-delay: 1.4s; }

.circuit-group--3 line,
.circuit-group--3 rect { animation-delay: 2.6s; }

.circuit-group--4 line,
.circuit-group--4 rect { animation-delay: 0.6s; }

.circuit-group--5 line,
.circuit-group--5 rect { animation-delay: 1.9s; }

.circuit-group--6 line,
.circuit-group--6 rect { animation-delay: 0.9s; }

.circuit-group--7 line,
.circuit-group--7 rect { animation-delay: 2.1s; }

@keyframes drawLine {
  0% {
    stroke-dashoffset: 1000;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

.hero-inner {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
}

.hero-label {
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-md);
  position: relative;
}

.hero-title .highlight {
  display: inline;
  background-image: linear-gradient(120deg, var(--color-highlight) 0%, var(--color-highlight) 100%);
  background-repeat: no-repeat;
  background-size: 0% 0.35em;
  background-position: 0 88%;
  animation: highlightSweep 1.6s cubic-bezier(0.25, 0.1, 0.25, 1) 1.2s forwards;
}

@keyframes highlightSweep {
  to {
    background-size: 100% 0.35em;
  }
}

.hero-sub {
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--color-text-secondary);
  max-width: 600px;
  margin-bottom: var(--space-md);
}

.hero-sub strong {
  color: var(--color-text);
}

.hero-sub a {
  border-bottom: 1.5px solid var(--color-highlight);
  transition: border-color 0.2s ease;
}

.hero-sub a:hover {
  border-color: var(--color-text);
}

.hero-title-sub {
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-top: 0.3em;
  margin-bottom: var(--space-md);
  position: relative;
}

.hero-scroll {
  margin-top: var(--space-lg);
  color: var(--color-text-secondary);
  opacity: 0.4;
  animation: scrollBounce 2.5s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
}

@keyframes scrollBounce {
  0%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  50% {
    transform: translateY(8px);
    opacity: 0.15;
  }
}

.hero-mantra {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-style: italic;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
}


/* ---- Sections (shared) ---- */
.section {
  padding: var(--space-2xl) 2.5rem;
}

.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-label {
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-sm);
}

.section-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-sm);
}

.section-intro {
  font-size: 1.05rem;
  color: var(--color-text-secondary);
  max-width: 520px;
  margin-bottom: var(--space-lg);
}

/* ---- Writing / Blog ---- */
.writing {
  border-top: 1px solid var(--color-border);
}

.posts {
  display: flex;
  flex-direction: column;
}

.post {
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--color-border);
  transition: all 0.2s ease;
}

.post:first-child {
  border-top: 1px solid var(--color-border);
}

.post:hover {
  padding-left: 1rem;
}

.post-date {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.post-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  margin: 0.5rem 0;
  line-height: 1.3;
}

.post-title a {
  transition: opacity 0.2s ease;
}

.post-title a:hover {
  opacity: 0.6;
}

.post-excerpt {
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  max-width: 560px;
}

/* ---- Career / Timeline ---- */
.career {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-item {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: var(--space-md);
  padding: var(--space-md) 1.25rem;
  margin: 0 -1.25rem;
  border-bottom: 1px solid var(--color-border);
  border-radius: 8px;
  transition: transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1), box-shadow 0.3s cubic-bezier(0.25, 0.1, 0.25, 1), background 0.3s ease;
}

.timeline-item:hover {
  transform: translateY(-4px);
  background: var(--color-bg);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
  border-bottom-color: transparent;
}

.timeline-item:first-child {
  border-top: 1px solid var(--color-border);
}

.timeline-period {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.timeline-content h3 {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  letter-spacing: -0.01em;
  margin-bottom: 0.25rem;
}

.timeline-outcome {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-highlight);
  padding: 0.15rem 0.6rem;
  border-radius: 100px;
  white-space: nowrap;
  vertical-align: middle;
}

.timeline-role {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 0.5rem;
}

.timeline-content p:last-child {
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.timeline-content a {
  border-bottom: 1px solid var(--color-border);
  transition: border-color 0.2s ease;
}

.timeline-content a:hover {
  border-color: var(--color-text);
}

/* ---- Side Projects ---- */
.projects {
  border-top: 1px solid var(--color-border);
}

.projects-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.project-card {
  padding: 1.75rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  transition: border-color 0.2s ease;
}

.project-card:hover {
  border-color: var(--color-accent);
}

.project-status {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  margin-bottom: 0.75rem;
}

.project-status--active {
  background: var(--color-highlight);
  color: var(--color-text);
}

.project-status--past {
  background: var(--color-border);
  color: var(--color-text-secondary);
}

.project-card h3 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  margin-bottom: 0.25rem;
}

.project-card h3 a {
  border-bottom: 1px solid var(--color-border);
  transition: border-color 0.2s ease;
}

.project-card h3 a:hover {
  border-color: var(--color-text);
}

.project-role {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 0.5rem;
}

.project-card p:last-child {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.project-card p:last-child a {
  border-bottom: 1px solid var(--color-border);
  transition: border-color 0.2s ease;
}

.project-card p:last-child a:hover {
  border-color: var(--color-text);
}

/* ---- Contact + Footer ---- */
.contact-footer {
  background: var(--color-highlight);
  color: var(--color-text);
  padding: var(--space-2xl) 2.5rem var(--space-md);
}

.contact-footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.contact-label {
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(26, 26, 26, 0.5);
  margin-bottom: var(--space-sm);
}

.contact-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-sm);
}

.contact-text {
  font-size: 1.1rem;
  color: rgba(26, 26, 26, 0.7);
  max-width: 520px;
  margin-bottom: var(--space-md);
}

.contact-links {
  display: flex;
  gap: 1.5rem;
}

.contact-links a {
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.6rem 1.5rem;
  border: 1.5px solid var(--color-text);
  border-radius: 100px;
  transition: all 0.2s ease;
}

.contact-links a:hover {
  background: var(--color-text);
  color: var(--color-highlight);
}

.footer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid rgba(26, 26, 26, 0.15);
  font-size: 0.8rem;
  color: rgba(26, 26, 26, 0.4);
}

.footer-bar a {
  color: rgba(26, 26, 26, 0.4);
  border-bottom: 1px solid rgba(26, 26, 26, 0.15);
  transition: all 0.2s ease;
}

.footer-bar a:hover {
  color: var(--color-text);
  border-color: var(--color-text);
}

/* ---- Animations ---- */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 1s cubic-bezier(0.25, 0.1, 0.25, 1), transform 1s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .nav {
    padding: 1rem 1.5rem;
  }

  .nav-links {
    gap: 1rem;
    font-size: 0.85rem;
  }

  .hero,
  .section {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .hero {
    min-height: auto;
    padding-top: calc(var(--space-lg) + 60px);
    padding-bottom: var(--space-lg);
  }

  .hero-circuit {
    opacity: 0.3;
  }

  .section {
    padding-top: var(--space-xl);
    padding-bottom: var(--space-xl);
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 0.25rem;
    padding: var(--space-md) 1rem;
    margin: 0 -1rem;
  }

  .timeline-outcome {
    display: block;
    margin-top: 0.35rem;
    width: fit-content;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .contact-footer {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .contact-links {
    flex-direction: column;
    gap: 0.75rem;
  }

  .contact-links a {
    text-align: center;
  }

  .footer-bar {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  .post:hover {
    padding-left: 0;
  }
}

@media (max-width: 480px) {
  .nav-links a:not(.nav-cta) {
    display: none;
  }

  .nav-cta {
    font-size: 0.85rem;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-title-sub {
    font-size: 2rem;
  }

  .hero-sub {
    font-size: 1rem;
  }

  .hero-mantra {
    font-size: 1rem;
  }

  .section-title {
    font-size: 1.75rem;
  }

  .post-title {
    font-size: 1.25rem;
  }

  .timeline-content h3 {
    font-size: 1.1rem;
  }

  .project-card {
    padding: 1.25rem;
  }

  .contact-footer {
    padding-top: var(--space-xl);
  }
}

/* ---- Post Page ---- */
.post-page {
  padding: calc(var(--space-xl) + 60px) 2.5rem var(--space-2xl);
}

.post-page-inner {
  max-width: 680px;
  margin: 0 auto;
}

.post-back {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: color 0.2s ease;
  margin-bottom: var(--space-lg);
}

.post-back:hover {
  color: var(--color-text);
}

.post-header {
  margin-bottom: var(--space-lg);
}

.post-page-date {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-sm);
}

.post-page-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-sm);
}

.post-reading-time {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.post-body {
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--color-text);
}

.post-body p {
  margin-bottom: 1.5rem;
}

.post-body h2 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

.post-body strong {
  color: var(--color-text);
}

.post-body a {
  border-bottom: 1.5px solid var(--color-highlight);
  transition: border-color 0.2s ease;
}

.post-body a:hover {
  border-color: var(--color-text);
}

.post-footer {
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
}

@media (max-width: 768px) {
  .post-page {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (max-width: 480px) {
  .post-page-title {
    font-size: 1.75rem;
  }

  .post-body {
    font-size: 1rem;
  }
}

/* ---- Selection ---- */
::selection {
  background: var(--color-highlight);
  color: var(--color-text);
}
