/* jacob rampino, personal site
   light = garden, dark = canopy terminal
   nav swaps with theme: binder tabs (light), ls listing (dark) */

:root {
  --paper: #a7b68b;
  --paper-raised: #93ad76;
  --ink: #25301e;
  --ink-soft: #25301e;
  --ink-muted: #3d4a30;
  --ink-faint: #5a6b4c;
  --rule: #75925a;
  --accent: #4a6636;
  --accent-2: #93ad76;
  --accent-tab: #25301e;
  --highlight: #93ad76;

  --display: "Spectral", Georgia, serif;
  --body: "IBM Plex Sans", -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  --max: 880px;
  --edge: 6vw;

  color-scheme: light;
}

html[data-theme="dark"] {
  --paper: #12211a;
  --paper-raised: #182a1f;
  --ink: #eaf3e6;
  --ink-soft: #eaf3e6;
  --ink-muted: #7fdca4;
  --ink-faint: #6f8a7a;
  --rule: #2c4536;
  --accent: #7fdca4;
  --accent-2: #3e6650;
  --accent-tab: #7fdca4;
  --highlight: #7fdca4;

  color-scheme: dark;
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s, color 0.2s;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  height: 3.25rem;
  padding: 0 var(--edge);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
  overflow: visible;
}

.nav { flex: 1; overflow-x: auto; }

.nav-compass {
  display: flex;
  align-items: center;
  position: relative;
  overflow: visible;
}
html[data-theme="dark"] .nav-compass { display: none; }

