/* ============================================================
   Raymond Torres — portfolio site
   Minimal, text-first, documentation-style layout.
   ============================================================ */

:root {
  /* dark is the default look, independent of OS preference */
  --bg: #0a0b0d;
  --bg-alt: #16181d;
  --text: #f1f2f4;
  --text-muted: #8b9099;
  --border: #24262c;
  --accent: #5b8cff;
  --accent-hover: #85a8ff;
  --code-bg: #16181d;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --max-width: 1040px;
  --content-width: 700px;
  --sidebar-width: 200px;

  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #ffffff;
  --bg-alt: #f6f7f8;
  --text: #1a1d21;
  --text-muted: #5a6169;
  --border: #e3e5e8;
  --accent: #2f5fd8;
  --accent-hover: #1e46ad;
  --code-bg: #f0f2f4;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

img {
  max-width: 100%;
}

/* ---------- header ---------- */

.site-header {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 20;
}

.site-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  gap: 16px;
}

.site-brand {
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

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

.primary-nav {
  display: flex;
  gap: 4px;
  flex: 1;
  margin-left: 8px;
}

.primary-nav a {
  color: var(--text-muted);
  font-size: 0.92rem;
  padding: 8px 10px;
  border-radius: 0;
}

.primary-nav a:hover {
  color: var(--text);
  background: var(--bg-alt);
  text-decoration: none;
}

.primary-nav a[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 0;
  color: var(--text-muted);
}

.icon-link:hover {
  color: var(--text);
  background: var(--bg-alt);
  text-decoration: none;
}

.icon-link img {
  display: block;
  width: 20px;
  height: 20px;
}

.icon-link .li-standard {
  display: none;
}

[data-theme="light"] .icon-link .li-standard {
  display: block;
}
[data-theme="light"] .icon-link .li-dark {
  display: none;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--bg-alt);
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
}

.theme-toggle .icon-sun {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-moon {
  display: none;
}
[data-theme="light"] .theme-toggle .icon-sun {
  display: inline-flex;
}

.nav-toggle {
  display: none;
  border: none;
  background: transparent;
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 0;
  cursor: pointer;
}

.nav-toggle svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* ---------- neural background ---------- */

.neural-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ---------- layout ---------- */

.page {
  position: relative;
  z-index: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px 80px;
  display: flex;
  gap: 56px;
  align-items: flex-start;
}

.page.no-sidebar {
  display: block;
}

.page.no-sidebar .content {
  max-width: var(--content-width);
}

.toc {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: 80px;
}

.toc-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 10px;
  font-weight: 600;
}

.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid var(--border);
}

.toc li a {
  display: block;
  padding: 5px 0 5px 14px;
  margin-left: -2px;
  border-left: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.toc li a:hover {
  color: var(--text);
  text-decoration: none;
}

.toc li a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

.content {
  max-width: var(--content-width);
  min-width: 0;
}

/* ---------- typography ---------- */

.content h1 {
  font-size: 2.1rem;
  font-weight: 800;
  margin: 0 0 6px;
  letter-spacing: -0.03em;
}

.identity-line {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
  margin: 0 0 10px;
}

.eyebrow {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0 0 32px;
}

.lede {
  font-size: 1.08rem;
  line-height: 1.7;
  color: var(--text);
  margin: 0 0 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.content section {
  margin: 0 0 44px;
  scroll-margin-top: 76px;
}

.content section:last-child {
  margin-bottom: 0;
}

.content h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 18px;
  letter-spacing: -0.02em;
}

.content h3 {
  font-size: 0.98rem;
  margin: 24px 0 4px;
  font-weight: 600;
}

.content h3 + .meta {
  margin-top: 0;
}

.content p {
  margin: 0 0 14px;
}

.meta {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin: 0 0 8px;
}

.content ul,
.content ol {
  padding-left: 20px;
  margin: 0 0 14px;
}

.content li {
  margin-bottom: 6px;
}

.entry {
  margin-bottom: 28px;
}

.entry:last-child {
  margin-bottom: 0;
}

/* ---------- timeline ---------- */

.timeline {
  --timeline-col: 92px;
  --timeline-gap: 24px;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: var(--timeline-col) 1fr;
  column-gap: var(--timeline-gap);
  padding-bottom: 30px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: calc(var(--timeline-col) + var(--timeline-gap) / 2 - 4px);
  top: 7px;
  width: 8px;
  height: 8px;
  background: var(--accent);
}

.timeline-item:not(:last-child)::after {
  content: "";
  position: absolute;
  left: calc(var(--timeline-col) + var(--timeline-gap) / 2 - 1px);
  top: 21px;
  bottom: -12px;
  width: 2px;
  background: var(--border);
}

.timeline-year {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  padding-top: 6px;
  white-space: nowrap;
}

.timeline-body h3 {
  margin: 0 0 4px;
}

.timeline-body p {
  margin: 0;
  color: var(--text-muted);
}

.skill-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px 32px;
}

