@import url('https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap');

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

:root {
  --bg:        #f5f4f0;
  --surface:   #eceae4;
  --border:    #d8d5cc;
  --muted:     #9e9b93;
  --text:      #1a1916;
  --accent:    #2a5cff;
  --accent-dim:#d6e0ff;
  --danger:    #c0392b;
  --radius:    6px;
  --mono:      'DM Mono', monospace;
  --sans:      'DM Sans', sans-serif;
  --nav-h:     60px;
  --max-w:     1100px;
  --transition: 180ms ease;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.65;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: var(--sans); }

/* Navigation Bar */
nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
}
.nav-inner {
  max-width: var(--max-w);
  width: 100%; margin: 0 auto;
  padding: 0 2rem;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
  font-family: var(--mono);
  font-size: .875rem;
  letter-spacing: .02em;
}
.nav-logo span { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 2rem; }
.nav-links a {
  font-size: .875rem;
  color: var(--muted);
  transition: color var(--transition);
}
.nav-links a:hover,
.nav-links a.active { color: var(--text); }
.nav-links a.active { font-weight: 500; }

#auth-btn {
  font-family: var(--mono);
  font-size: .75rem;
  padding: .35rem .85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  transition: all var(--transition);
}
#auth-btn:hover {
  border-color: var(--text);
  color: var(--text);
}
#auth-btn.signed-in {
  border-color: var(--accent-dim);
  color: var(--accent);
  background: var(--accent-dim);
}

/* Layout */
.page {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 4rem 2rem 6rem;
}
.page-sm { max-width: 560px; }

