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

:root {
  --bg:         #363636;
  --surface:    #3d3d3d;
  --border:     rgba(255, 27, 255, 0.65);
  --border-mid: rgba(255, 27, 255, 0.30);
  --text:       #ccc8c0;
  --text-dim:   #aaa396;
  --text-faint: #87766e;
  --accent:     #ff1bff;
  --label:      #1bc0ff;
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;
  --sidebar-w: 200px;
  --header-h:  60px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 300;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* layout shell */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--header-h) 1fr;
  grid-template-areas:
    "sidebar header"
    "sidebar main";
  min-height: 100vh;
}

/* sidebar */

.sidebar {
  grid-area: sidebar;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 28px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 0 24px 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

#logo {
  height: 36px; 
  width: 36px;
  object-fit: cover;
  flex-shrink: 0;
  border-radius: 20px;
}

.brand-text {
  display: flex;
  flex-direction: column; 
  line-height: 1.2;       
  padding-left: clamp(10px, 1.5vw, 15px);
}

.sidebar-brand .name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.1;
}

.sidebar-brand .tagline {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 4px;
}

.sidebar-section {
  padding: 0 24px;
  margin-bottom: 28px;
}

.sidebar-label {
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 10px;
}

.sidebar-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

li {
  color: var(--text-dim);
}

.sidebar-nav a {
  display: block;
  padding: 5px 8px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 12px;
  border-radius: 2px;
  transition: color 0.15s, background 0.15s;
  cursor: pointer;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  color: var(--text);
  background: var(--surface);
}

.sidebar-nav a.active {
  color: var(--accent);
}

.sidebar-footer {
  margin-top: auto;
  padding: 0 24px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.sidebar-footer a {
  display: block;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 11px;
  line-height: 2;
  transition: color 0.15s;
  text-align: center;
}

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

.sidebar-last-updated {
  font-size: 8px;
  color: var(--text-faint);
  opacity: 0.7;
  letter-spacing: 0.05em;
  text-align: center;
  margin-bottom: 4px;
}

.sidebar-copyright {
  font-size: 10px;
  color: var(--text-faint);
  margin-top: 12px;
  margin-bottom: 6px;
  letter-spacing: 0.05em;
  text-align: center;
}

.sidebar-privacy-link {
  display: block;
  font-size: 10px;
  color: var(--text-faint);
  text-decoration: none;
  margin-top: 16px;
  cursor: pointer;
  text-align: center;
  width: 100%;
  transition: color 0.15s, border-color 0.15s;
  background: none;
  border: 1px solid var(--border-mid);
  border-radius: 2px;
  padding: 4px 0;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

.sidebar-privacy-link:hover {
  color: var(--text-dim);
  border-color: var(--text-faint);
}

/* privacy modal */

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border-mid);
  padding: 32px;
  max-width: 480px;
  width: calc(100% - 48px);
  position: relative;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 300;
  font-style: italic;
  color: var(--text);
  margin-bottom: 20px;
  line-height: 1.1;
}

.modal-body {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.8;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  transition: color 0.15s;
}

.modal-close:hover { color: var(--text); }

/* header and tabs */

.header {
  grid-area: header;
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  gap: 0;
}

.header-left {
  display: flex;
  align-items: center;
  margin-right: auto;
}

.breadcrumb {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

.breadcrumb span { color: var(--text-faint); margin: 0 6px; }

.tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.tab {
  display: flex;
  align-items: center;
  padding: 0 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.tab:hover { color: var(--text); }

.tab.active {
  color: var(--accent);
  background: var(--surface);
}

/* main content */

.main {
  grid-area: main;
  padding: 40px 48px calc(100vh - var(--header-h));
  max-width: 760px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* panel headings */
.panel-title {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 300;
  font-style: italic;
  color: var(--text);
  line-height: 1.0;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.panel-meta {
  font-size: 14px;
  color: var(--text-dim);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 32px;
  margin-top: 32px;
  padding-bottom: 20px;
  padding-top: 20px;
  border-bottom: 1px solid var(--border);
}

.panel-body {
  color: var(--text);
  font-size: 13px;
  line-height: 1.85;
  max-width: 560px;
}

.panel-body p + p { margin-top: 16px; }

.panel-body a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-dim);
  transition: border-color 0.15s;
}

.panel-body a:hover { border-bottom-color: var(--accent); }

/* grid cards for projects */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, 250px);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  margin-top: 24px;
  width: fit-content;
  max-width: 100%;
}

.card {
  background: var(--bg);
  padding: 20px;
  transition: background 0.15s;
  cursor: pointer;
}

.card-link {
  display: contents;
  text-decoration: none;
  color: inherit;
}
.card:hover { background: var(--surface); }

