/* User Provided Stylesheet */

/*
 * Theme overrides for the echoes-portfolio MyST site.
 *
 * Organized in layers:
 *   1. Design tokens   (:root / html.dark)
 *   2. Typography      (headings, body, mono)
 *   3. Chrome          (cards, admonitions, tables, footer)
 *   4. Landing hero    (index page hero section — the distinctive bit)
 *   5. Responsive      (mobile breakpoints)
 *
 * Keep this file under ~300 lines. Anything bigger is a signal to fork
 * the theme instead.
 */

/* ─────────────────────────────────────────────────────────────────
 * 1. Design tokens
 * ───────────────────────────────────────────────────────────────── */

:root {
  --myst-color-primary: #8e5a3a;
  --myst-color-primary-hover: #6d4528;
  --myst-color-link: #8e5a3a;
  --myst-color-link-hover: #6d4528;

  --myst-color-background: #fcfaf7;
  --myst-color-background-secondary: #f6f1ea;
  --myst-color-text: #1c1917;
  --myst-color-text-muted: #57534e;

  --myst-font-family-heading:
    "Source Serif 4", "Spectral", "Charter", Georgia, serif;
  --myst-font-family-body:
    "Inter", "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
  --myst-font-family-mono:
    "Menlo", "JetBrains Mono", "SF Mono", "Fira Code", monospace;

  --portfolio-hero-accent: #8e5a3a;
  --portfolio-hero-bg: #f6f1ea;
  --portfolio-hero-shadow: 0 2px 24px rgba(50, 30, 15, 0.08);
}

html.dark {
  --myst-color-primary: #d9a67a;
  --myst-color-primary-hover: #e7bd96;
  --myst-color-link: #d9a67a;
  --myst-color-link-hover: #e7bd96;

  --myst-color-background: #1a1816;
  --myst-color-background-secondary: #242220;
  --myst-color-text: #f5f4f1;
  --myst-color-text-muted: #b4afa8;

  --portfolio-hero-accent: #d9a67a;
  --portfolio-hero-bg: #242220;
  --portfolio-hero-shadow: 0 2px 24px rgba(0, 0, 0, 0.4);
}

/* ─────────────────────────────────────────────────────────────────
 * 2. Typography
 * ───────────────────────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6,
.myst-heading {
  font-family: var(--myst-font-family-heading);
  letter-spacing: -0.015em;
}

article h2 { margin-top: 2.25rem; }
article h3 { margin-top: 1.75rem; }

/* ─────────────────────────────────────────────────────────────────
 * 3. Chrome — cards, admonitions, tables, footer
 * ───────────────────────────────────────────────────────────────── */

