@import url('https://rsms.me/inter/inter.css');
@import url('https://rsms.me/inter/inter-display.css');


/* ═══════════════════════════════════════
   1. Variables & Palettes
   ═══════════════════════════════════════ */

:root {
  /* Typography */
  --font:          'Inter', -system-ui, system-ui, sans-serif;
  --title-font:    'InterDisplay', var(--font);
  --mono-font:     'IBM Plex Mono', 'SF Mono', Menlo, monospace;
  --font-size:     16px;
  --line-height:   1.5;
  --letter-spacing: -0.01em;
  --h1: 2rem;
  --h2: 1.5rem;
  --h3: 1.25rem;
  --h4: 1.1rem;

  /* Layout */
  --max-w: 1100px;

  /* Default palette (Home) — Deep Red */
  --bg:         #A73023;
  --fg:         #FFF3EF;
  --fg-muted:   rgba(255, 243, 239, 0.5);
  --accent:     #E09585;
  --nav-link:   rgba(255, 243, 239, 0.45);
  --nav-active: #FFF3EF;
  --dot:        #E09585;
}

@supports (font-variation-settings: normal) {
  :root {
    --font: 'Inter var', 'Inter', -system-ui, system-ui, sans-serif;
    --title-font: 'InterDisplay var', var(--font);
  }
}

/* Page palettes */

body.page-writing {
  --bg:         #F2ECE2;
  --fg:         #2E2518;
  --fg-muted:   rgba(46, 37, 24, 0.45);
  --accent:     #8B6842;
  --nav-link:   rgba(46, 37, 24, 0.4);
  --nav-active: #2E2518;
  --dot:        #8B6842;
}

body.page-photography {
  --bg:         #37342F;
  --fg:         #E8E4DD;
  --fg-muted:   rgba(232, 228, 221, 0.5);
  --accent:     #9E9283;
  --nav-link:   rgba(232, 228, 221, 0.4);
  --nav-active: #E8E4DD;
  --dot:        #9E9283;
}

body.page-projects {
  --bg:         #3A65C8;
  --fg:         #EDF1FA;
  --fg-muted:   rgba(237, 241, 250, 0.5);
  --accent:     #8AAEE6;
  --nav-link:   rgba(237, 241, 250, 0.45);
  --nav-active: #EDF1FA;
  --dot:        #8AAEE6;
}

body.page-project-detail {
  --bg:         #EBF0F8;
  --fg:         #1A2640;
  --fg-muted:   rgba(26, 38, 64, 0.5);
  --accent:     #3A65C8;
  --nav-link:   rgba(26, 38, 64, 0.4);
  --nav-active: #1A2640;
  --dot:        #3A65C8;
}

body.page-about {
  --bg:         #387A50;
  --fg:         #EDF7F0;
  --fg-muted:   rgba(237, 247, 240, 0.55);
  --accent:     #70C088;
  --nav-link:   rgba(237, 247, 240, 0.5);
  --nav-active: #EDF7F0;
  --dot:        #70C088;
}


/* ═══════════════════════════════════════
   2. Reset & Base
   ═══════════════════════════════════════ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  font-size: var(--font-size);
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: var(--line-height);
  letter-spacing: var(--letter-spacing);
  color: var(--fg);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}


/* ═══════════════════════════════════════
   3. Layout
   ═══════════════════════════════════════ */

.page {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3rem 2.5rem;
  display: grid;
  grid-template-columns: 1fr 200px;
  grid-template-rows: auto 1fr;
  gap: 0 4rem;
  min-height: 100vh;
}

.page-content {
  grid-column: 1;
  grid-row: 1 / -1;
  min-width: 0;
}


/* ═══════════════════════════════════════
   4. Navigation
   ═══════════════════════════════════════ */

nav {
  grid-column: 2;
  grid-row: 1;
  position: sticky;
  top: 3rem;
  align-self: start;
}

nav .dot {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: var(--dot);
  margin-bottom: 1rem;
}