/* Typography */
.label {
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 300; line-height: 1.1; letter-spacing: -.02em; }
h2 { font-size: 1.5rem; font-weight: 400; letter-spacing: -.01em; }
h3 { font-size: 1.1rem; font-weight: 500; }
p  { color: #3d3b35; }

/* Hero */
.hero { padding: 6rem 0 4rem; border-bottom: 1px solid var(--border); }
.hero .label { margin-bottom: 1.5rem; }
.hero h1 { max-width: 14ch; margin-bottom: 1.5rem; }
.hero-sub {
  max-width: 46ch;
  font-size: 1.05rem;
  color: #5a5851;
  margin-bottom: 2.5rem;
}
.hero-cta { display: flex; gap: 1rem; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .65rem 1.4rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all var(--transition);
}
.btn-primary {
  background: var(--text);
  color: var(--bg);
}
.btn-primary:hover { background: #333; }
.btn-ghost {
  border-color: var(--border);
  color: var(--muted);
}
.btn-ghost:hover { border-color: var(--text); color: var(--text); }

/* Section headers */
.section-head {
  display: flex; align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: .75rem;
  margin-bottom: 2rem;
}
.section-head a { font-size: .8rem; color: var(--muted); }
.section-head a:hover { color: var(--accent); }

/* Skills */
.skills-strip { padding: 3rem 0; border-bottom: 1px solid var(--border); }
.skills-grid {
  display: flex; flex-wrap: wrap; gap: .5rem;
  margin-top: 1.5rem;
}
.skill-tag {
  font-family: var(--mono);
  font-size: .75rem;
  padding: .3rem .75rem;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
}

/* Project cards */
.projects-section { padding: 3rem 0; border-bottom: 1px solid var(--border); }
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.project-card {
  background: var(--bg);
  padding: 1.75rem;
  display: flex; flex-direction: column; gap: .75rem;
  transition: background var(--transition);
  position: relative;
}
.project-card:hover { background: var(--surface); }
.project-card h3 { font-size: 1rem; }
.project-card p { font-size: .875rem; line-height: 1.5; color: var(--muted); flex: 1; }
.project-meta {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-top: .5rem;
}
.project-tags { display: flex; gap: .35rem; flex-wrap: wrap; }
.project-tag {
  font-family: var(--mono);
  font-size: .65rem;
  padding: .2rem .5rem;
  border-radius: 3px;
  background: var(--accent-dim);
  color: var(--accent);
}
.project-link {
  font-size: .75rem;
  font-family: var(--mono);
  color: var(--muted);
  transition: color var(--transition);
}
.project-card:hover .project-link { color: var(--accent); }
.project-locked {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .75rem;
  font-family: var(--mono);
  color: var(--muted);
}
.lock-icon { font-size: .8rem; }

/* Case study page */
.case-hero { padding: 3rem 0 2rem; border-bottom: 1px solid var(--border); margin-bottom: 3rem; }
.case-hero .label { margin-bottom: 1rem; }
.case-meta {
  display: flex; gap: 2rem; flex-wrap: wrap;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.case-meta-item { display: flex; flex-direction: column; gap: .25rem; }
.case-meta-item .label { margin-bottom: 0; }
.case-meta-item span { font-size: .875rem; }

.case-body { display: grid; grid-template-columns: 1fr 260px; gap: 4rem; align-items: start; }
.case-content { max-width: 68ch; }
.case-content h2 { margin: 2.5rem 0 1rem; font-size: 1.25rem; }
.case-content p { margin-bottom: 1rem; font-size: .95rem; }
.case-content ul { padding-left: 1.25rem; margin-bottom: 1rem; }
.case-content li { font-size: .95rem; color: #3d3b35; margin-bottom: .35rem; }

.case-sidebar { position: sticky; top: calc(var(--nav-h) + 2rem); }
.sidebar-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.sidebar-card-head {
  background: var(--surface);
  padding: .75rem 1rem;
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.sidebar-card-body { padding: 1rem; display: flex; flex-direction: column; gap: .75rem; }
.sidebar-item { display: flex; flex-direction: column; gap: .15rem; }
.sidebar-item .label { font-size: .65rem; }
.sidebar-item span { font-size: .8rem; font-family: var(--mono); }

/* Auth gate */
.auth-gate {
  min-height: 60vh;
  display: flex; align-items: center; justify-content: center;
}
.auth-gate-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  background: var(--surface);
}
.auth-gate-card .lock-big { font-size: 2rem; margin-bottom: 1.5rem; display: block; }
.auth-gate-card h2 { margin-bottom: .5rem; }
.auth-gate-card p { font-size: .875rem; color: var(--muted); margin-bottom: 2rem; }
.auth-gate-card .btn { width: 100%; justify-content: center; }

/* Login form */
.auth-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  background: var(--surface);
  margin-top: 2rem;
}
.auth-card h2 { margin-bottom: .25rem; }
.auth-card > p { font-size: .875rem; color: var(--muted); margin-bottom: 2rem; }

.form-group { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1.25rem; }
.form-group label { font-size: .75rem; font-family: var(--mono); color: var(--muted); letter-spacing: .05em; }
.form-group input {
  padding: .65rem .9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-family: var(--sans);
  font-size: .875rem;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}
.form-group input:focus { border-color: var(--accent); }

.form-error {
  font-size: .8rem;
  color: var(--danger);
  font-family: var(--mono);
  margin-top: -.75rem;
  margin-bottom: 1rem;
  display: none;
}
.form-error.visible { display: block; }

.btn-full { width: 100%; justify-content: center; }
.auth-switch {
  text-align: center;
  margin-top: 1.25rem;
  font-size: .8rem;
  color: var(--muted);
}
.auth-switch a { color: var(--accent); text-decoration: underline; }

/* Contact / About */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: start; margin-top: 3rem; }
.about-bio p { margin-bottom: 1rem; font-size: .95rem; }
.about-links { display: flex; flex-direction: column; gap: .5rem; margin-top: 1.5rem; }
.about-link {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .875rem;
  transition: all var(--transition);
}
.about-link:hover { border-color: var(--text); background: var(--surface); }
.about-link .link-icon { font-size: 1rem; }

.contact-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  background: var(--surface);
}
.contact-card h3 { margin-bottom: 1rem; }

/* Footer */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem;
}
.footer-inner p {
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--muted);
}

/* Toast */
#toast {
  position: fixed; bottom: 2rem; right: 2rem;
  background: var(--text);
  color: var(--bg);
  padding: .75rem 1.25rem;
  border-radius: var(--radius);
  font-size: .8rem;
  font-family: var(--mono);
  transform: translateY(1rem);
  opacity: 0;
  transition: all .25s ease;
  pointer-events: none;
  z-index: 999;
}
#toast.show { opacity: 1; transform: translateY(0); }

/* Responsive */
@media (max-width: 768px) {
  .case-body { grid-template-columns: 1fr; }
  .case-sidebar { position: static; }
  .about-grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .nav-links { gap: 1.25rem; }
}
@media (max-width: 520px) {
  .nav-links a:not(#auth-btn) { display: none; }
  .page { padding: 2.5rem 1.25rem 4rem; }
}

/* Animations */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp .5s ease both; }
.fade-up-2 { animation: fadeUp .5s .1s ease both; }
.fade-up-3 { animation: fadeUp .5s .2s ease both; }
.fade-up-4 { animation: fadeUp .5s .3s ease both; }
