:root {
  --bg: #3d2d1b;
  --panel: #4c3922;
  --panel-alt: #665027;
  --bar: #7a512d;
  --border: #a27b38;
  --border-strong: #d0a653;
  --text: #fff4cf;
  --muted: #dfc48b;
  --accent: #f2c866;
  --control: #604725;
  --control-hover: #80602c;
  --link-surface: var(--control);
  --link-hover: var(--control-hover);
  --warm-cream: #ffe8ad;
  --ui: Verdana, Geneva, Tahoma, sans-serif;
  --max-width: 720px;
  --grid-gap: clamp(12px, 1.5vw, 18px);
}

* { box-sizing: border-box; }

html, body { margin: 0; background: var(--bg); transition: background-color 0.2s ease; }

body {
  min-height: 100vh;
  padding: clamp(18px, 3.5vh, 44px) 16px 16px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-y: auto;
  color: var(--text);
  font: clamp(12px, 1.5vw, 14px)/1.5 var(--ui);
}

html.light-mode {
  --bg: #fff4c2;
  --panel: #fffdf1;
  --panel-alt: #f6df9b;
  --bar: #7a512d;
  --border: #9a6a27;
  --border-strong: #70451f;
  --text: #3d2815;
  --muted: #62421f;
  --accent: #70451f;
  --control: #fff0bb;
  --control-hover: #edcf73;
  --project-surface: #fff8dc;
  --link-surface: #f1d99d;
  --link-hover: #edcf73;
  --warm-cream: #fff3bd;
}

html.light-mode .site-chrome { border-color: var(--border); }
html.light-mode .profile-avatar-col { border-color: var(--border); background: var(--panel); }
html.light-mode .avatar-box { background: var(--warm-cream); }
html.light-mode .profile-header { background: var(--panel); }
html.light-mode .panel-bar {
  background: var(--bar);
  color: #fff4cf;
}
html.light-mode .panel-bar::before { color: var(--warm-cream); }
html.light-mode .tag,
html.light-mode .meta-chip,
html.light-mode .action-chip { border-color: var(--border); }
html.light-mode .tag { color: #5c4008; }
html.light-mode .tag:hover,
html.light-mode .action-chip:hover { background: var(--link-hover); }
html.light-mode .social-icon { color: var(--accent); }
html.light-mode .social-icon:hover { color: var(--border-strong); }

a { color: var(--accent); text-decoration: none; }
a:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
button { font-family: inherit; }
button:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }

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

.site-wrap {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--grid-gap);
}

.site-chrome {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1px 9px;
  border-bottom: 1px dashed #795c2d;
  color: var(--muted);
  font-size: 10px;
}

.site-chrome-logo span { color: var(--accent); }

.site-chrome-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
  padding: 0;
  transition: color 150ms ease;
}

.site-chrome-btn:hover { color: var(--accent); }

.profile-header {
  position: relative;
  display: grid;
  grid-template-columns: 170px 1fr;
  border: 1px solid var(--border-strong);
  background: var(--panel);
}

.profile-panel {
  position: relative;
  z-index: 2;
  overflow: visible;
}

.profile-panel > .panel-bar {
  position: relative;
  z-index: 1;
}

.profile-panel .profile-header {
  border: none;
}

.profile-avatar-col {
  display: grid;
  place-items: center;
  padding: 20px 16px;
  border-right: none;
  background: var(--panel);
}

.avatar-box {
  width: 120px;
  height: 120px;
  display: grid;
  place-items: center;
  border: 2px solid var(--border-strong);
  background: #49331d;
}

.avatar-box::after {
  content: attr(data-initials);
  font: bold 38px/1 var(--ui);
  color: var(--accent);
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-box.has-image::after { content: none; }

.profile-info-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  padding: 20px 24px;
}

.profile-name {
  margin: 0;
  font: bold clamp(20px, 5vw, 28px)/1.1 var(--ui);
}

.profile-role {
  margin: 2px 0;
  color: var(--accent);
  font-size: clamp(11px, 2.5vw, 13px);
  font-weight: bold;
  letter-spacing: 0.03em;
}

.profile-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.profile-meta {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-top: 4px;
}

.profile-actions {
  display: flex;
  gap: 8px;
}

.profile-actions .meta-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.meta-chip {
  padding: 4px 10px;
  border: 1px solid var(--border);
  background: var(--link-surface);
  color: var(--text);
  font-size: 11px;
  white-space: nowrap;
}

.action-chip { transition: background-color 150ms ease, border-color 150ms ease; cursor: pointer; color: var(--text); }
.action-chip:hover { border-color: var(--accent); background: var(--link-hover); color: var(--text); }