.myst-card,
.card {
  border-radius: 8px;
  border: 1px solid rgba(140, 90, 58, 0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.myst-card:hover,
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(30, 20, 10, 0.08);
  border-color: rgba(140, 90, 58, 0.28);
}
html.dark .myst-card,
html.dark .card {
  border-color: rgba(217, 166, 122, 0.15);
}
html.dark .myst-card:hover,
html.dark .card:hover {
  border-color: rgba(217, 166, 122, 0.35);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.admonition {
  border-left-width: 3px;
  border-radius: 4px;
  background: var(--myst-color-background-secondary);
}

pre code, .highlight pre {
  font-size: 0.92em;
  line-height: 1.5;
}

table {
  font-size: 0.95em;
}
table th {
  font-family: var(--myst-font-family-heading);
  font-weight: 600;
}

footer {
  font-size: 0.875rem;
  opacity: 0.8;
}

/* ─────────────────────────────────────────────────────────────────
 * 4. Landing hero
 * ───────────────────────────────────────────────────────────────── */

/* On hero pages, suppress the chrome the book-theme renders ABOVE the
   hero. We provide our own title typography inside the hero, so the
   auto-rendered frontmatter block (title + license badge + byline) is
   pure duplication. The Outline panel is also hidden — short page, the
   hero CTAs are the navigation. */
article:has(.hero) > .myst-fm-block,
article:has(.hero) > header,
article:has(.hero) .myst-title-block,
article:has(.hero) .myst-fm-block-title,
article:has(.hero) .myst-outline,
article:has(.hero) > div:has(> .myst-outline),
article:has(.hero) > div:has([aria-label="Document Outline"]) {
  display: none !important;
}

/* Book-theme reserves a wide right gutter for the outline panel even
   when the panel itself is hidden. On hero pages we override the
   article grid: simple 3-track layout (1fr · centered content · 1fr)
   so the hero, selected work, and skills sit in the middle of the
   viewport instead of pinned to the left with a giant empty right
   gutter. Desktop only — book-theme's mobile layout is already
   single-column and works fine. */
@media (min-width: 1024px) {
  article:has(.hero) {
    grid-template-columns: 1fr min(1100px, calc(100% - 4rem)) 1fr !important;
  }
  article:has(.hero) > * {
    grid-column: 2 / 3 !important;
  }
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) 1fr;
  gap: 0;
  align-items: center;
  min-height: 80vh;
  padding: 2rem 0 3rem;
  margin: 0 0 1rem;
  position: relative;
}

/* Hero portrait. The image source already has soft-edge feathering on
   all four sides plus an aggressive right-side fade and a halftone-dot
   buildup baked in (see notes/make_extreme_rightfade.py). So this rule
   only needs to handle layout — no CSS mask. */
.hero-portrait-img,
picture.hero-portrait-img {
  display: block;
  width: 100%;
  margin: 0;
}

.hero-portrait-img img,
picture.hero-portrait-img img {
  display: block;
  width: 100%;
  height: auto;
  min-height: 70vh;
  max-height: 92vh;
  object-fit: cover;
  /* Tuned for static/oliver_green_hero.png. Face is centered
     horizontally, upper third vertically. Edge fades + right-side
     fade + halftone are all baked into the source image (see
     notes/make_extreme_rightfade.py). */
  object-position: center 30%;
  margin: 0 !important;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
}

.hero-text {
  /* Pull leftward so the text overlays the faded right side of the
     image — the "text appears out of the image" effect. */
  margin-left: -15%;
  padding: 1rem 0;
  position: relative;
  z-index: 2;
}

/* Book-theme demotes our markdown # to h2 (because frontmatter title
   is the semantic h1, which we hide). Style both the same. */
.hero-text h1,
.hero-text h2 {
  font-size: clamp(2.25rem, 4.5vw, 3.5rem);
  line-height: 1.05;
  margin: 0 0 0.5rem;
  letter-spacing: -0.025em;
  font-family: var(--myst-font-family-heading);
  padding: 0;
}

/* Hide the heading-anchor link (¶) inside the hero — distracting at
   display sizes, and the page is short enough that direct heading
   links aren't valuable here. */
.hero-text h1 > a,
.hero-text h2 > a,
.hero-text h1 .heading-link,
.hero-text h2 .heading-link {
  display: none !important;
}

.hero-text h3 {
  font-family: var(--myst-font-family-body);
  font-weight: 400;
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  color: var(--myst-color-text-muted);
  margin: 0 0 1.5rem;
  letter-spacing: 0;
}

.hero-text p {
  font-size: 1.05rem;
  line-height: 1.65;
  max-width: 60ch;
}

.hero-ctas {
  margin-top: 1.75rem;
  font-size: 1rem;
}
.hero-ctas a {
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.hero-ctas a:hover {
  color: var(--myst-color-link-hover);
  border-bottom-color: var(--myst-color-link-hover);
}

/* Contact row just under the "What I'm interested in" section. */
.contact-row {
  margin-top: 1rem;
  font-size: 0.98rem;
  color: var(--myst-color-text-muted);
}
.contact-row strong {
  color: var(--myst-color-text);
}

/* ─────────────────────────────────────────────────────────────────
 * 5. TRACE callout (home page — open-source spotlight)
 * ───────────────────────────────────────────────────────────────── */

.trace-callout {
  position: relative;
  margin: 2rem 0 2.5rem;
  padding: 1.75rem 2rem 1.5rem;
  border-radius: 12px;
  background: linear-gradient(
    135deg,
    var(--myst-color-background-secondary) 0%,
    var(--myst-color-background) 100%
  );
  border: 1px solid rgba(140, 90, 58, 0.18);
  border-left: 4px solid var(--portfolio-hero-accent);
  box-shadow: 0 2px 12px rgba(50, 30, 15, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.trace-callout:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(50, 30, 15, 0.09);
}
html.dark .trace-callout {
  border-color: rgba(217, 166, 122, 0.18);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}
html.dark .trace-callout:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.trace-callout-eyebrow > p,
.trace-callout-eyebrow {
  font-family: var(--myst-font-family-body);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--portfolio-hero-accent);
  margin: 0 0 0.5rem;
}

.trace-callout-title > p,
.trace-callout-title {
  font-family: var(--myst-font-family-heading);
  font-size: clamp(1.4rem, 2.5vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 0.75rem;
  color: var(--myst-color-text);
  line-height: 1.2;
}

.trace-callout-body > p,
.trace-callout-body {
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--myst-color-text);
  max-width: 65ch;
  margin: 0 0 1.25rem;
}

.trace-callout-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}
.trace-callout-actions p {
  margin: 0;
}

a.trace-callout-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  background: var(--myst-color-primary);
  color: #fcfaf7 !important;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none !important;
  border: 1px solid var(--myst-color-primary);
  transition: background 0.15s ease, border-color 0.15s ease,
              transform 0.15s ease, box-shadow 0.15s ease;
}
a.trace-callout-button:hover {
  background: var(--myst-color-primary-hover);
  border-color: var(--myst-color-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(140, 90, 58, 0.25);
}
html.dark a.trace-callout-button {
  color: #1a1816 !important;
}

a.trace-callout-button-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  color: var(--myst-color-primary) !important;
  background: transparent;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none !important;
  border: 1px solid rgba(140, 90, 58, 0.3);
  transition: border-color 0.15s ease, background 0.15s ease,
              transform 0.15s ease;
}
a.trace-callout-button-secondary:hover {
  border-color: var(--myst-color-primary);
  background: rgba(140, 90, 58, 0.06);
  transform: translateY(-1px);
}
html.dark a.trace-callout-button-secondary:hover {
  background: rgba(217, 166, 122, 0.08);
}

