/* ---------------------------------------------------------------
   josiah.is-a.dev — handwritten stylesheet, no framework
   --------------------------------------------------------------- */

:root {
  --bg:        #0e0d15;
  --bg-raised: #16151f;
  --bg-inset:  #1d1c28;
  --line:      #2a2838;
  --text:      #e8e6f0;
  --muted:     #9490ab;
  --accent:    #8b7cf6;
  --accent-dim:#6d5ce0;
  --cat:       #ffb26b;
  --radius:    14px;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  /* faint grid so the page isn't a flat slab of colour */
  background-image:
    radial-gradient(circle at 15% -10%, rgba(139,124,246,.16), transparent 45%),
    radial-gradient(circle at 90% 0%, rgba(255,178,107,.08), transparent 40%);
  background-repeat: no-repeat;
}

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

h1, h2, h3 { line-height: 1.2; letter-spacing: -.02em; }

.muted { color: var(--muted); }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #fff; padding: .6rem 1rem; z-index: 100;
}
.skip:focus { left: 0; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding: .85rem clamp(1rem, 5vw, 4rem);
  background: rgba(14,13,21,.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand { font-family: var(--mono); font-weight: 600; color: var(--text); font-size: 1.02rem; }
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--accent); }
.brand-name { color: var(--text); }
.caret {
  display: inline-block; width: .55ch; height: 1.05em; margin-left: .3ch;
  background: var(--cat); vertical-align: -.18em;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.nav nav { display: flex; gap: clamp(.6rem, 2vw, 1.6rem); flex-wrap: wrap; }
.nav nav a {
  font-family: var(--mono); font-size: .88rem; color: var(--muted);
  padding: .25rem 0; border-bottom: 1px solid transparent;
}
.nav nav a:hover { color: var(--text); border-bottom-color: var(--accent); text-decoration: none; }

/* ---------- layout ---------- */
main { max-width: 1080px; margin: 0 auto; padding: 0 clamp(1rem, 5vw, 2rem); }

.panel { padding: clamp(3rem, 7vw, 5rem) 0; border-top: 1px solid var(--line); }

.panel h2 {
  font-family: var(--mono);
  font-size: clamp(1.35rem, 3vw, 1.7rem);
  margin: 0 0 .4rem;
}
.hash { color: var(--accent); }

.section-note { color: var(--muted); margin: 0 0 2rem; max-width: 62ch; }

/* ---------- hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.35fr .9fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
  padding: clamp(3rem, 9vw, 6rem) 0 clamp(2.5rem, 6vw, 4rem);
}

.eyebrow {
  font-family: var(--mono); font-size: .82rem; letter-spacing: .06em;
  text-transform: uppercase; color: var(--cat); margin: 0 0 .9rem;
}

.hero h1 {
  font-size: clamp(2.6rem, 8vw, 4.4rem);
  margin: 0 0 1rem;
  background: linear-gradient(120deg, #fff 20%, var(--accent) 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.tagline { font-size: clamp(1rem, 2.2vw, 1.15rem); color: #c9c5dd; max-width: 54ch; margin: 0 0 2rem; }

.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 2.5rem; }

.btn {
  display: inline-block;
  font-family: var(--mono); font-size: .9rem; font-weight: 500;
  padding: .65rem 1.25rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg-raised); color: var(--text);
  cursor: pointer; transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.btn:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #14121f; font-weight: 600; }
.btn.primary:hover { background: var(--accent-dim); border-color: var(--accent-dim); color: #fff; }
.btn.tiny { padding: .35rem .8rem; font-size: .8rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.stats { display: flex; gap: clamp(1.2rem, 4vw, 2.5rem); margin: 0; flex-wrap: wrap; }
.stats div { margin: 0; }
.stats dt { font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.stats dd { margin: .2rem 0 0; font-weight: 600; font-size: 1.02rem; }

/* hero cat */
.hero-cat { margin: 0; }
.cat-frame {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-inset);
  box-shadow: 0 24px 60px -30px rgba(139,124,246,.55);
}
.cat-frame img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  opacity: 0; transition: opacity .45s ease;
}
.cat-frame img.loaded { opacity: 1; }

.cat-loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  font-family: var(--mono); font-size: .85rem; color: var(--muted);
}
.cat-loading[hidden] { display: none; }

.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hero-cat figcaption {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  margin-top: .9rem; font-size: .82rem;
}

