:root {
  --bg: #0b0c0c;
  --fg: #d0f0d0;
  --muted: #89b089;
  --prompt: #7CFC00;
  --link: #98fb98;
}
:root[data-theme="light"] {
  --bg: #f7f8f7;
  --fg: #0b0c0c;
  --muted: #4f6a4f;
  --prompt: #2b6a00;
  --link: #245f24;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
.terminal {
  display: grid; place-items: center;
  min-height: 100dvh; padding: 24px;
}
.window { width: 100%; max-width: 1080px; border: 1px solid #1b2b1b; border-radius: 8px; overflow: hidden; background: #0f110f; box-shadow: 0 0 40px rgba(0,0,0,0.4); }
:root[data-theme="light"] .window { background: #ffffff; border-color: #dfe7df; box-shadow: 0 0 30px rgba(0,0,0,0.08); }
.bar {
  background: #121612; padding: 8px 12px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid #1b2b1b;
}
:root[data-theme="light"] .bar { background: #eef4ee; border-color: #dfe7df; }
.dot { width: 10px; height: auto; aspect-ratio: 1 / 1; border-radius: 50%; display: inline-block; vertical-align: middle; flex: 0 0 auto; }
.red { background: #ff5f56; } .yellow { background: #ffbd2e; } .green { background: #27c93f; }
.title { margin-left: 8px; color: var(--muted); }
.screen { padding: 18px; }
.prompt { color: var(--prompt); margin-right: 8px; }
.ls { list-style: none; padding: 0; margin: 8px 0 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 6px 18px; }
.cursor {
  display: inline-block; width: 8px; height: 1.1em; background: var(--fg); vertical-align: -0.2em; margin-left: 4px;
  animation: blink 1s steps(1) infinite;
}
.muted { color: var(--muted); }
.content img { max-width: 100%; height: auto; }
.content pre, .content code { background: #0d120d; border: 1px solid #1b2b1b; padding: 2px 4px; border-radius: 4px; }
:root[data-theme="light"] .content pre, :root[data-theme="light"] .content code { background: #f4f7f4; border-color: #dfe7df; }
.content pre { padding: 12px; overflow: auto; }
.spacer { flex: 1 1 auto; }
/* removed boxy button styles for toggle; using plain link */
@keyframes blink { 50% { opacity: 0; } }

/* layout additions for sidebar UI */
.screen { display: grid; grid-template-columns: 240px 1fr; gap: 0; }
.sidebar { border-right: 1px solid #1b2b1b; background: rgba(0,0,0,0.06); }
:root[data-theme="light"] .sidebar { background: #f7faf7; border-color: #dfe7df; }
.sidebar-inner { padding: 16px; }
.sidebar-header { color: var(--muted); margin-bottom: 8px; }
.sidebar-nav ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.sidebar-nav a { color: var(--link); text-decoration: none; }
.sidebar-nav a:hover { text-decoration: underline; }
.content-pane { padding: 18px; }
.toggle-link { color: var(--link); text-decoration: none; font-size: 12px; }
.toggle-link:hover { text-decoration: underline; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.photo-grid .photo { display: block; border: 1px solid #1b2b1b; border-radius: 6px; overflow: hidden; }
:root[data-theme="light"] .photo-grid .photo { border-color: #dfe7df; }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }

.about-layout { display: grid; grid-template-columns: 1fr 250px; gap: 18px; align-items: start; }
/* .about-photo-wrap { display: flex; justify-content: end; overflow: hidden; } */
.about-photo { width: 100%; max-width: 300px; border: 1px solid #1b2b1b; border-radius: 3px;}
:root[data-theme="light"] .about-photo { border-color: #dfe7df; }
.about-rest { margin-top: 12px; }
@media (max-width: 720px) {
  .about-layout { grid-template-columns: 1fr; }
  .about-photo-wrap { justify-content: start; }
}

/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.85); display: none; align-items: center; justify-content: center; z-index: 1000; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 90vw; max-height: 88vh; border: 1px solid #1b2b1b; border-radius: 6px; }
.lightbox .nav { position: absolute; top: 50%; transform: translateY(-50%); font-size: 22px; color: var(--fg); cursor: pointer; padding: 8px 12px; user-select: none; }
.lightbox .prev { left: 16px; }
.lightbox .next { right: 16px; }
.lightbox .close { position: absolute; top: 12px; right: 16px; font-size: 18px; cursor: pointer; color: var(--fg); }
:root[data-theme="light"] .lightbox { background: rgba(255,255,255,0.92); }
:root[data-theme="light"] .lightbox img { border-color: #dfe7df; }

/* Desktop default: hide mobile menu control */
#menu-toggle { display: none; }

@media (max-width: 920px) {
  .window { max-width: 100%; border-radius: 0; }
}

/* Off-canvas sidebar on small screens + fullscreen window (Safari-safe) */
@media (max-width: 720px) {
  .terminal { padding: 0; min-height: 100svh; min-height: 100vh; }
  /* show [menu] button only on small screens */
  #menu-toggle { display: inline; margin-right: 8px; }

  .window { width: 100vw; min-height: 100svh; min-height: 100vh; border-radius: 0; }
  .screen { display: block; min-height: calc(100svh - 44px); }

  .bar { position: sticky; top: 0; z-index: 1002; min-height: 44px; }
  .bar .title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .toggle-link { white-space: nowrap; }

  /* Off-canvas using left instead of transform for better Safari behavior */
  .sidebar {
    position: fixed;
    top: 44px; /* below bar */
    left: -260px; /* hidden off-screen */
    height: calc(100svh - 44px);
    width: 260px; max-width: 86vw;
    transition: left 180ms ease;
    z-index: 1001;
    overflow: auto;
    background: var(--bg);
    border-right: 1px solid #1b2b1b;
  }
  :root[data-theme="light"] .sidebar { border-right-color: #dfe7df; }
  .window[data-menu-open="true"] .sidebar { left: 0; }

  .content-pane { padding: 14px; }
  .backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: none; z-index: 1000; }
  .window[data-menu-open="true"] .backdrop { display: block; }
  body { font-size: 15px; }
  h1 { font-size: 1.6rem; }
}

/* Prevent long words/URLs from overflowing */
.content, .content * { overflow-wrap: anywhere; word-break: break-word; }
/* Keep code blocks readable while still preventing layout breakage */
.content pre, .content code { overflow-wrap: normal; word-break: normal; }

.btn-link { display: inline-block; padding: 6px 10px; border: 1px solid #2a3b2a; border-radius: 4px; color: var(--fg); text-decoration: none; }
:root[data-theme="light"] .btn-link { border-color: #9bb39b; }
.btn-link:hover { text-decoration: underline; }

.actions { display: flex; gap: 8px; margin: 6px 0 10px; }
.actions-right { justify-content: flex-end; }
.btn-strong { background: transparent; font-weight: 600; }
.btn-strong:hover { background: rgba(0,0,0,0.06); }
:root[data-theme="light"] .btn-strong:hover { background: rgba(0,0,0,0.04); }

@media (max-width: 720px) {
  .photo-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .photo-grid .photo { aspect-ratio: 4 / 5; }
}