.card-title {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 6px;
}

.card-desc {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 12px;
}

.card-tag {
  display: inline-block;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--label);
  border: 1px solid var(--label);
  padding: 2px 6px;
  border-radius: 2px;
}

/* writing list */
.post-list {
  list-style: none;
  margin-top: 24px;
}

.post-item {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
}

.post-date {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

.post-title {
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: color 0.15s;
}

.post-title:hover { color: var(--accent); }

.misc-list .post-item {
  grid-template-columns: 120px 1fr;
}

.misc-value {
  font-size: 13px;
  color: var(--text);
}

.misc-value a {
  color: var(--accent);
}

/* article modal */
.modal--article {
  max-width: 680px;
  width: calc(100% - 48px);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
}

.modal--article .modal-title {
  flex-shrink: 0;
}

.modal--article .modal-body {
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--border-mid) transparent;
}

/* rendered markdown prose */
.article-body {
  font-size: 13px;
  color: var(--text);
  line-height: 1.85;
}

.article-body h1,
.article-body h2,
.article-body h3 {
  font-family: var(--font-display);
  font-weight: 300;
  font-style: italic;
  color: var(--text);
  line-height: 1.15;
  margin-top: 28px;
  margin-bottom: 10px;
}

.article-body h1 { font-size: 36px; margin-top: 0; }
.article-body h2 { font-size: 26px; }
.article-body h3 { font-size: 20px; }

.article-body p { margin-top: 14px; }
.article-body p:first-child { margin-top: 0; }

.article-body a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 27, 255, 0.35);
  transition: border-color 0.15s;
}

.article-body a:hover { border-bottom-color: var(--accent); }

.article-body ul,
.article-body ol {
  padding-left: 20px;
  margin-top: 14px;
}

.article-body li { margin-top: 4px; }

.article-body blockquote {
  border-left: 2px solid var(--border);
  padding-left: 16px;
  margin: 16px 0;
  color: var(--text-dim);
  font-style: italic;
}

.article-body code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface);
  padding: 1px 5px;
  border-radius: 2px;
  color: var(--label);
}

.article-body pre {
  background: var(--surface);
  border: 1px solid var(--border-mid);
  padding: 16px;
  overflow-x: auto;
  margin-top: 16px;
  border-radius: 2px;
}

.article-body pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

.article-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}

.article-body em { color: var(--text-dim); }

/* accent highlight */
.hl { color: var(--accent); }

/* hamburger; hidden on desktop */
.hamburger {
  display: none;
}

/* sidebar overlay; hidden on desktop */
.sidebar-overlay {
  display: none;
}

/* fade-in on panel switch */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tab-panel.active {
  animation: fadeIn 0.2s ease forwards;
}

/* mobile */
@media (max-width: 768px) {
  /* single-column layout */
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: var(--header-h) 1fr;
    grid-template-areas:
      "header"
      "main";
  }

  /* sidebar becomes a fixed off-canvas drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100vh;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    background: var(--bg);
    border-right: 1px solid var(--border);
    /* keep sticky/overflow from desktop intact */
    grid-area: unset;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  /* dim overlay behind the open sidebar */
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 40;
    display: none;
  }

  .sidebar-overlay.open {
    display: block;
  }

  /* header adjustments */
  .header {
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--bg);
  }

  /* show hamburger */
  .hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    align-self: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    margin-right: 10px;
  }

  .hamburger span {
    display: block;
    height: 1px;
    width: 100%;
    background: var(--text-dim);
    transition: background 0.15s, transform 0.2s, opacity 0.2s;
    transform-origin: center;
  }

  /* animate hamburger -> X when open */
  .hamburger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .hamburger.open span:nth-child(2) { opacity: 0; }
  .hamburger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  .hamburger:hover span { background: var(--text); }

  /* hide header tab row; sidebar nav handles navigation */
  .tabs { display: none; }

  /* main content */
  .main {
    padding: 28px 20px calc(100vh - var(--header-h));
    max-width: 100%;
  }

  .panel-title {
    font-size: 36px;
  }

  .panel-meta {
    font-size: 12px;
    letter-spacing: 0.08em;
  }

  .panel-body {
    max-width: 100%;
  }

  /* project cards — full width, stacked */
  .card-grid {
    grid-template-columns: 1fr;
    width: 100%;
  }

  /* writing list — tighten date column on small screens */
  .post-item {
    grid-template-columns: 76px 1fr;
    gap: 10px;
  }

  /* modal fits the screen */
  .modal {
    width: calc(100% - 32px);
    padding: 24px;
  }

  .modal--article {
    max-height: 88vh;
  }
}