nav a {
  display: block;
  font-size: 1.3rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--nav-link);
  text-decoration: none;
  transition: color 0.15s;
}

nav a:hover        { color: var(--nav-active); }
nav a.active       { color: var(--nav-active); font-weight: 600; }


/* ═══════════════════════════════════════
   5. Typography
   ═══════════════════════════════════════ */

h1 {
  font-family: var(--title-font);
  font-size: var(--h1);
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 0.5rem;
}

h2 {
  font-family: var(--title-font);
  font-size: var(--h2);
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.33;
  margin-bottom: 0.5rem;
}

h3 {
  font-size: var(--h3);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

p              { margin-bottom: 1rem; }
p.muted        { color: var(--fg-muted); font-size: 0.95rem; }

a              { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover        { color: var(--accent); }


/* ═══════════════════════════════════════
   6. Hero
   ═══════════════════════════════════════ */

.hero {
  padding-top: 3rem;
  padding-bottom: 6rem;
}

.about-photo {
  display: block;
  width: 200px;
  height: auto;
  border-radius: 6px;
  margin-bottom: 2rem;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--fg-muted);
  margin-bottom: 2rem;
}

.hero-tagline {
  font-family: var(--title-font);
  font-size: 1.8rem;
  font-weight: 600;
  line-height: 1.25;
  max-width: 600px;
}


/* ═══════════════════════════════════════
   7. Content Sections
   ═══════════════════════════════════════ */

.content-section { margin-top: 4rem; }

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 1.5rem;
}

.links         { list-style: none; margin-top: 0.5rem; }
.links li      { margin-bottom: 0.5rem; }
.links a       { font-size: 0.95rem; }


/* ═══════════════════════════════════════
   8. Timeline (About)
   ═══════════════════════════════════════ */

.timeline                    { margin-top: 1rem; }
.timeline-entry              { padding: 1.5rem 0; border-top: 1px solid var(--fg-muted); }
.timeline-entry:last-child   { border-bottom: 1px solid var(--fg-muted); }
.timeline-period             { font-size: 0.8rem; font-weight: 500; color: var(--fg-muted); letter-spacing: 0.02em; margin-bottom: 0.35rem; }
.timeline-role               { font-weight: 600; font-size: 1rem; margin-bottom: 0.15rem; }
.timeline-org                { font-size: 0.9rem; color: var(--fg-muted); margin-bottom: 0.5rem; }
.timeline-desc               { font-size: 0.9rem; line-height: 1.6; margin-bottom: 0; }
.timeline-loc                { font-size: 0.8rem; color: var(--fg-muted); }


/* ═══════════════════════════════════════
   9. Listing (Writing index)
   ═══════════════════════════════════════ */

.listing                     { list-style: none; margin-top: 1rem; }
.listing-item                { border-top: 1px solid var(--fg-muted); }
.listing-item:last-child     { border-bottom: 1px solid var(--fg-muted); }

.listing-item a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1.2rem 0;
  text-decoration: none;
  color: var(--fg);
  gap: 0.75rem;
}

.listing-item a:hover .listing-title { color: var(--accent); }
.listing-title               { font-weight: 600; font-size: 1rem; min-width: 0; }
.listing-date                { font-size: 0.8rem; color: var(--fg-muted); white-space: nowrap; flex-shrink: 0; }
.listing-empty               { margin-top: 3rem; color: var(--fg-muted); font-size: 1rem; }


/* ═══════════════════════════════════════
   10. Article (Writing detail pages)
   ═══════════════════════════════════════ */

.back-link {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--fg-muted);
  text-decoration: none;
  margin-bottom: 2rem;
}

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

.article-body            { max-width: 640px; }
.article-body p          { line-height: 1.75; margin-bottom: 1.25rem; }
.article-body h2         { font-size: var(--h3); margin-top: 3rem; margin-bottom: 1rem; }

