/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Outfit:wght@300;400;500;600&display=swap');

/* ── Custom Properties ─────────────────────────────────── */
:root {
  --bg-deep:        #0a0b0f;
  --bg-surface:     #12131a;
  --bg-card:        #181922;
  --bg-card-hover:  #1e2030;
  --text-primary:   #e8e6e1;
  --text-secondary: #8b8a85;
  --text-tertiary:  #5a5955;
  --accent:         #e8a84a;
  --accent-hover:   #f0bb6e;
  --accent-dim:     rgba(232,168,74,0.09);
  --accent-glow:    rgba(232,168,74,0.13);
  --accent-ring:    rgba(232,168,74,0.28);
  --border:         rgba(255,255,255,0.06);
  --border-hover:   rgba(255,255,255,0.12);
  --font-display:   'Outfit', sans-serif;
  --font-mono:      'DM Mono', monospace;
}

/* ── Reset ─────────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* ── Base ──────────────────────────────────────────────── */
body {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-display);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ────────────────────────────────────────────── */
/* Default: narrow, centered. .wide variant expands on large screens. */
.site-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}
@media (min-width: 1024px) {
  .site-wrap.wide { max-width: 1080px; padding: 0 48px; }
}

/* ── Grid Background ───────────────────────────────────── */
.grid-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--border) 0.5px, transparent 0.5px),
    linear-gradient(90deg, var(--border) 0.5px, transparent 0.5px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 50% 50% at 50% 0%, rgba(0,0,0,0.4) 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 0%, rgba(0,0,0,0.4) 0%, transparent 70%);
}

/* ── Navigation ────────────────────────────────────────── */
nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(10,11,15,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 0.5px solid var(--border);
  padding: 14px 0;
}
/* Nav uses its own inner div so it always tracks the widest layout */
nav .nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
@media (max-width: 1023px) {
  nav .nav-inner {
    max-width: 720px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
}
nav .logo {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.5px;
  text-decoration: none;
}
nav .logo:hover { color: var(--accent-hover); }
nav .links {
  display: flex;
  gap: 28px;
}
nav .links a {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
  letter-spacing: 0.3px;
}
nav .links a:hover { color: var(--text-primary); }
nav .links a.cta {
  color: var(--accent);
  font-weight: 500;
}
nav .links a.cta:hover { color: var(--accent-hover); }

/* ── Footer ────────────────────────────────────────────── */
footer {
  border-top: 0.5px solid var(--border);
  padding: 40px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
footer .copy {
  font-size: 12px;
  color: var(--text-tertiary);
}
footer .copy a {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.2s;
}
footer .copy a:hover { color: var(--text-secondary); }
footer .social {
  display: flex;
  gap: 20px;
}
footer .social a {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}
footer .social a:hover { color: var(--accent); }

/* ── Homepage: Hero ────────────────────────────────────── */
.hero {
  padding: 100px 0 80px;
  position: relative;
}
@media (min-width: 1024px) {
  .hero { padding: 120px 0 100px; }
}
.hero::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0.35;
}
.hero-top {
  display: flex;
  align-items: center;
  gap: 32px;
  margin-bottom: 32px;
}
@media (min-width: 1024px) {
  .hero-top { gap: 56px; }
}
.portrait-wrap {
  flex-shrink: 0;
  position: relative;
  opacity: 0;
  animation: fadeIn 0.6s ease forwards 0.15s;
}
.portrait-ring {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, var(--accent-ring), transparent 60%);
}
@media (min-width: 1024px) {
  .portrait-ring { width: 128px; height: 128px; }
}
.portrait-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 2px solid var(--bg-deep);
}
.hero-text {
  flex: 1;
  min-width: 0;
}
.hero-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 16px;
  opacity: 0;
  animation: fadeUp 0.6s ease forwards 0.2s;
}
/* Static font sizes aligned to layout breakpoints:
 *   ≤720px   stacked, full-width h1: 32px
 *   721–1023px  side-by-side narrow: 36px  (hero-text ≈ 544px; string ≈ 490px ✓)
 *   ≥1024px         wide layout:     48px  (hero-text ≥ 744px; string ≈ 654px ✓)
 */