/* ---------- about ---------- */
.about-grid { display: grid; grid-template-columns: 1.25fr .85fr; gap: clamp(1.5rem, 4vw, 3rem); margin-top: 1.5rem; }
.about-grid p { margin: 0 0 1.1rem; color: #c9c5dd; }
.about-grid strong { color: var(--text); }

.timeline { list-style: none; margin: 0; padding: 0 0 0 1.25rem; border-left: 1px solid var(--line); }
.timeline li { position: relative; padding: 0 0 1.4rem .25rem; }
.timeline li:last-child { padding-bottom: 0; }
.dot {
  position: absolute; left: -1.62rem; top: .55rem;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px rgba(139,124,246,.15);
}
.timeline strong { display: block; font-family: var(--mono); font-size: .82rem; color: var(--cat); text-transform: lowercase; }
.timeline em { font-style: normal; color: var(--muted); font-size: .93rem; }

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

.card {
  display: flex; flex-direction: column;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-4px); border-color: var(--accent); }

.card-thumb { position: relative; aspect-ratio: 16/9; background: var(--bg-inset); overflow: hidden; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .4s ease; }
.card-thumb img.loaded { opacity: .82; }
.card:hover .card-thumb img.loaded { opacity: 1; }

.card-lang {
  position: absolute; top: .6rem; left: .6rem;
  font-family: var(--mono); font-size: .7rem; font-weight: 600;
  padding: .2rem .55rem; border-radius: 999px;
  background: rgba(14,13,21,.92); color: var(--cat);
  border: 1px solid rgba(255,178,107,.25);
  backdrop-filter: blur(6px);
}

.card-body { padding: 1.1rem 1.15rem 1.25rem; display: flex; flex-direction: column; flex: 1; }
.card-body h3 { margin: 0 0 .45rem; font-size: 1.05rem; font-family: var(--mono); }
.card-body h3 a { color: var(--text); }
.card-body h3 a:hover { color: var(--accent); text-decoration: none; }
.card-body p { margin: 0 0 1rem; font-size: .92rem; color: var(--muted); flex: 1; }

.card-link { font-family: var(--mono); font-size: .82rem; color: var(--accent); align-self: flex-start; }

/* ---------- stack ---------- */
.stack-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; margin-top: 1.5rem; }
.stack-col h3 { font-family: var(--mono); font-size: .88rem; color: var(--cat); text-transform: lowercase; margin: 0 0 .8rem; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; }
.tags li {
  font-family: var(--mono); font-size: .8rem;
  padding: .3rem .7rem; border-radius: 8px;
  background: var(--bg-inset); border: 1px solid var(--line); color: #c9c5dd;
}

/* ---------- cat section ---------- */
.cat-controls { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.status {
  font-family: var(--mono); font-size: .82rem; color: var(--muted);
  padding: .3rem .7rem; border-radius: 8px; background: var(--bg-inset); border: 1px solid var(--line);
}
.status[data-state="ok"]    { color: #7ee2b8; border-color: rgba(126,226,184,.35); }
.status[data-state="error"] { color: #ff8b8b; border-color: rgba(255,139,139,.35); }
.status[data-state="loading"] { color: var(--cat); border-color: rgba(255,178,107,.35); }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .9rem; }
.cat-tile {
  position: relative; aspect-ratio: 1;
  border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; background: var(--bg-inset);
}
.cat-tile img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .4s ease, transform .3s ease; }
.cat-tile img.loaded { opacity: 1; }
.cat-tile:hover img.loaded { transform: scale(1.06); }

.cat-tile.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(139,124,246,.12) 50%, transparent 80%);
  background-size: 220% 100%;
  animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer { to { background-position: -220% 0; } }

.cat-empty {
  grid-column: 1 / -1;
  font-family: var(--mono); font-size: .88rem; color: var(--muted);
  padding: 2rem; text-align: center;
  border: 1px dashed var(--line); border-radius: 12px;
}

/* ---------- contact + footer ---------- */
.contact p { max-width: 58ch; color: #c9c5dd; margin: .5rem 0 1.75rem; }
.contact-links { display: flex; gap: .75rem; flex-wrap: wrap; }

footer {
  max-width: 1080px; margin: 0 auto;
  padding: 2.5rem clamp(1rem, 5vw, 2rem) 3.5rem;
  border-top: 1px solid var(--line);
  font-size: .86rem;
}
footer p { margin: 0 0 .4rem; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero-cat { max-width: 340px; }
  .about-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .nav { flex-direction: column; align-items: flex-start; gap: .5rem; }
  html { scroll-padding-top: 120px; }
  .stats { gap: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
