/* ===========================
   TOKENS
   =========================== */
:root {
  --bg: #0a0a0a;
  --surface: #111111;
  --surface-2: #161616;
  --border: #1e1e1e;
  --border-hover: #2a2a2a;

  --text: #c8c8c8;
  --text-secondary: #777777;
  --text-dim: #444444;
  --text-heading: #e0e0e0;

  --accent: #c8956c;
  --accent-dim: rgba(200, 149, 108, 0.12);

  --red: #ff5f57;
  --yellow: #febc2e;
  --green: #28c840;

  --mono: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Courier New', monospace;

  --measure: 1100px;
  --page-padding: clamp(1.5rem, 5vw, 4rem);

  --radius: 8px;
  --radius-sm: 6px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.modal-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ===========================
   NAV
   =========================== */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem var(--page-padding);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-path {
  font-size: 0.85rem;
  color: var(--accent);
  letter-spacing: 0.3px;
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links a {
  font-size: 0.8rem;
  color: var(--text-dim);
  letter-spacing: 0.3px;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--text);
}

/* ===========================
   HERO
   =========================== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 0 var(--page-padding);
  max-width: var(--measure);
  margin: 0 auto;
  overflow: hidden;
}

.ascii-bg {
  position: absolute;
  top: 50%;
  right: -60px;
  transform: translateY(-50%);
  font-size: 0.55rem;
  line-height: 1.2;
  color: var(--text-dim);
  opacity: 0.06;
  pointer-events: none;
  user-select: none;
  white-space: pre;
  font-family: var(--mono);
}

.hero-content {
  display: flex;
  gap: 3.5rem;
  align-items: flex-start;
  position: relative;
  z-index: 1;
  width: 100%;
}

.hero-portrait {
  flex-shrink: 0;
}

.window-sm {
  max-width: 200px;
}

.portrait-img {
  width: 100%;
  height: auto;
  display: block;
  filter: grayscale(100%) contrast(1.1);
  opacity: 0.85;
  transition: filter 0.4s ease, opacity 0.4s ease;
}

.portrait-img:hover {
  filter: grayscale(0%) contrast(1);
  opacity: 1;
}

.hero-text {
  padding-top: 0.5rem;
}

.hero-text h1 {
  font-family: var(--mono);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 0.4rem;
  letter-spacing: -0.5px;
}

.hero-role {
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

.hero-bio {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.8;
  max-width: 420px;
  margin-bottom: 0.75rem;
}

.hero-location {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 1.5rem;
}

.hero-resume {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.85rem;
  margin-bottom: 1.75rem;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.hero-resume:hover {
  color: var(--accent);
  border-color: var(--accent);
  background-color: var(--accent-dim);
}

.hero-resume-arrow {
  transition: transform 0.2s ease;
}

.hero-resume:hover .hero-resume-arrow {
  transform: translateX(2px);
}

.hero-socials {
  display: flex;
  gap: 1rem;
}

.hero-socials a {
  color: var(--text-dim);
  transition: color 0.25s ease, transform 0.25s ease;
  display: flex;
  align-items: center;
}

.hero-socials a:hover {
  color: var(--accent);
  transform: translateY(-1px);
}

/* Mobile hero */
@media (max-width: 700px) {
  .hero {
    padding-top: 100px;
    min-height: auto;
    padding-bottom: 4rem;
  }

  .hero-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2rem;
  }

  .window-sm {
    max-width: 180px;
  }

  .hero-bio {
    margin: 0 auto 0.75rem;
  }

  .hero-socials {
    justify-content: center;
  }

  .ascii-bg {
    display: none;
  }
}

/* ===========================
   ASCII SEPARATOR
   =========================== */
.ascii-sep {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--page-padding);
  height: 1px;
  background: var(--border);
  opacity: 0.5;
}

/* ===========================
   SECTIONS
   =========================== */
.section {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 5rem var(--page-padding);
}

.section h2 {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 2.5rem;
  letter-spacing: 0.3px;
}

/* ===========================
   WINDOW COMPONENT
   =========================== */