.article-subtitle        { font-size: 1.05rem; color: var(--fg-muted); font-style: italic; margin-bottom: 2rem; }
.article-dates           { font-size: 0.8rem; color: var(--fg-muted); margin-bottom: 2rem; }
.article-dates .date-separator { margin: 0 0.4em; }

.article-body hr         { border: none; border-top: 1px solid var(--fg-muted); margin: 2rem 0; }
.article-body ol,
.article-body ul         { margin-bottom: 1.25rem; padding-left: 1.5rem; }
.article-body li         { margin-bottom: 0.35rem; }

.article-body code {
  font-family: var(--mono-font);
  font-size: 0.88em;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1.25rem;
  margin: 2rem 0;
  color: var(--fg-muted);
  font-size: 0.95rem;
}

.article-body blockquote p              { margin-bottom: 0.5rem; }
.article-body blockquote p:last-child   { margin-bottom: 0; }

/* Article figures */
.article-body figure           { margin: 2rem 0; }
.article-body figure img       { max-width: 100%; height: auto; display: block; border-radius: 4px; }
.article-body figcaption       { font-size: 0.8rem; color: var(--fg-muted); margin-top: 0.5rem; font-style: italic; }
.article-body figcaption a     { color: var(--fg-muted); }

.article-body .figure-aside {
  float: right;
  width: 240px;
  margin: 0 0 1.5rem 2rem;
}

.article-body .figure-aside img { width: 100%; height: auto; }

.article-body .image-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 2rem 0 0.5rem;
}

.article-body .image-grid img  { width: 100%; height: auto; border-radius: 4px; }

.author-note { font-style: italic; color: var(--fg-muted); margin-top: 1rem; }


/* ═══════════════════════════════════════
   11. Photo Grid (Photography)
   ═══════════════════════════════════════ */

.photo-grid {
  columns: 3;
  column-gap: 1.25rem;
  max-width: 960px;
  margin: 2rem auto 0;
}

.photo-card {
  break-inside: avoid;
  margin-bottom: 1.25rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border-radius: 4px;
}

.photo-card img {
  width: 100%;
  display: block;
  border-radius: 4px 4px 0 0;
  transition: transform 0.3s ease;
}

.photo-card:hover img { transform: scale(1.02); }

.photo-caption {
  padding: 0.5rem 0.6rem 0.6rem;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--fg-muted);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 0 0 4px 4px;
}

.photo-caption .photo-title {
  font-weight: 600;
  color: var(--fg);
  display: block;
  margin-bottom: 0.15rem;
}

.photo-caption .photo-meta {
  font-size: 0.75rem;
  color: var(--fg-muted);
}


/* ═══════════════════════════════════════
   12. Lightbox (Photography)
   ═══════════════════════════════════════ */

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.92);
  justify-content: center;
  align-items: center;
  flex-direction: column;
  padding: 2rem;
  cursor: pointer;
}

.lightbox.active { display: flex; }

.lightbox img {
  max-width: 90vw;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.5);
}

.lightbox-info {
  margin-top: 1rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  line-height: 1.5;
  max-width: 600px;
}