.compass-toggle {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.compass-needle {
  transform-origin: 12px 12px;
  transform: rotate(var(--bearing));
  transition: transform 0.3s ease;
}

.compass-needle.jiggle {
  animation: needle-settle 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes needle-settle {
  0% { transform: rotate(calc(var(--bearing) - 30deg)); }
  60% { transform: rotate(calc(var(--bearing) + 10deg)); }
  100% { transform: rotate(var(--bearing)); }
}

.compass-listing[hidden] { display: none; }

/* desktop: pins open inline, to the right of the compass */
.compass-listing { margin-left: 1rem; }

.pin-list {
  list-style: none;
  display: flex;
  gap: 1rem;
  margin: 0;
  padding: 0;
  line-height: 1;
}

.pin-entry {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  text-decoration: none;
  color: var(--ink-faint);
  white-space: nowrap;
  transition: color 0.15s;
}

.pin-icon { flex-shrink: 0; transition: fill 0.15s, stroke 0.15s; }

.pin-label {
  font-family: var(--mono);
  font-size: 0.78rem;
}

.pin-entry:hover,
.pin-entry:focus-visible { color: var(--ink); }

.pin-entry.is-active .pin-label {
  color: var(--accent);
  font-weight: 500;
}

/* mobile: pins become a dropdown styled like a small map */
@media (max-width: 640px) {
  .compass-listing {
    position: absolute;
    top: 100%;
    left: 0;
    margin-left: 0;
    margin-top: 8px;
    background: var(--paper-raised);
    border: 1px solid var(--rule);
    border-radius: 8px;
    padding: 0.8rem 0.9rem;
    z-index: 50;
    min-width: 150px;
  }

  .pin-list {
    flex-direction: column;
    gap: 0.65rem;
  }

  .pin-list li:nth-child(2) { margin-left: 12px; }
  .pin-list li:nth-child(3) { margin-left: 24px; }
  .pin-list li:nth-child(4) { margin-left: 12px; }
  .pin-list li:nth-child(5) { margin-left: 0; }
}

.nav-dir { display: none; }
html[data-theme="dark"] .nav-dir {
  display: flex;
  align-items: center;
  position: relative;
  font-family: var(--mono);
  overflow: visible;
}

.dir-toggle {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: var(--mono);
  line-height: 1;
}

.dir-prompt {
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin: 0;
  white-space: nowrap;
}

.dir-toggle-label {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dir-listing[hidden] { display: none; }

/* desktop: listing opens inline, to the right of the toggle */
.dir-listing {
  margin-left: 0.9rem;
}

.dir-list {
  list-style: none;
  display: flex;
  gap: 0.9rem;
  margin: 0;
  padding: 0;
  line-height: 1;
}

.dir-entry {
  font-size: 0.8rem;
  text-decoration: none;
  color: var(--ink-faint);
  white-space: nowrap;
  transition: color 0.15s;
}

.dir-index { opacity: 0.55; margin-right: 0.15em; }
.dir-ext { opacity: 0.55; }

.dir-entry:hover,
.dir-entry:focus-visible { color: var(--ink); }

.dir-entry.is-active { color: var(--accent); }
.dir-cursor { color: var(--accent); }

.dir-branch { display: none; }

/* mobile: listing becomes a dropdown, styled like a repo file tree */
@media (max-width: 640px) {
  .dir-listing {
    position: absolute;
    top: 100%;
    left: 0;
    margin-left: 0;
    margin-top: 8px;
    background: var(--paper-raised);
    border: 1px solid var(--rule);
    border-radius: 6px;
    padding: 0.6rem 0.9rem;
    z-index: 50;
    min-width: 160px;
  }

  .dir-list {
    flex-direction: column;
    gap: 0.45rem;
  }

  .dir-list li {
    display: flex;
    align-items: center;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .dir-list li.is-visible { max-height: 26px; }

  .dir-branch {
    display: inline-block;
    color: var(--ink-faint);
    opacity: 0.6;
    white-space: pre;
  }
}

.theme-toggle {
  flex-shrink: 0;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
}

.toggle-track {
  display: block;
  width: 46px;
  height: 24px;
  border-radius: 12px;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  position: relative;
  transition: background 0.2s, border-color 0.2s;
}

.toggle-glyph {
  position: absolute;
  top: 50%;
  width: 13px;
  height: 13px;
  color: var(--ink);
  transform: translateY(-50%);
  z-index: 1;
  opacity: 0.85;
  filter:
    drop-shadow(0.5px 0.5px 0px rgba(255, 255, 255, 0.3))
    drop-shadow(-0.4px -0.4px 0px rgba(0, 0, 0, 0.25));
}
.glyph-leaf { left: 4px; }
.glyph-term { right: 4px; }

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(155deg, var(--paper) 0%, var(--paper-raised) 100%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--rule) inset;
  z-index: 2;
  transition: transform 0.2s;
}

html[data-theme="dark"] .toggle-thumb {
  transform: translateX(22px);
}

/* page shell: content column + full-height photo column, only when a photo exists */
.page-shell {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
}
.page-shell:has(.page-photo) {
  grid-template-columns: 1fr 30%;
}

.page-content { min-width: 0; }

.page-photo {
  position: relative;
  overflow: hidden;
  border-left: 1px solid var(--rule);
}
.page-photo img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  position: absolute; inset: 0;
}
.hero-photo-dark { opacity: 0; }
html[data-theme="dark"] .hero-photo-light { opacity: 0; }
html[data-theme="dark"] .hero-photo-dark { opacity: 1; }

.stress-chart {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  border-radius: 4px;
}
.stress-chart-dark { display: none; }
html[data-theme="dark"] .stress-chart-light { display: none; }
html[data-theme="dark"] .stress-chart-dark { display: block; }

@media (max-width: 900px) {
  .page-shell:has(.page-photo) { grid-template-columns: 1fr; }
  .page-photo {
    border-left: none;
    border-top: 1px solid var(--rule);
    aspect-ratio: 4 / 3;
  }
}

main { max-width: var(--max); margin: 0 auto; }

.hero {
  padding: 4.5rem var(--edge) 4rem;
}
.page-shell:not(:has(.page-photo)) .hero {
  padding-bottom: 0;
}

@media (max-width: 720px) {
  .hero { padding: 3.5rem var(--edge) 3rem; }
  .page-shell:not(:has(.page-photo)) .hero {
    padding-bottom: 0;
  }
}

.hero-eyebrow {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  margin: 0 0 1.1rem;
}

.hero-name {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1.08;
  margin: 0 0 1.1rem;
  letter-spacing: -0.01em;
}

.hero-role {
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(1.15rem, 2.6vw, 1.4rem);
  color: var(--ink-muted);
  margin: 0 0 1.6rem;
}

.hero-desc {
  max-width: 56ch;
  font-size: 1.04rem;
  color: var(--ink-muted);
  margin: 0 0 2rem;
}

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

.tag {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-muted);
  border: 1px solid var(--rule);
  padding: 0.3rem 0.6rem;
  border-radius: 2px;
  background: var(--paper-raised);
}

.mark {
  position: relative;
  white-space: nowrap;
  padding: 0 0.1em;
}
.mark::before {
  content: "";
  position: absolute;
  left: -0.08em; right: -0.08em; bottom: 0.05em; top: 0.12em;
  z-index: -1;
  transform: skew(-3deg, -0.5deg);
  border-radius: 1px;
  background: var(--highlight);
  opacity: 0.5;
}

.mark-block {
  position: relative;
  padding: 0.9em 1.1em;
}
.mark-block::before {
  content: "";
  position: absolute;
  left: -0.3em; right: -0.3em; bottom: -0.1em; top: -0.1em;
  z-index: -1;
  transform: skew(-3deg, -0.5deg);
  border-radius: 2px;
  background: var(--highlight);
  opacity: 0.5;
}

.term-link {
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.term-link:hover {
  color: var(--ink);
  border-bottom: 1px solid var(--ink-faint);
}

.section { padding: 3.2rem var(--edge); border-top: 1px solid var(--rule); }
.page-shell:not(:has(.page-photo)) .section:first-of-type {
  padding-top: 2.8rem;
}

.section-label {
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  margin: 0 0 0.6rem;
}

.section-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.6rem, 3.4vw, 2.1rem);
  margin: 0 0 1.6rem;
}