.window {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.window:hover {
  border-color: var(--border-hover);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  transform: translateY(-2px);
}

.window-titlebar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.window-dots {
  display: flex;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.red { background: var(--red); }
.dot.yellow { background: var(--yellow); }
.dot.green { background: var(--green); }

.window-filename {
  font-size: 0.85rem;
  color: var(--text-dim);
  flex: 1;
  text-align: center;
  margin-right: 42px; /* offset for dots width to center text */
}

.window-body {
  padding: 1rem;
}

.window-body-img {
  padding: 0;
}

.window-body-compact {
  padding: 1rem 1.1rem;
}

.window-preview {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-bottom: 1px solid var(--border);
  filter: grayscale(60%);
  transition: filter 0.4s ease;
}

.window:hover .window-preview {
  filter: grayscale(0%);
}

.window-text {
  padding: 1rem 1.1rem 0.75rem;
}

.window-summary {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.window-stack {
  font-size: 0.8rem;
  color: var(--text-dim);
  display: block;
  margin-bottom: 0.75rem;
}

.window-links {
  display: flex;
  gap: 0.5rem;
}

.window-link {
  color: var(--text-dim);
  display: flex;
  align-items: center;
  padding: 0.3rem;
  border-radius: 4px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.window-link:hover {
  color: var(--accent);
  background-color: var(--accent-dim);
}

/* Hidden modal data */
.modal-data {
  display: none;
}

/* ===========================
   WINDOWS GRID
   =========================== */
.windows-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.windows-grid-sm {
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 800px) {
  .windows-grid {
    grid-template-columns: 1fr;
  }

  .windows-grid-sm {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 500px) {
  .windows-grid-sm {
    grid-template-columns: 1fr;
  }
}

/* ===========================
   SUBSECTION (Side Quests)
   =========================== */
.subsection {
  margin-top: 4rem;
}

.subsection h3 {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 1.5rem;
}

/* ===========================
   MODAL (Cursor-style docs)
   =========================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-window {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modal-overlay.active .modal-window {
  transform: translateY(0) scale(1);
}

.modal-titlebar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-filename {
  font-size: 0.75rem;
  color: var(--text-dim);
  flex: 1;
  text-align: center;
  margin-right: 42px;
}

.modal-scroll {
  overflow-y: auto;
  flex: 1;
}

.modal-cmd {
  padding: 0.75rem 1.25rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.modal-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-bottom: 1px solid var(--border);
}

.modal-body {
  padding: 1.5rem 1.5rem 2rem;
}

.modal-title {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 0.75rem;
}

.modal-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.meta-tag {
  font-size: 0.7rem;
  color: var(--text-dim);
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 3px;
}

.modal-section {
  margin-bottom: 1.5rem;
}

.modal-heading {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.modal-paragraph {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

.modal-links {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.modal-link-item {
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: color 0.2s ease;
  display: inline-block;
}

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

.modal-branch {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Modal scrollbar */
.modal-scroll::-webkit-scrollbar {
  width: 4px;
}

.modal-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.modal-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

@media (max-width: 600px) {
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal-window {
    max-height: 92vh;
    border-radius: var(--radius) var(--radius) 0 0;
  }

  .modal-body {
    padding: 1.25rem;
  }
}

/* ===========================
   WRITING (Log entries)
   =========================== */
.log-entries {
  display: flex;
  flex-direction: column;
}

.log-entry {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--border);
  transition: padding-left 0.2s ease;
  flex-wrap: wrap;
}

.log-entry:last-child {
  border-bottom: 1px solid var(--border);
}

.log-entry:hover {
  padding-left: 0.75rem;
}

.log-date {
  font-size: 0.75rem;
  color: var(--accent);
  flex-shrink: 0;
}

.log-title {
  font-size: 0.85rem;
  color: var(--text);
  flex: 1;
  min-width: 200px;
}

.log-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
  flex-basis: 100%;
  padding-left: calc(0.75rem + 42px); /* align with title */
  margin-top: 0.25rem;
}

.log-arrow {
  font-size: 0.85rem;
  color: var(--text-dim);
  flex-shrink: 0;
  transition: transform 0.2s ease, color 0.2s ease;
}

.log-entry:hover .log-arrow {
  transform: translateX(3px);
  color: var(--accent);
}

@media (max-width: 600px) {
  .log-desc {
    padding-left: 0;
  }
}

/* ===========================
   FOOTER
   =========================== */
.footer {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 3rem var(--page-padding) 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-prompt {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.footer-cmd {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.footer-links {
  display: flex;
  gap: 1rem;
}

.footer-links a {
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-cursor {
  font-size: 0.85rem;
  color: var(--accent);
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ===========================
   ANIMATIONS
   =========================== */
.reveal {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* stagger windows */
.windows-grid .window:nth-child(1) { transition-delay: 0s; }
.windows-grid .window:nth-child(2) { transition-delay: 0.08s; }
.windows-grid .window:nth-child(3) { transition-delay: 0.16s; }
.windows-grid .window:nth-child(4) { transition-delay: 0.24s; }
.windows-grid .window:nth-child(5) { transition-delay: 0.32s; }

/* ===========================
   SCROLLBAR
   =========================== */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}