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

:root {
  --teal:       #1bb0ce;
  --teal-dim:   #0f7a90;
  --dark:       #0e1117;
  --dark-card:  #161b24;
  --dark-border:#1e2738;
  --text:       #d4dce8;
  --text-muted: #7a8899;
  --radius:     6px;
  --font-body:  'Inter', system-ui, sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', monospace;
}

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

body {
  background: var(--dark);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ── Layout ───────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }

main { flex: 1; }

/* ── Nav ──────────────────────────────────────── */
nav {
  background: rgba(14,17,23,0.95);
  border-bottom: 1px solid var(--dark-border);
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(6px);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-logo { display: flex; align-items: center; gap: 0.75rem; }
.nav-logo img { height: 36px; }
.nav-logo span {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--teal);
  letter-spacing: 0.05em;
}

.nav-links { display: flex; gap: 2rem; list-style: none; }
.nav-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: color 0.2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--teal); text-decoration: none; }

.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 0.5rem; }
.nav-toggle span {
  display: block; width: 22px; height: 2px;
  background: var(--text); margin: 5px 0; transition: all 0.3s;
}

/* ── Hero ─────────────────────────────────────── */
.hero {
  background:
    linear-gradient(180deg, rgba(14,17,23,0) 60%, var(--dark) 100%),
    repeating-linear-gradient(0deg, transparent, transparent 39px, var(--dark-border) 39px, var(--dark-border) 40px),
    repeating-linear-gradient(90deg, transparent, transparent 39px, var(--dark-border) 39px, var(--dark-border) 40px),
    var(--dark-card);
  padding: 5rem 0 4rem;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.hero h1 span { color: var(--teal); }

.hero p {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 2rem;
}

.hero-cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ── Buttons ──────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius);
  font-size: 0.9rem; font-weight: 600;
  cursor: pointer; border: none; transition: all 0.2s;
  text-decoration: none;
}
.btn-primary { background: var(--teal); color: #000; }
.btn-primary:hover { background: var(--teal-dim); color: #fff; text-decoration: none; }
.btn-outline { background: transparent; color: var(--teal); border: 1px solid var(--teal); }
.btn-outline:hover { background: var(--teal); color: #000; text-decoration: none; }
.btn-ghost { background: var(--dark-border); color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); text-decoration: none; }
.btn-github {
  background: #24292e; color: #fff;
  border: 1px solid #444;
}
.btn-github:hover { background: #2f363d; text-decoration: none; }

/* ── Section headers ──────────────────────────── */
.section-header {
  display: flex; align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--dark-border);
}
.section-header h2 { font-size: 1.3rem; font-weight: 600; }
.section-header a { font-size: 0.85rem; color: var(--teal); }

section { padding: 3.5rem 0; }

/* ── Project grid ─────────────────────────────── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

/* ── Project card ─────────────────────────────── */
.project-card {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  transition: border-color 0.2s, transform 0.2s;
  cursor: pointer;
}
.project-card:hover {
  border-color: var(--teal);
  transform: translateY(-2px);
}

.card-image {
  background: var(--dark-border);
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
}
.card-image img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.3s;
}
.project-card:hover .card-image img { transform: scale(1.03); }

.card-body { padding: 1.25rem; flex: 1; display: flex; flex-direction: column; gap: 0.75rem; }

.card-meta { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.status-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.status-commercial  { background: rgba(27,176,206,0.15); color: var(--teal); border: 1px solid rgba(27,176,206,0.3); }
.status-prototype   { background: rgba(255,180,0,0.12);  color: #f5b800;     border: 1px solid rgba(255,180,0,0.3); }
.status-open-source { background: rgba(80,220,100,0.12); color: #50dc64;     border: 1px solid rgba(80,220,100,0.3); }

.tag-list { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tag {
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  background: var(--dark-border);
  color: var(--text-muted);
  border-radius: 3px;
}

.card-body h3 { font-size: 1rem; font-weight: 600; line-height: 1.3; }

.card-body p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.5rem; }

/* ── Modal ────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: var(--radius);
  max-width: 820px; width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: absolute; top: 1rem; right: 1rem;
  background: var(--dark-border); border: none;
  color: var(--text); width: 32px; height: 32px;
  border-radius: 50%; cursor: pointer; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--teal); color: #000; }

.modal-content { padding: 1.5rem; }
.modal-content h2 { font-size: 1.3rem; margin-bottom: 0.75rem; }
.modal-content .card-meta { margin-bottom: 1rem; }
.modal-body { font-size: 0.9rem; line-height: 1.7; color: var(--text-muted); }
.modal-body p { margin-bottom: 0.75rem; }
.modal-body figure {
  margin: 1.25rem 0;
}
.modal-body figure a {
  display: block;
}
.modal-body figure img,
.modal-body > img {
  max-width: 420px;
  height: auto;
  border-radius: 3px;
  display: block;
  cursor: pointer;
  transition: opacity 0.2s;
}
.modal-body figure img:hover,
.modal-body > img:hover {
  opacity: 0.85;
}
.modal-body figure figcaption {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  text-align: center;
  font-style: italic;
}
.modal-actions { margin-top: 1.25rem; display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* ── Lightbox ─────────────────────────────────── */
.lightbox {
  display: none;
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.92);
  align-items: center; justify-content: center;
  cursor: pointer;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 95vw;
  max-height: 95vh;
  width: auto; height: auto;
  object-fit: contain;
  border-radius: var(--radius);
}
.lightbox-close {
  position: absolute; top: 1.5rem; right: 1.5rem;
  background: var(--dark-border); border: none;
  color: var(--text); width: 36px; height: 36px;
  border-radius: 50%; cursor: pointer; font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  z-index: 301;
}
.lightbox-close:hover { background: var(--teal); color: #000; }

/* ── About / Contact pages ────────────────────── */
.prose-page { max-width: 740px; margin: 0 auto; padding: 4rem 1.5rem; }
.prose-page h1 { font-size: 1.8rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--dark-border); padding-bottom: 0.75rem; }
.prose-page p { color: var(--text-muted); margin-bottom: 1rem; line-height: 1.75; }
.prose-page p:last-of-type { margin-bottom: 0; }
.prose-page .signature { margin-top: 2rem; font-style: italic; color: var(--text); }

.about-figure {
  margin: 2rem 0;
  text-align: center;
}
.about-figure a {
  display: block;
}
.about-figure img {
  max-width: 100%;
  max-width: 560px;
  height: auto;
  border-radius: var(--radius);
  display: block;
  margin: 0 auto;
  cursor: pointer;
  transition: opacity 0.2s;
}
.about-figure img:hover {
  opacity: 0.85;
}
.about-figure figcaption {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-style: italic;
}

.about-float-left {
  float: left;
  margin: 0.25rem 1.5rem 1rem 0;
  max-width: 340px;
}
.about-float-left a { display: block; }
.about-float-left img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  display: block;
  cursor: pointer;
  transition: opacity 0.2s;
}
.about-float-left img:hover { opacity: 0.85; }
.about-float-left figcaption {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  text-align: center;
  font-style: italic;
}

/* Contact form */
.contact-form { display: flex; flex-direction: column; gap: 1rem; margin-top: 2rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label { font-size: 0.85rem; color: var(--text-muted); }
.form-group input,
.form-group textarea {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
  font-family: var(--font-body);
  transition: border-color 0.2s;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--teal);
}
.form-group textarea { min-height: 140px; resize: vertical; }
.form-note { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ── Footer ───────────────────────────────────── */
footer {
  border-top: 1px solid var(--dark-border);
  padding: 2rem 0;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}
footer a { color: var(--text-muted); }
footer a:hover { color: var(--teal); }

/* ── Page title (projects.html) ───────────────── */
.page-title { padding: 3rem 0 2rem; border-bottom: 1px solid var(--dark-border); margin-bottom: 2.5rem; }
.page-title h1 { font-size: 1.8rem; }
.page-title p { color: var(--text-muted); margin-top: 0.5rem; }

/* ── Responsive ───────────────────────────────── */
@media (max-width: 640px) {
  .nav-links { display: none; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0; background: var(--dark); border-bottom: 1px solid var(--dark-border); padding: 1rem 1.5rem; gap: 1rem; }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .form-row { grid-template-columns: 1fr; }
  .modal-body figure img,
  .modal-body > img { max-width: 100%; }
  .about-figure img { max-width: 100%; }
  .about-float-left { float: none; margin: 0 auto 1.5rem; max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