.prose p { max-width: 62ch; color: var(--ink-muted); margin: 0 0 1rem; }
.prose em { color: var(--ink); font-style: italic; }

.inline-link {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 2px;
}

.org-group { margin: 0 0 2.4rem; }
.org-group:last-child { margin-bottom: 0; }

.org-title {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  margin: 0 0 0.9rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--rule);
}

.clip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.1rem;
}

.clip-card {
  display: block;
  text-decoration: none;
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
  background: var(--paper-raised);
  transition: border-color 0.15s;
}
.clip-card:hover,
.clip-card:focus-visible { border-color: var(--accent); }

.clip-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--rule);
  overflow: hidden;
}
.clip-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }

.clip-thumb--glass::after {
  content: "";
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--paper) 1%, transparent);
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
}

.clip-body { padding: 0.8rem 0.9rem; }

.clip-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: 0.98rem;
  color: var(--ink);
  margin: 0 0 0.25rem;
  line-height: 1.3;
}

.clip-date {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--ink-muted);
  margin: 0 0 0.35rem;
}

.clip-desc {
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin: 0;
  line-height: 1.45;
}

.site-footer {
  text-align: center;
  padding: 2rem var(--edge) 3rem;
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--ink-faint);
}

.footer-icons {
  display: flex;
  justify-content: center;
  gap: 0.9rem;
}

.footer-icon {
  display: flex;
  width: 20px;
  height: 20px;
  color: var(--ink-faint);
  transition: color 0.15s, transform 0.15s;
}
.footer-icon svg { width: 100%; height: 100%; }

.footer-icon:hover,
.footer-icon:focus-visible {
  color: var(--accent);
  transform: translateY(-1px);
}

a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.contact-list {
  display: flex;
  flex-direction: column;
  max-width: 56ch;
}

.contact-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: var(--ink);
  transition: color 0.15s;
}

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

.contact-label {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.contact-value {
  font-family: var(--mono);
  font-size: 0.92rem;
  color: var(--ink);
  text-align: right;
  word-break: break-all;
  transition: color 0.15s;
}

.contact-row:hover .contact-value,
.contact-row:focus-visible .contact-value {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent);
}

@media (max-width: 480px) {
  .contact-row { flex-direction: column; gap: 0.3rem; }
  .contact-value { text-align: left; }
}

@media (max-width: 640px) {
  .site-header { flex-wrap: wrap; }
}