.contact-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 16px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(320px, calc(100vw - 32px));
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 6px 18px rgb(0 0 0 / 25%);
  opacity: 1;
  transform: translateY(0);
  transition: opacity 150ms ease, transform 150ms ease, visibility 150ms ease;
}

.contact-panel.hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-5px);
}

.contact-icons {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 20px;
  background: transparent;
  border: none;
  transition: color 150ms ease, transform 150ms ease;
}

.social-icon:hover {
  color: var(--accent);
  transform: translateY(-2px);
}

.raw-email {
  font: bold 12px/1.4 var(--ui);
  color: var(--accent);
  word-break: break-all;
  text-decoration: underline;
  text-decoration-color: transparent;
  white-space: nowrap;
  transition: text-decoration-color 150ms ease;
}

.raw-email:hover {
  text-decoration-color: var(--accent);
}

.email-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.email-row .raw-email {
  min-width: 0;
  flex: 1;
  padding: 6px 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--accent);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-email-btn {
  flex-shrink: 0;
  padding: 4px 8px;
  border: 1px solid var(--border);
  background: var(--link-surface);
  font: 11px/1 var(--ui);
}

.container {
  display: flex;
  flex-direction: column;
  gap: var(--grid-gap);
  padding: 0;
}

.project-page { gap: 16px; }
.return-link { align-self: flex-start; }

@media (min-width: 681px) and (min-height: 721px) {
  .container:not(.project-page) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .container:not(.project-page) > #overview,
  .container:not(.project-page) > #projects,
  .container:not(.project-page) > #experience,
  .container:not(.project-page) > #education,
  .container:not(.project-page) > #certifications,
  .container:not(.project-page) > #skills {
    grid-column: 1 / -1;
  }

}

.panel {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: 0 3px 12px rgb(0 0 0 / 15%);
}

.container > .panel {
  overflow: hidden;
}

.panel--accent { border-color: var(--border-strong); }

.panel-bar {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-strong);
  background: var(--bar);
  color: #fff4cf;
  font: bold 12.5px/1.2 var(--ui);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.panel-bar::before { content: "> "; color: var(--accent); }
.panel-body { padding: 16px 18px; }

.bio-text { font-size: 13px; line-height: 1.6; }
.bio-text p { margin: 0; }
.bio-text p + p { margin-top: 12px; }

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 12px;
  align-items: start;
}

.project-card {
  border: 1px solid var(--border);
  background: var(--panel-alt);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

html.light-mode .project-image-wrapper { background: var(--panel); }
html.light-mode .project-card { background: var(--project-surface); }
html.light-mode .view-project-link,
html.light-mode .project-github-link { background: var(--link-surface); }
html.light-mode .view-project-link:hover,
html.light-mode .project-github-link:hover { background: var(--link-hover); color: var(--text); }

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

.project-image-wrapper {
  aspect-ratio: 16 / 10;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  background: var(--bg);
}

.project-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 240ms ease;
}

.project-card:hover .project-image { transform: scale(1.025); }

.project-content {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-card .tag {
  background: var(--link-surface);
  border-color: var(--border-strong);
  color: var(--text);
}

html.light-mode .project-card .tag {
  background: var(--link-surface);
  border-color: var(--border);
  color: var(--text);
}

.project-title { font: bold 13px/1.25 var(--ui); color: var(--text); margin: 0; }
.project-tagline { font: 10px/1.2 var(--ui); color: var(--accent); margin: 0; text-transform: uppercase; letter-spacing: 0.05em; }

.project-description-container {
  display: none;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
  border-top: 1px dashed var(--border-strong);
  padding-top: 10px;
}

.project-card.expanded .project-description-container {
  display: flex;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.project-description { font: 12px/1.5 var(--ui); color: var(--muted); margin: 0; flex-grow: 1; }
.project-status, .project-detail-status { margin: 0; color: var(--muted); }
.view-project-link { align-self: flex-start; padding: 6px 10px; border: 1px solid var(--border); background: var(--link-surface); color: var(--text); font: bold 11px/1 var(--ui); margin-top: 2px; }
.view-project-link:hover { border-color: var(--accent); background: var(--link-hover); color: var(--text); }

.project-detail-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin: -16px -18px 16px;
  padding: 18px;
  border-bottom: 1px solid var(--border-strong);
  background: var(--panel);
}

html.light-mode .project-detail-hero {
  background: var(--panel);
}

.project-detail-header {
  flex: 1;
  min-width: 0;
}
.project-detail-title {
  margin: 0 0 8px;
  font: bold clamp(22px, 4vw, 28px)/1.1 var(--ui);
  letter-spacing: -0.01em;
}
.project-detail-tagline {
  margin: 0 0 10px;
  color: var(--text);
  font: 12px/1.3 var(--ui);
  letter-spacing: 0.03em;
}
.project-detail-actions { flex-shrink: 0; }
.project-github-link { display: inline-flex; align-items: center; gap: 7px; padding: 8px 10px; border: 1px solid var(--border); background: var(--link-surface); color: var(--text); font: bold 11px/1 var(--ui); }
.project-github-link:hover { border-color: var(--accent); background: var(--link-hover); color: var(--text); }
.project-detail-content {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
}

html.light-mode .project-detail-content {
  background: var(--panel);
}

html.light-mode .project-page .panel {
  background: var(--panel);
}

.project-gallery {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.project-detail-image-wrapper {
  aspect-ratio: 16 / 10;
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--bg);
}

.project-detail-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.project-detail-section-title { margin: 0 0 8px; color: var(--accent); font: bold 12px/1.2 var(--ui); text-transform: uppercase; }
.project-detail-description { margin: 0; line-height: 1.7; }

.timeline {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px dashed var(--border);
}

.timeline-item:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.timeline-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0;
}

