/* ===================================================================
 * John Riches — sleek dark theme
 * Inspired by Linear / SpaceX: deep charcoal surface, hairline borders,
 * restrained indigo accent, tight typography, generous whitespace.
 * ================================================================ */

/* ---------- Design tokens ---------- */
:root {
  --bg: #0b0d10;
  --bg-elev: #111418;
  --surface: #14181d;
  --border: #1f242b;
  --border-strong: #2a3038;
  --text: #e6e8eb;
  --text-dim: #9aa1ab;
  --text-faint: #6b7280;
  --accent: #818cf8; /* indigo-400 */
  --accent-hot: #a5b4fc; /* indigo-300 */
  --accent-glow: rgba(129, 140, 248, 0.18);
  --danger: #f87171;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas,
    monospace;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv02", "cv11";
  min-height: 100vh;
}

/* Subtle ambient glow behind the page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(
      ellipse 80% 50% at 50% -10%,
      rgba(129, 140, 248, 0.15),
      transparent 60%
    ),
    radial-gradient(
      ellipse 60% 40% at 80% 110%,
      rgba(99, 102, 241, 0.08),
      transparent 50%
    );
  pointer-events: none;
}

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

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-hot);
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 0.12em 0.4em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
}

::selection {
  background: var(--accent-glow);
  color: var(--text);
}

/* ---------- Layout ---------- */
.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px;
}

.wide {
  max-width: 1120px;
}

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  background: rgba(11, 13, 16, 0.72);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  padding-bottom: 16px;
}

.brand {
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--text);
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.brand:hover {
  color: var(--text);
}

.nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.nav a {
  color: var(--text-dim);
  font-size: 0.9rem;
  padding: 6px 12px;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}

.nav a:hover {
  color: var(--text);
  background: var(--surface);
}

.nav a.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
}

/* ---------- Main ---------- */
main {
  padding: 72px 0 96px;
}

h1,
h2,
h3 {
  letter-spacing: -0.025em;
  line-height: 1.2;
  color: var(--text);
  font-weight: 600;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3rem);
  margin: 0 0 0.4em;
  letter-spacing: -0.035em;
  font-weight: 700;
}

h2 {
  font-size: 1.4rem;
  margin: 2.4em 0 0.7em;
  position: relative;
  padding-left: 14px;
}

h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.35em;
  bottom: 0.35em;
  width: 2px;
  background: linear-gradient(
    to bottom,
    var(--accent),
    transparent
  );
  border-radius: 2px;
}

h3 {
  font-size: 1.05rem;
  margin: 1.6em 0 0.4em;
}

p {
  margin: 0 0 1.1em;
  color: var(--text);
}

.lead {
  font-size: 1.18rem;
  color: var(--text-dim);
  margin-bottom: 1.6em;
  max-width: 60ch;
}

.muted {
  color: var(--text-faint);
  font-size: 0.9rem;
}

ul {
  padding-left: 1.2em;
}

ul li {
  margin-bottom: 0.5em;
}

/* ---------- Hero ---------- */
.hero {
  padding: 24px 0 8px;
}

.hero h1 span {
  background: linear-gradient(135deg, var(--accent) 0%, #c7d2fe 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.socials {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.socials a {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-size: 0.88rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s ease, background 0.15s ease,
    transform 0.15s ease;
}

.socials a:hover {
  border-color: var(--accent);
  background: var(--bg-elev);
  color: var(--text);
  transform: translateY(-1px);
}

/* ---------- Blog ---------- */
.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.post-list li {
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
}

.post-list li:last-child {
  border-bottom: none;
}

.post-list h3 {
  margin: 0 0 6px;
  color: var(--text);
}

.post-list .date {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 8px;
}

/* ---------- Photos ---------- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 28px;
}

.photo-grid figure {
  margin: 0;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  aspect-ratio: 4 / 3;
  position: relative;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.photo-grid figure:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.photo-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.photo-grid figure:hover img {
  transform: scale(1.04);
}

.photo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  background:
    linear-gradient(135deg, var(--surface) 0%, var(--bg-elev) 100%);
  position: relative;
}

.photo-placeholder::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.3;
}

/* ---------- Feed cards ---------- */
.feed {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 32px;
}

@media (min-width: 720px) {
  .feed {
    grid-template-columns: 1fr 1fr;
  }
}

.feed-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  transition: border-color 0.2s ease, transform 0.2s ease,
    background 0.2s ease;
  position: relative;
  overflow: hidden;
}

.feed-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    var(--accent-glow) 0%,
    transparent 50%
  );
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.feed-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.feed-card:hover::before {
  opacity: 1;
}

.feed-card > * {
  position: relative;
}

.feed-card h3 {
  font-size: 0.98rem;
  margin: 0 0 8px;
  line-height: 1.4;
  font-weight: 600;
}

.feed-card h3 a {
  color: var(--text);
}

.feed-card h3 a:hover {
  color: var(--accent-hot);
}

.feed-card .meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.feed-card .meta .source {
  font-weight: 600;
  color: var(--accent);
}

.feed-card p {
  font-size: 0.88rem;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feed-status {
  padding: 22px;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.88rem;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  grid-column: 1 / -1;
}

.feed-error {
  color: var(--danger);
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 10px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  color: var(--text-faint);
  font-size: 0.82rem;
  text-align: center;
  background: var(--bg);
  font-family: var(--font-mono);
  letter-spacing: 0.03em;
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  h1 {
    font-size: 1.85rem;
  }
  .site-header .container {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  main {
    padding: 40px 0 64px;
  }
}