/* ─────────────────────────────────────────────────────────────────
 * 6. Diagrams: live Mermaid container + "View fullscreen" chip
 * ───────────────────────────────────────────────────────────────── */

/* MyST renders mermaid as <figure><div><svg id="mermaid-..."> with no
   class on the wrappers. We target the figure that contains a mermaid
   svg anywhere inside (not just as direct child). */
figure:has(svg[id^="mermaid"]) {
  /* Stable cream "paper" fill so Mermaid's default dark text and stroke
     lines stay readable in both light and dark modes. The SVG itself is
     transparent, so without a fixed light background under it the dark
     glyphs vanish on a dark page. */
  background: #fcfaf7;
  border: 1px solid rgba(140, 90, 58, 0.12);
  border-radius: 8px;
  padding: 1.25rem 1rem;
  margin: 1.5rem 0 0.25rem;
  overflow-x: auto;
  text-align: center;
}
figure:has(svg[id^="mermaid"]) svg {
  max-width: 100%;
  height: auto;
}
html.dark figure:has(svg[id^="mermaid"]) {
  /* Warm cream "paper inset" against the dark page: keeps Mermaid's
     dark glyphs visible and reads intentionally as a figure block,
     not a blinding white card. */
  background: #f0e8da;
  border-color: rgba(217, 166, 122, 0.25);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

/* "View fullscreen" affordance under each diagram. The link is
   wrapped in p.diagram-fullscreen-row by the raw-HTML embed. */
.diagram-fullscreen-row,
p:has(> a.diagram-fullscreen) {
  text-align: right;
  margin: 0.25rem 0 1.75rem;
}
a.diagram-fullscreen {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--myst-color-text-muted) !important;
  background: var(--myst-color-background-secondary);
  border: 1px solid rgba(140, 90, 58, 0.12);
  border-radius: 999px;
  text-decoration: none !important;
  transition: color 0.15s ease, border-color 0.15s ease,
              background 0.15s ease, transform 0.15s ease;
}
a.diagram-fullscreen:hover {
  color: var(--myst-color-primary) !important;
  border-color: rgba(140, 90, 58, 0.4);
  background: var(--myst-color-background);
  transform: translateY(-1px);
}
/* Suppress book-theme's auto-appended external-link / download icon
   on these pills — the trailing ↗ glyph in the label is the affordance. */