.timeline-icon img { width: 100%; height: 100%; object-fit: contain; }
.timeline-content { flex: 1; min-width: 0; }

.timeline-date {
  font: 11px/1.2 var(--ui);
  color: var(--accent);
  display: block;
  margin-bottom: 6px;
}

.timeline-role { font: bold 14px/1.2 var(--ui); color: var(--text); margin: 0 0 4px; }
.timeline-org { font: 12px/1.4 var(--ui); color: var(--muted); margin: 0 0 8px; font-style: italic; }
.timeline-desc { margin: 0; }

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.skill-title {
  font: bold 12px/1.2 var(--ui);
  color: var(--accent);
  margin: 0 0 10px 0;
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; justify-content: flex-start; }

.tag {
  width: fit-content;
  display: inline-flex;
  padding: 4px 10px;
  border: 1px solid var(--border);
  background: var(--link-surface);
  color: var(--text);
  font: clamp(10.5px, 0.82vw, 11.5px)/1.2 var(--ui);
  white-space: nowrap;
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
  align-items: center;
  gap: 6px;
}

.tag:hover { border-color: var(--accent); background: var(--link-hover); transform: translateY(-1px); }

.footer-panel {
  width: 100%;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
}

.footer-text { color: var(--muted); font-size: 11px; line-height: 1.3; text-align: center; }

.footer-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 6px;
  color: var(--muted);
  font: 10px/1.3 var(--ui);
  text-align: center;
}

.footer-top-link {
  color: var(--accent);
  text-decoration: none;
  transition: color 120ms ease;
}

.footer-top-link:hover,
.footer-top-link:focus-visible { color: var(--link); }

@media (max-width: 680px), (max-height: 720px) {
  body { padding: 20px 14px; overflow: auto; }
  .site-wrap { gap: 10px; }
  .profile-header { display: flex; flex-direction: column; }
  .profile-avatar-col {
    position: relative;
    padding: 18px 16px 20px;
    border-right: none;
    border-bottom: none;
    background: var(--panel);
  }
  .profile-avatar-col::after {
    content: "";
    position: absolute;
    right: 16px;
    bottom: 0;
    left: 16px;
    border-bottom: 2px dotted var(--border-strong);
  }
  html.light-mode .profile-avatar-col { background: var(--panel); }
  .avatar-box { width: min(128px, 42vw); height: min(128px, 42vw); }
  .avatar-box::after { font-size: clamp(26px, 9vw, 34px); }
  .profile-info-col {
    align-items: center;
    gap: 8px;
    padding: 16px;
    text-align: center;
  }
  .profile-role { line-height: 1.4; }
  .profile-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }
  .profile-status {
    grid-column: 1 / -1;
    justify-content: center;
  }
  .profile-actions { display: contents; }
  .profile-actions .action-chip { flex: 1; justify-content: center; }
  .meta-chip { padding: 3px 6px; font-size: 10px; }
  .social-icon { font-size: 16px; }
  .tags { gap: 4px; }
  .skills-grid { grid-template-columns: 1fr; gap: 16px; }
  .timeline-item { flex-direction: column; gap: 10px; }
  .timeline-icon { width: 36px; height: 36px; }
  .projects-grid { grid-template-columns: 1fr; gap: 10px; }
  .project-content { padding: 10px 12px; }
  .contact-panel { right: 10px; }
  .project-detail-hero { align-items: flex-start; flex-direction: column; gap: 14px; }
  .project-detail-actions { width: 100%; }
  .project-github-link { justify-content: center; width: 100%; }
  .project-card:hover .project-image { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .tag, .action-chip, .project-card, .project-image, .social-icon, .contact-panel { transition: none; }
  .tag:hover, .action-chip:hover, .project-card:hover, .social-icon:hover { transform: none; }
  .project-card:hover .project-image { transform: none; }
  .project-card.expanded .project-description-container { animation: none; }
}
