/* =============================================================================
   Daniel Alfasi - Midnight Lab + quiet hacker edge
   Accent: electric cyan / teal
   ============================================================================= */

:root {
  /* Surfaces */
  --bg: #0b1220;
  --bg-elevated: #111b2e;
  --bg-card: #0f1830;
  --bg-hover: #15203a;

  /* Text */
  --text: #e8eef7;
  --text-muted: #93a4bc;
  --text-faint: #64748b;

  /* Accent - electric cyan/teal */
  --accent: #2dd4bf;
  --accent-dim: rgba(45, 212, 191, 0.14);
  --accent-glow: rgba(45, 212, 191, 0.28);
  --accent-strong: #5eead4;

  /* Lines & feedback */
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.28);
  --danger: #f87171;
  --warn: #fbbf24;

  /* Type */
  --font-sans: "Inter", "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Layout */
  --max: 720px;
  --max-wide: 960px;
  --nav-h: 64px;
  --radius: 12px;
  --radius-sm: 8px;

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Subtle lab grid - almost invisible, sets the mood */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(45, 212, 191, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45, 212, 191, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 20%, transparent 75%);
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--accent-strong); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
p { margin: 0 0 1.15em; }
p:last-child { margin-bottom: 0; }
h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 0.6em;
}
h1 { font-size: clamp(2rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.35rem, 2.5vw, 1.65rem); }
h3 { font-size: 1.15rem; }
ul, ol { padding-left: 1.25em; margin: 0 0 1.15em; }
li { margin-bottom: 0.35em; }
code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
}
code {
  background: var(--accent-dim);
  color: var(--accent-strong);
  padding: 0.12em 0.4em;
  border-radius: 4px;
}
pre {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.15rem;
  overflow-x: auto;
  margin: 0 0 1.25em;
}
pre code {
  background: none;
  color: inherit;
  padding: 0;
}
blockquote {
  margin: 0 0 1.25em;
  padding: 0.15em 0 0.15em 1em;
  border-left: 2px solid var(--accent);
  color: var(--text-muted);
}
hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* Layout shell ------------------------------------------------------------ */
.site {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.wrap {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}

.wrap--wide {
  width: min(100% - 2rem, var(--max-wide));
}

main {
  flex: 1;
  padding: 2.5rem 0 4rem;
}

/* Nav --------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  border-bottom: 1px solid var(--border);
  background: rgba(11, 18, 32, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.nav {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.02em;
}

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

.nav-brand__mark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim), 0 0 18px var(--accent-glow);
}

.nav-brand__name { font-size: 0.98rem; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  display: inline-block;
  padding: 0.4rem 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  border-radius: 6px;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--text);
  background: var(--accent-dim);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  cursor: pointer;
}

/* Mono labels / terminal crumbs ------------------------------------------ */
.mono-label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.75rem;
}

.mono-label::before {
  content: "// ";
  opacity: 0.7;
}

.prompt {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-faint);
  margin: 0 0 0.5rem;
}

.prompt span { color: var(--accent); }

/* Hero -------------------------------------------------------------------- */
.hero {
  padding: 1.5rem 0 2.5rem;
}

.hero__grid {
  display: grid;
  gap: 2rem;
  align-items: start;
}

@media (min-width: 760px) {
  .hero__grid {
    grid-template-columns: 1fr auto;
    gap: 3rem;
    align-items: center;
  }
}

.hero__title {
  margin: 0 0 0.5rem;
  font-size: clamp(2.15rem, 5vw, 3rem);
  letter-spacing: -0.03em;
}

.hero__role {
  margin: 0 0 1.25rem;
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 450;
}

.hero__role a {
  color: var(--accent-strong);
  text-decoration: none;
  border-bottom: 1px solid rgba(45, 212, 191, 0.35);
}

.hero__role a:hover {
  border-bottom-color: var(--accent);
}

.hero__lede {
  margin: 0 0 1.5rem;
  max-width: 42ch;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.75;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hero__aside {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.hero__photo {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-strong);
  box-shadow: 0 0 0 6px var(--accent-dim);
}

.hero__social {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.hero__social a {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
}

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

@media (min-width: 760px) {
  .hero__photo {
    width: 148px;
    height: 148px;
  }
}

/* Buttons ----------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 560;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease), transform 0.15s var(--ease);
  cursor: pointer;
}

.btn:hover { transform: translateY(-1px); }

.btn--primary {
  background: var(--accent);
  color: #042f2e;
}

.btn--primary:hover {
  background: var(--accent-strong);
  color: #042f2e;
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.btn--ghost:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--text);
}

/* Sections ---------------------------------------------------------------- */
.section {
  padding: 2.25rem 0;
}

.section + .section {
  border-top: 1px solid var(--border);
}

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.section__head h2 {
  margin: 0;
  font-size: 1.35rem;
}

.section__more {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
}

.section__more:hover { color: var(--accent); }

/* Cards ------------------------------------------------------------------- */
.card-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 700px) {
  .card-grid--2 {
    grid-template-columns: 1fr 1fr;
  }
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease), transform 0.18s var(--ease);
}

