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

:root {
  --bg: #0f0f0f;
  --fg: #e5e5e5;
  --muted: #888;
  --accent: #e5e5e5;
  --border: #222;
  --font: system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Code", monospace;
}

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* Nav */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

nav .wordmark { font-weight: 600; letter-spacing: -0.01em; }

nav ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
}

nav ul li a { color: var(--muted); }
nav ul li a:hover { color: var(--fg); text-decoration: none; }

nav .nav-form { display: inline; }
nav .nav-form button { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; }
nav .nav-form button:hover { color: var(--fg); }
.signin-page { max-width: 24rem; margin: 0 auto; padding: 5rem 1.5rem 3rem; }
.signin-card { background: #161616; border: 1px solid var(--border); border-radius: 12px; padding: 2rem; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4); }
.signin-card h1 { font-size: 1.5rem; letter-spacing: -0.02em; line-height: 1.2; }
.signin-card .signin-lead { color: var(--muted); font-size: 0.9375rem; margin: 0.375rem 0 1.5rem; }
.signin-form { display: grid; gap: 1.125rem; }
.signin-form label { display: grid; gap: 0.375rem; font-size: 0.8125rem; font-weight: 500; color: var(--muted); }
.signin-form input { font: inherit; font-size: 1rem; padding: 0.625rem 0.75rem; color: var(--fg); background: #0f0f0f; border: 1px solid #333; border-radius: 8px; transition: border-color 0.15s, box-shadow 0.15s; }
.signin-form input:focus { outline: none; border-color: #7c9cff; box-shadow: 0 0 0 3px rgba(124, 156, 255, 0.25); }
.signin-form button { font: inherit; font-weight: 600; padding: 0.7rem 1rem; margin-top: 0.25rem; color: #0f0f0f; background: var(--fg); border: 0; border-radius: 8px; cursor: pointer; transition: background 0.15s, transform 0.1s; }
.signin-form button:hover { background: #fff; }
.signin-form button:active { transform: scale(0.98); }
.signin-form button:focus-visible { outline: 2px solid #7c9cff; outline-offset: 2px; }
.form-error { color: #ff8a8a; background: rgba(255, 90, 90, 0.1); border: 1px solid rgba(255, 90, 90, 0.3); border-radius: 8px; padding: 0.625rem 0.75rem; font-size: 0.875rem; margin-bottom: 1.25rem; }
.section-list { list-style: none; display: grid; gap: 0.5rem; }

/* Main */
main { flex: 1; }

/* Footer */
footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--muted);
}

.footer-links { display: flex; align-items: center; gap: 1.25rem; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--fg); text-decoration: none; }
.footer-links .build { font-family: var(--mono); font-size: 0.6875rem; color: #555; }

/* Page sections */
.page { padding: 3rem 2rem; max-width: 760px; margin: 0 auto; }
.page h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 2rem; }

/* Projects */
.project-section { margin-bottom: 3rem; }
.project-section:last-child { margin-bottom: 0; }
.project-section-title { font-size: 0.8125rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 1.25rem; }

.project-list { display: flex; flex-direction: column; gap: 2rem; }

.project {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
}

.project-app { display: flex; gap: 1rem; align-items: flex-start; }
.project-app .project-body { flex: 1; min-width: 0; }
.project-icon { flex: none; width: 64px; height: 64px; border-radius: 14px; background: #1a1a1a; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08); }
.project-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.625rem; margin-bottom: 0.375rem; }
.project-head h2 { margin-bottom: 0; }
.status { font-size: 0.6875rem; line-height: 1.4; color: var(--muted); border: 1px solid #333; border-radius: 999px; padding: 0.0625rem 0.5rem; white-space: nowrap; }
.status-in-review { color: #e0b45c; border-color: #4a3d1f; }
.status-approved, .status-live { color: #7fc48f; border-color: #24402b; }
.project h2 a { color: inherit; }
.project h2 a:hover { text-decoration: underline; }
.project-app .project-meta { flex-wrap: wrap; gap: 0.5rem 1rem; }
@media (max-width: 480px) { .project-app { padding: 1rem; gap: 0.75rem; } }

.project h2 { font-size: 1rem; font-weight: 600; margin-bottom: 0.375rem; }
.project p { font-size: 0.875rem; color: var(--muted); margin-bottom: 0.75rem; line-height: 1.6; }

.project-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.75rem;
  color: #555;
}

.project-meta a { color: var(--muted); }
.project-meta a:hover { color: var(--fg); text-decoration: none; }

.tags { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.tag {
  font-size: 0.6875rem;
  font-family: var(--mono);
  color: #555;
  border: 1px solid #2a2a2a;
  border-radius: 3px;
  padding: 0.125rem 0.375rem;
}

/* Consulting & About pages */
.prose { font-size: 0.9375rem; line-height: 1.75; color: var(--muted); }
.prose p { margin-bottom: 1rem; }
.prose h2 { font-size: 1rem; font-weight: 600; color: var(--fg); margin: 1.75rem 0 0.5rem; }
.prose h3 { font-size: 0.9375rem; font-weight: 600; color: var(--fg); margin: 1.25rem 0 0.375rem; }
.prose .lead { font-size: 1rem; color: var(--fg); }
.prose ul { padding-left: 1.25rem; margin-bottom: 1rem; }
.prose li { margin-bottom: 0.25rem; }
.prose a { color: var(--fg); text-decoration: underline; }
.prose ol { padding-left: 1.25rem; margin-bottom: 1rem; }
.prose ol li { margin-bottom: 0.5rem; }
.prose a.cta { display: inline-block; padding: 0.5rem 0.875rem; border: 1px solid var(--fg); border-radius: 6px; text-decoration: none; }
.prose a.cta:hover { background: var(--fg); color: var(--bg); }

/* Offers */
.offers { display: grid; gap: 1rem; margin: 1rem 0 1.5rem; }
.offer { border: 1px solid var(--border); border-radius: 8px; padding: 1rem 1.125rem; }
.offer h3 { margin-top: 0; }
.offer p { margin-bottom: 0; }

/* Blog */
.blog-list { display: flex; flex-direction: column; gap: 2.5rem; }
.blog-card { display: block; }
.blog-card:hover { text-decoration: none; }
a.blog-card img { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 6px; display: block; margin-bottom: 0.75rem; background: var(--border); }
.blog-card h2 { font-size: 1.125rem; font-weight: 600; margin-bottom: 0.25rem; }
.blog-meta { font-size: 0.8125rem; color: var(--muted); }
.blog-pager { display: flex; justify-content: space-between; margin-top: 2.5rem; font-size: 0.875rem; }
.blog-pager a { color: var(--muted); }
.blog-pager a:last-child:not(:only-child) { margin-left: auto; }
.blog-back { font-size: 0.8125rem; margin-bottom: 1.25rem; }
.blog-back a { color: var(--muted); }
.blog-entry h1 { margin-bottom: 0.375rem; }
.blog-body { margin: 1.5rem 0; font-size: 0.9375rem; line-height: 1.75; color: var(--muted); white-space: pre-line; }
.blog-body p { margin-bottom: 1rem; }
.blog-photos { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.5rem; }
.blog-photos img { width: 100%; height: auto; border-radius: 6px; display: block; background: var(--border); }

.blog-login { display: flex; flex-direction: column; gap: 0.75rem; max-width: 20rem; margin-top: 1rem; }
.blog-login input { font: inherit; padding: 0.5rem 0.625rem; border: 1px solid var(--border); border-radius: 6px; background: transparent; color: inherit; }
.blog-login button { font: inherit; padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 6px; background: transparent; color: inherit; cursor: pointer; }
.blog-error { color: #b3261e; font-size: 0.875rem; }

/* Blog carousel */
/* The track is only as tall as the current photo, so taller neighbours overflow it: overflow-y: hidden keeps vertical swipes going to the page instead of scrolling the track. */
.carousel { margin-top: 1.5rem; }
.carousel-viewport { position: relative; }
.carousel-track {
  display: flex; gap: 0.5rem; align-items: flex-start;
  overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; touch-action: pan-x pan-y pinch-zoom;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
@media (prefers-reduced-motion: no-preference) { .carousel-track { scroll-behavior: smooth; transition: height 0.2s; } }
/* Slide = track width minus 2rem, so with the 0.5rem gap 1.5rem of the next photo peeks. */
.carousel-slide { flex: 0 0 calc(100% - 2rem); scroll-snap-align: start; margin: 0; }
/* The box is reserved from --ar (width/height, set inline per photo): capped at --cap (80vh; 65vh in list cards) via the width formula, so it has its final size before the image loads and matches the photo exactly after (no letterboxing, no distortion). */
.carousel-slide img { display: block; width: min(100%, calc(var(--cap, 80vh) * var(--ar, 1.5))); height: auto; aspect-ratio: var(--ar, 1.5); margin-inline: auto; object-fit: cover; border-radius: 6px; }
.photo-badge {
  font-size: 0.75rem; line-height: 1.25; font-weight: 600; font-variant-numeric: tabular-nums; color: #fff;
  background: rgba(0, 0, 0, 0.6); border-radius: 999px; padding: 2px 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  position: absolute; right: 0.625rem; bottom: 0.625rem; pointer-events: none;
}
/* Controls are inset 0.5rem from the visible photo's edges; carousel.js sets --photo-left/--photo-right (px, from the track edges). */
.carousel-counter { top: 0.5rem; bottom: auto; right: calc(var(--photo-right, 2rem) + 0.5rem); margin: 0; }
.carousel-btn, .carousel-dots { display: none; }
.carousel.is-enhanced .carousel-btn {
  display: flex; align-items: center; justify-content: center;
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; padding: 0; border-radius: 50%;
  color: #111; background: rgba(255, 255, 255, 0.9); border: 1px solid rgba(0, 0, 0, 0.25);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45); cursor: pointer;
  transition: opacity 0.15s, background 0.15s, transform 0.15s;
}
.carousel-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.carousel.is-enhanced .carousel-btn:hover { background: #fff; transform: translateY(-50%) scale(1.06); }
.carousel.is-enhanced .carousel-btn:active { transform: translateY(-50%) scale(0.95); }
.carousel.is-enhanced .carousel-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 5px #111, 0 2px 8px rgba(0, 0, 0, 0.45); }
.carousel.is-enhanced .carousel-btn:disabled { opacity: 0; visibility: hidden; pointer-events: none; }
.carousel-prev { left: calc(var(--photo-left, 2rem) + 0.5rem); }
.carousel-next { right: calc(var(--photo-right, 2rem) + 0.5rem); }
.carousel:not(.is-enhanced) .carousel-counter { display: none; }
.carousel.is-enhanced .carousel-dots { display: flex; justify-content: center; margin-top: 0.375rem; padding-left: var(--photo-left, 0px); padding-right: var(--photo-right, 0px); }
.carousel-dot { width: 1.75rem; height: 1.75rem; padding: 0; border: 0; background: none; cursor: pointer; position: relative; }
.carousel-dot::before {
  content: ""; position: absolute; top: 50%; left: 50%; width: 10px; height: 10px;
  margin: -5px 0 0 -5px; border-radius: 50%; background: rgba(255, 255, 255, 0.3); transition: background 0.15s;
}
.carousel-dot[aria-current="true"]::before { background: #fff; }
.carousel-dot:focus-visible { outline: 2px solid var(--fg); outline-offset: -2px; border-radius: 50%; }
/* List cards for multi-photo entries: the same carousel inline (photos are not links), then title, meta and an "Open post" link. */
.carousel--list { margin-top: 0; --cap: 65vh; }
.blog-card--gallery h2 { margin-top: 0.75rem; }
.blog-card--gallery h2 a:hover { text-decoration: none; }
.blog-card-open { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: -0.75rem; font-size: 0.8125rem; color: var(--muted); }
.blog-card-open:hover { color: var(--fg); }

/* Articles */
.article-list { display: flex; flex-direction: column; gap: 1.75rem; }
.article-item h2 { font-size: 1.125rem; font-weight: 600; margin-bottom: 0.25rem; }
.article-item p { color: var(--muted); font-size: 0.9375rem; margin-bottom: 0.375rem; }
.article-meta { display: flex; gap: 0.75rem; align-items: center; color: var(--muted); font-size: 0.8125rem; margin-bottom: 1.5rem; }
.article-item .article-meta { margin-bottom: 0; }
.article .prose { font-size: 1rem; }
.footer-links .build-id { font-family: var(--mono); font-size: 0.6875rem; color: #555; }
