/* ==========================================================
   style.css · Daniel G. Alfert personal site
   ========================================================== */

/* --- Custom properties --- */
:root {
  --bg:     #FAFAF8;
  --text:   #16181D;
  --muted:  #6B7280;
  --border: #E6E6E1;
  --accent: #B45309;

  --f-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --f-head: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --f-mono: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, monospace;

  --max-w: 1100px;
  --r: 3px;
  --ease: 160ms ease;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img, picture, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; }
a { color: var(--accent); }
a:hover { text-decoration: none; }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}
ul, ol { list-style: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- Layout --- */
.container {
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: clamp(1rem, 5vw, 2rem);
}

/* --- Typography --- */
.h1 {
  font-family: var(--f-head);
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.h2 {
  font-family: var(--f-head);
  font-size: clamp(1.375rem, 2.5vw, 1.875rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.h3 {
  font-family: var(--f-head);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.lead {
  font-size: clamp(0.9375rem, 2vw, 1.0625rem);
  color: var(--muted);
  line-height: 1.7;
}
.eyebrow {
  display: block;
  font-family: var(--f-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* --- Navigation --- */
.nav-wrap {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(250, 250, 248, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  color: var(--text);
}
.nav-brand:hover { text-decoration: none; }
.nav-mark {
  font-family: var(--f-head);
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.01em;
}
.nav-name {
  font-family: var(--f-head);
  font-size: 0.9rem;
  font-weight: 500;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}
.nav-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  position: relative;
  padding-bottom: 2px;
  transition: color var(--ease);
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1.5px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--ease);
}
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after,
.nav-links a[aria-current="page"]::after { transform: scaleX(1); }
.nav-links a[aria-current="page"] { color: var(--accent); }

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  -webkit-tap-highlight-color: transparent;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--text);
  transition: transform var(--ease), opacity var(--ease);
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

@media (max-width: 640px) {
  .nav-toggle { display: flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 0.25rem clamp(1rem, 5vw, 2rem) 1.5rem;
  }
  .nav-links.is-open { display: flex; }
  .nav-links li { width: 100%; }
  .nav-links a {
    display: block;
    padding-block: 0.8rem;
    width: 100%;
  }
  .nav-links a::after { display: none; }
}

/* --- Hero --- */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(4rem, 10vw, 7rem);
}
.hero-motif {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
}
.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 680px;
}
.hero-eyebrow { margin-bottom: 1.25rem; }
.hero-title { margin-bottom: 1rem; }
.hero-tagline {
  font-size: clamp(1rem, 2vw, 1.125rem);
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 0.875rem;
}
.hero-body {
  font-size: 0.9375rem;
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 2rem;
  max-width: 560px;
}
.hero-cta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* --- Sections --- */
.section {
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
  border-top: 1px solid var(--border);
}
.section-head { margin-bottom: 2rem; }
.section-head .eyebrow { margin-bottom: 0.5rem; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--r);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none !important;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
  white-space: nowrap;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.btn-solid {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-solid:hover { background: #92400e; border-color: #92400e; }
.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-outline:hover { border-color: var(--muted); }
.btn-sm {
  padding: 0.4rem 0.875rem;
  font-size: 0.8125rem;
}

/* --- Cards --- */
.card {
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.5rem;
  background: var(--bg);
}
.card-title {
  font-family: var(--f-head);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.5rem;
  color: var(--text);
}
.card-desc {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.65;
}
a.card {
  display: block;
  color: var(--text);
  text-decoration: none !important;
}
.lift {
  transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease);
}
.lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(22, 24, 29, 0.07);
  border-color: #d8d8d4;
}

/* Project card left accent on hover */
.proj-card {
  position: relative;
  overflow: hidden;
}
.proj-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform var(--ease);
}
.proj-card:hover::before { transform: scaleY(1); }

/* --- Tags --- */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 1rem;
}
.tag {
  font-family: var(--f-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.2rem 0.45rem;
  border-radius: 2px;
  white-space: nowrap;
}

/* --- Approach grid (2×2 bordered) --- */
.approach-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.approach-item { padding: 1.75rem; }
.approach-item:nth-child(2) { border-left: 1px solid var(--border); }
.approach-item:nth-child(3) { border-top: 1px solid var(--border); }
.approach-item:nth-child(4) {
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
}
.approach-title {
  font-family: var(--f-head);
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
}
.approach-desc {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.65;
}

@media (max-width: 560px) {
  .approach-grid { grid-template-columns: 1fr; }
  .approach-item:nth-child(2) { border-left: none; border-top: 1px solid var(--border); }
  .approach-item:nth-child(4) { border-left: none; }
}

/* --- Grids --- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
@media (max-width: 800px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* --- Projects page --- */
.proj-featured { margin-bottom: 1.5rem; }
.proj-featured .card { padding: 2rem; }
.proj-featured .card-title {
  font-size: 1.1875rem;
  margin-bottom: 0.625rem;
}
.proj-featured .card-desc { font-size: 0.9375rem; }
.proj-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}
@media (max-width: 560px) { .proj-grid { grid-template-columns: 1fr; } }

/* --- Project detail --- */
.case-block { margin-bottom: 2rem; }
.case-block:last-child { margin-bottom: 0; }
.case-label {
  font-family: var(--f-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
  display: block;
}
.case-text {
  font-size: 0.9375rem;
  color: var(--muted);
  line-height: 1.8;
}

/* --- Timeline (CV) --- */
.timeline { }
.timeline-item {
  padding-block: 1.5rem;
  border-top: 1px solid var(--border);
}
.timeline-item:first-child { border-top: none; padding-top: 0; }
.timeline-role {
  font-family: var(--f-head);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.timeline-meta {
  font-family: var(--f-mono);
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-bottom: 0.875rem;
}
.timeline-bullets {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.timeline-bullets li {
  font-size: 0.9rem;
  color: var(--muted);
  padding-left: 1.125rem;
  position: relative;
  line-height: 1.65;
}
.timeline-bullets li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--border);
  font-size: 0.75rem;
  top: 0.1em;
}

/* --- CV download bar --- */
.cv-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-block: 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
}

/* --- About page --- */
.about-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 3.5rem;
  align-items: start;
}
.about-photo {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  object-position: top center;
  border-radius: var(--r);
  border: 1px solid var(--border);
}
.about-photo-fallback {
  width: 100%;
  aspect-ratio: 3/4;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: #F0F0EE;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-head);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: -0.02em;
}
.about-prose h2 {
  font-family: var(--f-head);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 1.75rem;
  margin-bottom: 0.375rem;
  letter-spacing: -0.01em;
}
.about-prose h2:first-child { margin-top: 0; }
.about-prose p {
  font-size: 0.9375rem;
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 0.875rem;
}
.about-prose p:last-child { margin-bottom: 0; }