.lightbox-info .lightbox-title  { font-weight: 600; color: #fff; font-size: 1rem; margin-bottom: 0.25rem; }
.lightbox-info .lightbox-meta   { font-size: 0.8rem; color: rgba(255, 255, 255, 0.5); }

.lightbox-close,
.lightbox-nav {
  position: fixed;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  z-index: 1001;
  line-height: 1;
  transition: color 0.2s;
}

.lightbox-close:hover,
.lightbox-nav:hover   { color: #fff; }

.lightbox-close {
  top: 1.25rem;
  right: 1.5rem;
  font-size: 1.5rem;
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  font-size: 2rem;
  padding: 1rem;
  user-select: none;
}
.lightbox-prev        { left: 0.5rem; }
.lightbox-next        { right: 0.5rem; }


/* ── Tweet embed (static card) ── */
.article-body .tweet-embed {
  margin: 2rem 0;
  max-width: 550px;
}

.tweet-card {
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 12px;
  padding: 1.25rem;
  background: #fff;
  color: #0f1419;
  font-size: 0.95rem;
  line-height: 1.45;
}

.tweet-card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.tweet-card-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent, #ccc);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
}

.tweet-card-author {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.tweet-card-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.tweet-card-handle {
  color: #536471;
  font-size: 0.85rem;
}

.tweet-card-text {
  margin-bottom: 0.75rem;
}

.tweet-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #536471;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0,0,0,0.08);
}

.tweet-card-footer a {
  color: #536471;
  text-decoration: none;
  font-weight: 500;
}

.tweet-card-footer a:hover {
  color: var(--accent, #1d9bf0);
  text-decoration: underline;
}


/* ═══════════════════════════════════════
   12b. Project Detail Components
   ═══════════════════════════════════════ */

.bucket-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.75rem 0;
}

.bucket-card {
  border-radius: 10px;
  padding: 1.25rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.bucket-card h4 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.bucket-card p {
  font-size: 0.875rem;
  margin-bottom: 0;
  opacity: 0.75;
  line-height: 1.5;
}

.bucket-income            { background: rgba(124, 58, 237, 0.08); }
.bucket-income h4         { color: #7c3aed; }
.bucket-growth            { background: rgba(37, 99, 235, 0.08); }
.bucket-growth h4         { color: #2563eb; }
.bucket-reserves          { background: rgba(5, 150, 105, 0.08); }
.bucket-reserves h4       { color: #059669; }

.callout {
  background: rgba(0, 0, 0, 0.04);
  border-left: 4px solid var(--accent);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border-radius: 0 8px 8px 0;
  font-size: 0.9rem;
  line-height: 1.6;
}

.callout strong           { color: var(--accent); }

.rule-list {
  margin: 1rem 0 1.5rem;
  padding-left: 0;
  list-style: none;
}

.rule-list li {
  font-size: 0.9rem;
  padding: 0.5rem 0 0.5rem 1.75rem;
  position: relative;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.rule-list li::before {
  content: attr(data-icon);
  position: absolute;
  left: 0;
  top: 0.5rem;
  font-size: 1rem;
}

.sim-wrapper {
  max-width: var(--max-w);
  width: 100%;
  margin: 2rem auto;
  padding: 0 2.5rem;
}

.sim-wrapper > div {
  max-width: 640px;
  overflow-x: auto;
}

@media (max-width: 768px) {
  .sim-wrapper {
    padding: 0 1.25rem;
  }
  .sim-wrapper > div {
    max-width: 100%;
  }
}

.article-divider {
  border: none;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  margin: 3rem 0;
}

.disclaimer {
  font-size: 0.8rem;
  opacity: 0.5;
  font-style: italic;
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  line-height: 1.6;
}

p.small {
  font-size: 0.85rem;
  opacity: 0.6;
}


/* ═══════════════════════════════════════
   13. Responsive
   ═══════════════════════════════════════ */

@media (max-width: 768px) {
  .page {
    grid-template-columns: 1fr;
    padding: 2rem 1.25rem;
    gap: 0;
  }

  nav {
    grid-column: 1;
    grid-row: 1;
    position: static;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
  }

  nav .dot { width: 14px; height: 14px; margin-bottom: 0; }
  nav a    { font-size: 0.85rem; line-height: 1; }

  .page-content { grid-row: 2; }

  h1             { font-size: 1.75rem; word-break: break-word; }
  h2             { font-size: 1.35rem; }
  .hero-tagline  { font-size: 1.3rem; max-width: 100%; }
  .hero          { padding-top: 1rem; padding-bottom: 3rem; }

  .article-body  { max-width: 100%; }
  .article-body .figure-aside { float: none; width: 100%; margin: 2rem 0; }

  .photo-grid    { columns: 2; }

  .article-body .image-grid   { grid-template-columns: 1fr; }

  .bucket-grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .photo-grid { columns: 1; }
}
