/* Base elements */
:root {
  --bg: #fdfeff;
  --surface: #ffffff;
  --text: #14181d;
  --text-dim: #363b41;
  --accent: #c97c1f;
  --border: rgba(20, 24, 29, 0.12);
}

[data-theme="dark"] {
  --bg: #0d1117;
  --surface: #161b22;
  --text: #e6e6e6;
  --text-dim: #b5bcc4;
  --accent: #e3a857;
  --border: rgba(230, 230, 230, 0.12);
}

.themed-img {
  margin: 24px 0;
  text-align: center;
  width: 100%;
  height: auto;        /* fixed height, adjust to taste */
  max-width: 700px;
  overflow: hidden;      /* pan-zoom handles internal scroll/zoom, not the browser */
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: auto;
}

.themed-img img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}

.themed-img .theme-dark { display: none; }

[data-theme="dark"] .themed-img .theme-light { display: none; }
[data-theme="dark"] .themed-img .theme-dark { display: block; }

.themed-img figcaption {
  margin-top: 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  color: var(--text-dim);
}

html {
  min-height: 100%;
}

body {
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.65;
  max-width: 900px;
  margin: 80px auto;
  padding: 0 24px;
  background-image: url('/images/bg-light.svg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

[data-theme="dark"] body {
  background-image: url('/images/bg-dark.svg');
}

.page-card {
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px 20px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    overflow-x: hidden;
}

@media (max-width: 900px) {
  body {
    padding: 16px 12px;
  }

  .page-card {
    padding: 24px 20px;
    border-radius: 8px;
} 
  
}

.math-block {
  overflow-x: auto;   /* long equations scroll instead of overflowing the card */
  padding: 8px 0;
  margin: 16px 0;
}

.katex { font-size: 1.05em; }

img, svg, video {
  max-width: 100%;
  height: auto;
}

h1, h2, h3 {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

h1 { font-size: 2.2rem; margin-bottom: 0.3em; }
h2 { font-size: 1.4rem; margin-top: 2em; }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}
a:hover { border-bottom-color: var(--accent); }

code, pre {
  font-family: 'IBM Plex Mono', monospace;
}

/* Navigation elements */

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  row-gap: 10px;
  align-items: center;
  margin-bottom: 40px;
}

nav button {
  margin-left: auto;
  background: none;
  border: 2px solid var(--text);
  border-radius: 6px;
  cursor: pointer;
  padding: 4px 8px;
}

@media(max-width: 480px) {
  nav {
    font-size: 0.85rem;
    gap: 12px;
  }
  nav button {
    margin-left: 0;
  }
}

pre {
  overflow-x: auto;
  max-width: 100%;
  padding: 12px;
  border-radius: 6px;
  -webkit-overflow-scrolling: touch;
}

pre code {
  white-space: pre;
}

/* Pictures */
.about-pfp {
  max-width: 100%;
  width: 300px;
  height: auto;
  margin: auto;
  display: block;
}

.home-img {
  max-width: 100%;
  width: 500px;
  height: auto;
  display: block;
  margin: auto;
}

/* List */
.two-col {
  column-count: 2;
  gap: 24px;
}

@media (max-width: 500px) {
  .two-col {
    columns: 1;     /* drop to single column in smaller devices */
  }
}

/* Code */
.CodeMirror {
  height: 300px;
  font-size: 14px;
  border-radius: 6px;
}

/* Project page style */

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 32px;
}

.project-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.project-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  margin: 0;
  border-bottom: 1px solid var(--border);
}

.project-card h2 {
  font-size: 1rem;
  margin: 14px 14px 4px;
}

.project-card p {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  margin: 0 14px 14px;
  color: var(--text-dim);
}

.video-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  margin: 24px 0;
  border: 1px solid var(--border);
}

.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* CV page style */

.cv-entry {
  display: flex;
  gap: 24px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
}

@media(max-width: 500px) {
  .cv-entry {
    flex-wrap: wrap;
  }
}

.cv-entry:first-of-type {
  border-top: none;
}

.cv-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 100px;
  flex-shrink: 0;
}