a.card:hover {
  border-color: rgba(45, 212, 191, 0.4);
  background: var(--bg-hover);
  transform: translateY(-2px);
  color: inherit;
}

.card__media {
  aspect-ratio: 16 / 9;
  background: var(--bg-elevated);
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card__body {
  padding: 1.15rem 1.2rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1;
}

.card__meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

.card__meta .tag {
  color: var(--accent);
}

.card__title {
  margin: 0;
  font-size: 1.08rem;
  letter-spacing: -0.015em;
}

.card__excerpt {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  flex: 1;
}

.card__footer {
  margin-top: 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
}

/* Post list (blog index / home writing) ----------------------------------- */
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.post-list__item a {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.2rem;
  padding: 1rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}

@media (min-width: 640px) {
  .post-list__item a {
    grid-template-columns: 7.5rem 1fr auto;
    align-items: baseline;
    gap: 1.25rem;
  }
}

.post-list__item a:hover {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: inherit;
}

.post-list__date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-faint);
}

.post-list__title {
  font-weight: 560;
  color: var(--text);
}

.post-list__tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
}

/* Page header (inner pages) ----------------------------------------------- */
.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.page-header h1 { margin-bottom: 0.4rem; }

.page-header p {
  margin: 0;
  color: var(--text-muted);
  max-width: 52ch;
}

/* Prose (blog / about) ---------------------------------------------------- */
.prose {
  max-width: 68ch;
}

.prose > * + * { margin-top: 1.1em; }

.prose h2 {
  margin-top: 2.25em;
  margin-bottom: 0.55em;
  padding-top: 0.4em;
}

.prose h3 {
  margin-top: 1.75em;
  margin-bottom: 0.45em;
}

.prose img {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin: 1.5em 0;
}

.prose figure {
  margin: 1.75em 0;
}

.prose figcaption {
  margin-top: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  line-height: 1.5;
}

.prose figcaption a { color: var(--text-muted); }

.prose a { word-break: break-word; }

/* Post meta --------------------------------------------------------------- */
.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-faint);
  margin-bottom: 1.75rem;
}

.post-meta .tag {
  color: var(--accent);
}

.post-hero {
  margin: 0 0 2rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.post-hero img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.post-source {
  margin: 2.5rem 0 0;
  padding: 1rem 1.15rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--text-muted);
}

.post-source strong {
  color: var(--text);
  font-weight: 560;
}

/* Talks ------------------------------------------------------------------- */
.talk {
  padding: 1.35rem 0;
  border-bottom: 1px solid var(--border);
}

.talk:first-of-type { padding-top: 0; }
.talk:last-of-type { border-bottom: 0; }

.talk__meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-bottom: 0.4rem;
}

.talk__title {
  margin: 0 0 0.45rem;
  font-size: 1.15rem;
}

.talk__desc {
  margin: 0 0 0.85rem;
  color: var(--text-muted);
  font-size: 0.98rem;
}

.talk__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.talk__links a {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-decoration: none;
  color: var(--accent);
}

.talk__links a:hover { color: var(--accent-strong); }

/* About chips ------------------------------------------------------------- */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 0;
}

.chip {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
}

/* Footer ------------------------------------------------------------------ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.75rem 0 2.25rem;
  color: var(--text-faint);
  font-size: 0.88rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.15rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.footer-links a:hover { color: var(--accent); }

.footer-copy {
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

/* Empty / placeholder state ----------------------------------------------- */
.empty {
  padding: 1.5rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Mobile nav -------------------------------------------------------------- */
@media (max-width: 640px) {
  .nav-toggle { display: inline-flex; }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem;
    background: rgba(11, 18, 32, 0.97);
    border-bottom: 1px solid var(--border);
  }

  .nav-links.is-open { display: flex; }

  .nav-links a {
    padding: 0.85rem 1rem;
  }
}

/* Focus visibility -------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Selection --------------------------------------------------------------- */
::selection {
  background: var(--accent-dim);
  color: var(--text);
}