.skill-group h3 {
  margin-top: 0;
}

.skill-group ul {
  padding-left: 0;
  list-style: none;
  margin: 0;
}

.skill-group li {
  color: var(--text-muted);
  font-size: 0.92rem;
  padding: 3px 0;
  border-bottom: 1px dotted var(--border);
}

.skill-group li:last-child {
  border-bottom: none;
}

.skill-group li strong {
  color: var(--text);
  font-weight: 500;
}

/* ---------- project entries ---------- */

.project {
  padding-bottom: 32px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 76px;
}

.project:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.project-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.project-title h2 {
  margin: 0;
}

.project-link {
  font-size: 0.85rem;
  font-family: var(--font-mono);
}

.project-summary {
  color: var(--text);
  font-weight: 500;
  margin: 0 0 12px;
}

.project-status {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 0;
  border: 1px solid var(--border);
  color: var(--text-muted);
  margin-bottom: 12px;
}

.project-status.is-active {
  border-color: var(--accent);
  color: var(--accent);
}

.kicker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
  margin: 0 0 8px;
}

/* ---------- contact page ---------- */

.contact-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

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

.contact-list li:first-child {
  padding-top: 0;
}

.contact-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.contact-value {
  font-size: 1.05rem;
  font-family: var(--font-mono);
}

/* ---------- footer ---------- */

.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

.site-footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ---------- duck easter egg ----------
   Hidden by default — type "duck" anywhere on the site to trigger it.
   Not part of the visible design; see script.js. */

.duck-mascot {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 44px;
  height: 44px;
  pointer-events: none;
  z-index: 15;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.duck-mascot.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.duck-mascot img {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  transform: scaleX(-1);
}

@media (max-width: 700px) {
  .duck-mascot {
    width: 36px;
    height: 36px;
    right: 12px;
    bottom: 12px;
  }
}

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .page {
    gap: 32px;
  }
  :root {
    --sidebar-width: 160px;
  }
}

@media (max-width: 700px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .primary-nav {
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    gap: 0;
    padding: 8px;
    display: none;
  }

  .primary-nav.open {
    display: flex;
  }

  .primary-nav a {
    padding: 10px 12px;
    border-radius: 0;
  }

  .page {
    flex-direction: column;
    padding: 28px 20px 60px;
    gap: 28px;
  }

  .toc {
    position: static;
    width: 100%;
    order: -1;
  }

  .toc ul {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    border-left: none;
    border-bottom: 1px solid var(--border);
    padding-bottom: 14px;
  }

  .toc li a {
    border-left: none;
    border: 1px solid var(--border);
    border-radius: 0;
    padding: 5px 12px;
    margin-left: 0;
  }

  .toc li a.active {
    border-color: var(--accent);
  }

  .skill-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .content h1 {
    font-size: 1.75rem;
  }
}

@media (max-width: 420px) {
  .site-brand {
    font-size: 0.9rem;
  }
}