.cv-meta a {
  border: none;
  display: inline-block;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.cv-meta a:hover {
  transform: scale(1.05);
  opacity: 0.85;
}

.cv-date {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  color: var(--text-dim);
  white-space: nowrap;
  min-width: 100px;
}

.cv-logo {
  width: 62px;
  height: 62px;
  object-fit: contain;
  border-radius: 4px;
  opacity: 0.9;
}

.cv-details h3 {
  font-size: 1.05rem;
  margin: 0 0 4px;
}

.cv-details p {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin: 0 0 8px;
}

.cv-details li {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin: 0;
}

.cv-entry {
  margin-block: 1rem;
}

.cv-content {
  max-height: 4.5em;   /* roughly 3 lines at your body line-height */
  overflow: hidden;
  position: relative;
  transition: max-height 0.3s ease;
}

/* fade-out hint at the bottom when collapsed */
.cv-content::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 32px;
  background: linear-gradient(to bottom, transparent, var(--surface));
  transition: opacity 0.2s ease;
}

.expand-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: fit-content;
  margin: 10px auto 0;
  padding: 6px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.expand-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(230, 168, 87, 0.06); /* faint accent tint on hover */
}

.expand-btn::after {
  content: "▾";
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}

.expand-toggle:checked ~ .expand-btn::after {
  transform: rotate(180deg);
}

.expand-toggle:checked ~ .cv-content {
  max-height: 1000px;  /* large enough to fit full content */
}

.expand-toggle:checked ~ .cv-content::after {
  opacity: 0;
  pointer-events: none;
}

.show-less { display: none; }
.expand-toggle:checked ~ .expand-btn .show-more { display: none; }
.expand-toggle:checked ~ .expand-btn .show-less { display: inline; }

/* Skills theme */

.skills-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 28px;
  margin: 24px 0;
}

.skills-group h4 {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 10px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffffd2;
  color: #14181d;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.skill-chip:hover {
  border-color: var(--accent);
}

.skill-chip.active {
  border-color: var(--accent);
}

.skill-icon {
  width: 16px;
  height: 16px;
}

/* proficiency panel, injected under the clicked chip's group */
.skill-proficiency {
  width: 100%;
  margin-top: 4px;
  padding: 10px 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  display: none;
}

.skill-proficiency.visible {
  display: block;
}

.skill-proficiency-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  color: var(--text-dim);
}

.skill-proficiency-track {
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.skill-proficiency-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.skills-terminal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  margin: 24px 0;
}
.prompt { color: var(--accent); margin-right: 8px; }
.terminal-output {
  color: var(--text-dim);
  margin-top: 8px;
  line-height: 1.8;
}

/* Mermaid */

.brand rect,
.brand polygon,
.brand text,
.brand circle {
  color: var(--text) !important;
  fill: var(--surface) !important; 
}

.mermaid-wrapper {
  width: 100%;
  height: auto;        /* fixed height, adjust to taste */
  max-width: 700px;
  overflow: hidden;      /* pan-zoom handles internal scroll/zoom, not the browser */
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: auto;
}

.mermaid-wrapper svg {
  width: 100% !important;
  height: 100% !important;
}

.svg-pan-zoom-control {
  opacity: 0.4;
  transition: opacity 0.2s ease;
}

.svg-pan-zoom-control:hover {
  opacity: 1;
}

.svg-pan-zoom-control-background {
  fill: var(--bg);
  stroke: rgba(128, 128, 128, 0.3);
}

.svg-pan-zoom-control-element {
  fill: var(--text);
}

.mermaid-wrapper .svg-pan-zoom-control {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.mermaid-wrapper:hover .svg-pan-zoom-control {
  opacity: 0.6;
}

.zoom-controls {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.zoom-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
}

.zoom-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Regex project styling */

.regex-demo {
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--text);
    max-width: 720px;
    margin: 24px 0;
    line-height: 1.5;
}
 
.regex-demo * {
    box-sizing: border-box;
}
 
.regex-demo-status {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 16px;
}
 
.regex-demo-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 20px;
}
 
.regex-demo-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 6px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
 
.regex-demo-input {
    width: 100%;
    padding: 12px 14px;
    font-size: 16px;
    font-family: 'IBM Plex Mono', monospace;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    margin-bottom: 18px;
}
 
.regex-demo-input:last-of-type {
    margin-bottom: 0;
}
 
.regex-demo-input:focus {
    outline: none;
    border-color: var(--accent);
}
 