@media (max-width: 680px) {
  .about-layout { grid-template-columns: 1fr; gap: 2rem; }
  .about-photo,
  .about-photo-fallback { max-width: 180px; }
}

/* --- Contact --- */
.contact-email {
  font-family: var(--f-head);
  font-size: clamp(1.25rem, 3vw, 1.625rem);
  font-weight: 600;
  color: var(--accent);
  display: inline-block;
  margin-block: 0.75rem 2rem;
  transition: opacity var(--ease);
}
.contact-email:hover { opacity: 0.8; text-decoration: underline; }
.contact-socials {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 3rem;
}

/* Contact form */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1.25rem;
}
.form-label {
  font-family: var(--f-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.form-input,
.form-textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0.625rem 0.875rem;
  font-size: 0.9rem;
  color: var(--text);
  font-family: var(--f-sans);
  transition: border-color var(--ease);
  width: 100%;
}
.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.form-textarea { min-height: 120px; resize: vertical; }
.form-max { max-width: 540px; }

/* --- Skills --- */
.skill-name {
  font-family: var(--f-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.375rem;
  display: block;
}
.skill-body {
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.65;
}

/* --- Footer --- */
.footer {
  border-top: 1px solid var(--border);
  padding-block: 2rem;
  margin-top: clamp(2.5rem, 6vw, 4rem);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.8125rem;
  color: var(--muted);
}
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a {
  color: var(--muted);
  text-decoration: none;
  transition: color var(--ease);
}
.footer-links a:hover { color: var(--text); }

/* --- Utility --- */
.reading { max-width: 700px; }
.mt-sm { margin-top: 1rem; }
.mt-md { margin-top: 1.5rem; }
.mt-lg { margin-top: 2rem; }

/* --- Print (CV) --- */
@media print {
  .nav-wrap, .footer, .cv-bar { display: none !important; }
  body { background: white; color: black; font-size: 11pt; }
  .section { padding-block: 0.875rem; }
  a { color: black; text-decoration: none; }
  .container { padding-inline: 0; }
  .timeline-bullets li { color: #333; }
  .timeline-meta { color: #555; }
}
