:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --text: #111111;
  --nav-bg: #f0f0f0;
  --link: #333333;
  --link-hover: #0b5fff;
  --button-bg: #ffffff;
  --button-text: #111111;
  --button-border: #c7c7c7;
}

/* ── Terminal color theme: ice ───────────────────────────── */
[data-theme="dark"] {
  --term-fg:     #b3fff6;
  --term-bg:     #030e0d;
  --term-nav:    #020a09;
  --term-border: #1a4040;
  --term-btn:    #0b2020;
}
[data-theme="dark"] {
  --bg:            var(--term-bg);
  --text:          var(--term-fg);
  --nav-bg:        var(--term-nav);
  --link:          var(--term-fg);
  --link-hover:    #ffffff;
  --button-bg:     var(--term-btn);
  --button-text:   var(--term-fg);
  --button-border: var(--term-border);
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  display: flex;
  background: var(--bg);
  color: var(--text);
}
.site-nav {
  width: 200px;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  display: flex;
  flex-direction: column;
  background: var(--nav-bg);
  padding: 20px;
  box-sizing: border-box;
  overflow-y: auto;
}
.site-nav a {
  display: block;
  margin-bottom: 10px;
  text-decoration: none;
  color: var(--link);
  transition: color 0.2s ease;
}
.site-nav a:hover, nav a:focus { color: var(--link-hover); }
.profile { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.profile-pic {
  width: 112px; height: 112px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--button-border);
  transition: filter 0.3s ease, border-radius 0.3s ease;
}
.nav-divider { border: none; border-top: 1px solid var(--button-border); margin: 12px 0; }
.nav-meta { font-size: 11px; color: var(--link); opacity: 0.6; margin-bottom: 6px; }
.theme-toggle {
  width: 100%;
  padding: 8px 12px;
  margin-top: auto;
  border-radius: 6px;
  border: 1px solid var(--button-border);
  background: var(--button-bg);
  color: var(--button-text);
  cursor: pointer;
  font-size: 14px;
  text-align: left;
}
.theme-toggle:focus-visible { outline: 2px solid var(--link-hover); outline-offset: 2px; }
main { margin-left: 220px; padding: 20px; max-width: 800px; }
section { margin-bottom: 60px; }

/* ── Hobbies poem ─────────────────────────────────────────── */
.poem {
  margin: 24px 0 0;
  padding: 4px 0 4px 16px;
  border-left: 2px solid var(--button-border);
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  line-height: 1.55;
  color: var(--text);
  opacity: 0.85;
}
.poem cite {
  display: block;
  margin-top: 10px;
  font-style: normal;
  font-size: 0.9em;
  opacity: 0.8;
}
.poem cite a { color: inherit; }
[data-theme="dark"] .poem {
  font-family: 'Courier New', Courier, monospace;
  font-style: normal;
  border-left-color: var(--term-border);
}

/* ── Terminal dark mode ───────────────────────────────────── */

[data-theme="dark"] body {
  font-family: 'Courier New', Courier, monospace;
  font-size: 14px;
  line-height: 1.7;
}

/* h1: hidden in dark mode — NFO box carries the name */
[data-theme="dark"] .portfolio h1 { display: none; }

/* h2: full ASCII box using ::before / ::after with \A newlines */
[data-theme="dark"] h2 {
  font-size: 1em;
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 0;
  color: inherit;
  margin-bottom: 1em;
}
[data-theme="dark"] h2::before {
  content: '╔══════════════════════════════════════════════════════╗\A║  ';
  white-space: pre;
}
[data-theme="dark"] h2::after {
  content: '\A╚══════════════════════════════════════════════════════╝';
  white-space: pre;
}

[data-theme="dark"] main a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
[data-theme="dark"] main a:hover { opacity: 0.7; }
[data-theme="dark"] .site-nav a { color: inherit; text-decoration: none; }
[data-theme="dark"] .site-nav a::before { content: '> '; opacity: 0.3; }
[data-theme="dark"] strong { color: inherit; }
[data-theme="dark"] main ul { list-style-type: '* '; padding-left: 1.5em; }
[data-theme="dark"] .profile-pic {
  filter: grayscale(100%) brightness(0.65) contrast(1.2);
  border-radius: 4px;
}

/* NFO header — dark mode only */
.nfo-header { display: none; margin-bottom: 40px; line-height: 1.2; overflow-x: auto; opacity: 0.85; }
[data-theme="dark"] .nfo-header { display: block; }

/* Terminal splash — dark mode only */
.terminal-splash { display: none; margin-bottom: 16px; overflow-x: auto; opacity: 0.45; }
[data-theme="dark"] .terminal-splash { display: block; }


@media (max-width: 768px) {
  body { flex-direction: column; }
  .site-nav { width: 100%; position: relative; top: auto; bottom: auto; }
  main { margin: 0; padding: 10px; max-width: none; }
}

.nav-artifacts {
  margin-top: 8px;
  font-size: 11px;
  opacity: 0.6;
  display: flex;
  gap: 10px;
}
.site-nav a[aria-current="page"] { font-weight: bold; }
[data-theme="dark"] .profile a::before { content: none; }
main { min-width: 0; }
a { overflow-wrap: anywhere; }
[hidden] { display: none !important; }
.subsection-title { margin-top: 32px; }
.page-footer {
  margin-top: 48px;
  padding-top: 16px;
  border-top: 1px solid var(--button-border);
  font-size: 13px;
}
@media (max-width: 768px) {
  .site-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 16px;
    padding: 16px;
  }
  .profile { grid-column: 1 / -1; margin-bottom: 16px; }
  .profile-pic { width: 72px; height: 72px; }
  .nav-divider { grid-column: 1 / -1; width: 100%; }
  .theme-toggle { grid-column: 1 / -1; margin-top: 8px; }
  .nav-artifacts { grid-column: 1 / -1; }
  main { padding: 16px; }
  [data-theme="dark"] h2::before {
    content: '+------------------------------+\A|  ';
  }
  [data-theme="dark"] h2::after {
    content: '\A+------------------------------+';
  }
}