.regex-demo-result {
    font-size: 1.1rem;
    font-weight: 600;
    padding: 14px 16px;
    border-radius: 8px;
    margin-top: 18px;
    min-height: 1.1em;
}
 
/* Semantic colors (match / no-match / error) stay fixed across themes for
   clarity, but blended toward the current surface so they never clash. */
.regex-demo-result--match {
    background: color-mix(in srgb, #16a34a 16%, var(--surface));
    color: #16a34a;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 14px 16px;
    border-radius: 8px;
    margin-top: 18px;
    min-height: 1.1em;
}
 
.regex-demo-result--no-match {
    background: color-mix(in srgb, #dc2626 14%, var(--surface));
    color: #dc2626;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 14px 16px;
    border-radius: 8px;
    margin-top: 18px;
    min-height: 1.1em;
}
 
.regex-demo-result--error {
    background: color-mix(in srgb, var(--accent) 20%, var(--surface));
    color: var(--accent);
    font-size: 1.1rem;
    font-weight: 600;
    padding: 14px 16px;
    border-radius: 8px;
    margin-top: 18px;
    min-height: 1.1em;
}
 
.regex-demo-result--idle {
    color: var(--text-dim);
    background: transparent;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 14px 16px;
    border-radius: 8px;
    margin-top: 18px;
    min-height: 1.1em;
}
 
.regex-demo-examples-wrap {
    margin-bottom: 8px;
}
 
.regex-demo-examples {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
 
.regex-demo-example-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 6px 12px;
    border-radius: 20px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    cursor: pointer;
}
 
.regex-demo-example-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
 
.regex-demo-footnote {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-top: 24px;
}
 
.regex-demo-footnote code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 5px;
    font-family: 'IBM Plex Mono', monospace;
}

/* Lunar Lander */
.landing-videos {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  width: 100%;
}

.landing-videos video {
  width: 300px;
  height: auto;
  margin-right: 10px;
  margin-top: 10px;
}

@media(max-width: 500px) {
  .landing-videos {
    flex-wrap: wrap;
  }
}

/* Blog styling */

.post-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 28px;
}

.post-entry {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 0;
  border-top: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}

.post-entry:first-child { border-top: none; }

.post-date {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.post-info h2 {
  font-size: 1.1rem;
  margin: 2px 0 4px;
  transition: color 0.15s ease;
}

.post-entry:hover .post-info h2 {
  color: var(--accent);
}

.post-info p {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin: 0;
}

.back-link {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 20px;
  border: none;
}
.back-link:hover { color: var(--accent); }

.post-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 28px;
}

.post-body {
  line-height: 1.75;
}
.post-body h2 {
  margin-top: 2em;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.post-body p {
  margin-bottom: 1.2em;
}

/** Proofs and theorems **/
.post-body { counter-reset: thm; }

.thm {
  counter-increment: thm;
  margin: 24px 0;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
}

.thm-head {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  margin-bottom: 8px;
}

.thm-label {
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.thm-label::after { content: " " counter(thm); }
.thm-title { color: var(--text-dim); }

.thm-body { overflow-x: auto; }   /* wide equations scroll instead of spilling out */
.thm-body > :last-child { margin-bottom: 0; }

/* quieter kinds: definitions get a muted border, remarks/examples are unnumbered and dashed */
.thm-definition { border-left-color: var(--text-dim); }
.thm-definition .thm-label { color: var(--text-dim); }

.thm-remark,
.thm-example {
  counter-increment: none;
  background: none;
  border-style: dashed;
  border-left-color: var(--border);
}
.thm-remark .thm-label,
.thm-example .thm-label { color: var(--text-dim); }
.thm-remark .thm-label::after,
.thm-example .thm-label::after { content: none; }

/* proofs: lighter than the statement so the theorem stays the focus */
details.proof {
  background: none;
  border: none;
  border-left: 2px solid var(--border);
  border-radius: 0;
  padding: 0 0 0 16px;
  margin: 0 0 24px;
}

.proof summary {
  justify-content: flex-start;
  gap: 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--text-dim);
}

.proof-body { margin-top: 10px; overflow-x: auto; }
.proof-body > p:last-of-type { display: inline; }

.qed {
  display: block;
  text-align: right;
  color: var(--text-dim);
}