.hero h1 {
  font-size: 32px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.5px;
  opacity: 0;
  animation: fadeUp 0.6s ease forwards 0.35s;
}
@media (min-width: 721px) {
  .hero h1 { font-size: 36px; }
}
@media (min-width: 1024px) {
  .hero h1 { font-size: 48px; }
}
.hero h1 .accent { color: var(--accent); }
.hero-bio {
  margin-top: 20px;
  max-width: 520px;
  opacity: 0;
  animation: fadeUp 0.6s ease forwards 0.5s;
}
.hero-bio:empty { display: none; }
.hero-bio p {
  font-size: 17px;
  font-weight: 300;
  color: var(--text-secondary);
  line-height: 1.7;
}
.hero-bio em {
  color: var(--text-primary);
  font-style: normal;
  font-weight: 400;
}

/* ── Homepage: Section Divider ─────────────────────────── */
.section-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 48px;
}
.section-divider span {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  white-space: nowrap;
}
.section-divider::after {
  content: '';
  flex: 1;
  height: 0.5px;
  background: var(--border);
}

/* ── Homepage: Projects ────────────────────────────────── */
.projects {
  padding: 60px 0 80px;
}
.projects .desc {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 40px;
  line-height: 1.7;
}
.project-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (min-width: 1024px) {
  .project-grid { gap: 20px; }
  /* Auto-switch to 3 columns when a third card is present */
  .project-grid:has(:nth-child(3)) { grid-template-columns: 1fr 1fr 1fr; }
}
.project-card {
  background: var(--bg-card);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  padding: 28px 24px;
  text-decoration: none;
  color: inherit;
  transition: background 0.25s, border-color 0.25s, transform 0.2s;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
}
@media (min-width: 1024px) {
  .project-card { padding: 32px 28px; }
}
.project-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
}
.project-card .icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--accent);
  flex-shrink: 0;
}
.project-card h3 {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
}
.project-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.project-card .tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  letter-spacing: 0.5px;
  margin-top: auto;
}
.project-card .arrow {
  position: absolute;
  top: 28px;
  right: 24px;
  font-size: 14px;
  color: var(--text-tertiary);
  transition: color 0.2s, transform 0.2s;
}
@media (min-width: 1024px) {
  .project-card .arrow { top: 32px; right: 28px; }
}
.project-card:hover .arrow {
  color: var(--accent);
  transform: translate(2px, -2px);
}

/* ── Privacy: Page Header ──────────────────────────────── */
.page-header {
  padding: 80px 0 48px;
}
.page-header .label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 16px;
  opacity: 0;
  animation: fadeUp 0.5s ease forwards 0.1s;
}
.page-header h1 {
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.3px;
  opacity: 0;
  animation: fadeUp 0.5s ease forwards 0.25s;
}

/* ── Privacy: Content ──────────────────────────────────── */
.content {
  padding-bottom: 80px;
  opacity: 0;
  animation: fadeUp 0.5s ease forwards 0.4s;
}
.content p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 28px;
}
.content p strong {
  color: var(--text-primary);
  font-weight: 500;
}
.content h2 {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 12px;
  margin-top: 8px;
  letter-spacing: 0.2px;
}

/* ── Animations ────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Responsive: Mobile & Narrow ───────────────────────── */
/* Stack hero portrait above text below 720px so the h1 gets
   full container width and can never be squeezed by the portrait. */
@media (max-width: 720px) {
  .hero-top { flex-direction: column; text-align: center; gap: 24px; }
  .hero-bio { margin-left: auto; margin-right: auto; text-align: center; }
  /* Suppress the forced break after "systems," so "systems, and homelabs."
     can wrap naturally — avoids orphaning "and" on its own line on mobile. */
  .hero h1 .tagline-br { display: none; }
}
/* Single-column project grid on small phones */
@media (max-width: 520px) {
  .project-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-label, .hero h1, .hero-bio, .portrait-wrap,
  .page-header .label, .page-header h1, .content { animation: none; opacity: 1; }
}