a.diagram-fullscreen > svg,
a.trace-callout-button > svg,
a.trace-callout-button-secondary > svg {
  display: none !important;
}
html.dark a.diagram-fullscreen {
  border-color: rgba(217, 166, 122, 0.18);
}
html.dark a.diagram-fullscreen:hover {
  border-color: rgba(217, 166, 122, 0.45);
}

/* ─────────────────────────────────────────────────────────────────
 * 7. Top nav: hamburger drawer at all widths
 *
 * The book-theme switches the top nav to inline text items at
 * lg (1024px+) and the hamburger disappears at xl (1280px+). At those
 * widths the .myst-primary-sidebar transitions from a hidden drawer
 * into a fixed full-width article-grid overlay marked
 * xl:pointer-events-none — but pointer-events:none does not cascade,
 * so the inner .myst-primary-sidebar-nav still intercepts clicks on
 * page content underneath. Visible symptom: nav text appearing to
 * "overlay" content, plus buttons (e.g. "Star on GitHub") refusing
 * to navigate because their click is captured by the invisible sheet.
 *
 * Fix: force the small-width hamburger-drawer pattern at every width.
 * ───────────────────────────────────────────────────────────────── */

/* Always show the hamburger menu button (override Tailwind xl:hidden
   on the wrapper that contains .myst-top-nav-menu-button). */
.myst-top-nav-bar > div:first-child > div:has(> button.myst-top-nav-menu-button) {
  display: block !important;
}

/* Always hide the inline text-nav items so the hamburger drawer
   becomes the only nav surface. */
.myst-top-nav-bar > div:nth-child(2) > div:first-child:has(.myst-top-nav-item),
.myst-top-nav-item {
  display: none !important;
}

/* At xl+ the sidebar would render as a transparent article-grid
   overlay across the full viewport, blocking clicks on content
   underneath. Pin it back to drawer dimensions and let the .hidden
   class (default closed state) actually take effect. */
@media (min-width: 1280px) {
  .myst-primary-sidebar {
    width: 75vw !important;
    max-width: 350px !important;
    top: 0 !important;
    height: 100vh !important;
    pointer-events: auto !important;
  }
  .myst-primary-sidebar.hidden {
    display: none !important;
  }
}

/* ─────────────────────────────────────────────────────────────────
 * 8. Responsive
 * ───────────────────────────────────────────────────────────────── */

@media (max-width: 720px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    min-height: auto;
    padding: 1.5rem 0 2rem;
    text-align: left;
  }
  /* No mobile mask either — the source image has its own fade. */
  .hero-portrait-img img,
  picture.hero-portrait-img img {
    min-height: auto;
    max-height: 55vh;
  }
  .hero-text {
    margin-left: 0;
    padding: 0;
  }
  .hero-text h1 {
    font-size: 2rem;
  }

  .trace-callout {
    padding: 1.25rem 1.25rem 1rem;
    margin: 1.5rem 0 2rem;
  }
  .trace-callout-actions {
    flex-direction: column;
    align-items: stretch;
  }
  a.trace-callout-button,
  a.trace-callout-button-secondary {
    justify-content: center;
  }
}
