/* What: Global design tokens. Why: centralize theme values for consistent styling and quick future edits. */
:root {
  --bg: #f6f3ee;
  --paper: #fffdf8;
  --text: #1f1b16;
  --muted: #6f655b;
  --accent: #c44c28;
  --accent-soft: #f2d3c8;
  --line: #dfd4c5;
  --shadow: 0 16px 32px rgba(45, 32, 20, 0.08);
}

/* What: Universal sizing model. Why: keep width/height calculations predictable across all elements. */
* {
  box-sizing: border-box;
}

/* What: Base page look and typography. Why: establish overall visual identity and layered background atmosphere. */
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  background:
    radial-gradient(circle at 12% 10%, #f6d9b9 0%, transparent 40%),
    radial-gradient(circle at 90% 90%, #e9d7ef 0%, transparent 42%),
    var(--bg);
}

/* What: Shared decorative blob behavior. Why: keep background accents fixed and behind content. */
.bg-shape {
  position: fixed;
  border-radius: 999px;
  z-index: -1;
  filter: blur(2px);
}

/* What: Top-right accent blob. Why: add warm visual depth without distracting from content. */
.bg-shape-1 {
  width: 22rem;
  height: 22rem;
  top: -7rem;
  right: -4rem;
  background: rgba(196, 76, 40, 0.13);
}

/* What: Bottom-left accent blob. Why: balance composition and avoid a flat page background. */
.bg-shape-2 {
  width: 20rem;
  height: 20rem;
  bottom: -8rem;
  left: -5rem;
  background: rgba(24, 119, 95, 0.13);
}

/* What: Header container layout. Why: align brand and action controls with consistent max width. */
.topbar {
  max-width: 1100px;
  margin: 1.4rem auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* What: Brand text emphasis. Why: strengthen personal identity at first glance. */
.brand {
  font-family: "Pinyon Script", "Brush Script MT", cursive;
  font-size: 2rem;
  font-weight: 400;
  letter-spacing: 0.01em;
}

#brandName {
  font-family: "Pinyon Script", "Brush Script MT", cursive !important;
  font-size: 2rem;
  font-weight: 400;
  letter-spacing: 0.01em !important;
}

/* What: Action controls row. Why: keep language and PDF buttons organized and wrap safely on small widths. */
.controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* What: Base style for pill buttons. Why: provide a clean reusable control component. */
.chip {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--text);
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  font: inherit;
}

/* What: Active language state. Why: clearly show which locale is currently selected. */
.chip.active {
  border-color: var(--accent);
  color: var(--accent);
}

/* What: Primary call-to-action variant. Why: make PDF button visually stronger than secondary controls. */
.chip.accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* What: Main two-column page grid. Why: separate profile sidebar and content for fast scanning. */
.layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 60px;
  gap: 1rem;
  align-items: start;
}

/* What: Shared card shell for sidebar and sections. Why: enforce one visual system for all panels. */
.profile-card,
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

/* What: Sidebar profile card behavior. Why: keep key identity/contact info visible while scrolling. */
.profile-card {
  padding: 1.1rem;
  position: sticky;
  top: 1rem;
  height: fit-content;
}

/* What: Profile image sizing and framing. Why: keep portrait clean and aligned with card style. */
.profile-photo {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
}

/* What: Main name heading scale. Why: give clear visual priority to the person name. */
h1 {
  margin: 0.8rem 0 0.2rem;
  font-size: 1.5rem;
}

/* What: Section heading scale. Why: keep hierarchy clear between page title and section titles. */
h2 {
  margin: 0;
  font-size: 1.2rem;
}

/* What: Supporting text style for subtitle/location. Why: reduce visual weight of secondary metadata. */
.headline,
.meta {
  margin: 0.35rem 0;
  color: var(--muted);
}

/* What: Contact link styling. Why: keep links readable while preserving a clean card appearance. */
.contact-link {
  display: block;
  margin: 0.45rem 0;
  color: var(--text);
  text-decoration: none;
}

/* What: Hover affordance for links. Why: provide clear interactivity feedback. */
.contact-link:hover {
  text-decoration: underline;
}

/* What: Section stack container. Why: maintain consistent vertical spacing between CV blocks. */
.content {
  display: grid;
  gap: 1rem;
}

/* What: Inner spacing for every panel. Why: keep text readable and balanced within cards. */
.panel {
  padding: 1.1rem;
}

/* What: Section heading layout helper. Why: align title with detail trigger button for popup actions. */
.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

/* What: Small detail-action button. Why: open richer section context without crowding the main section body. */
.detail-trigger {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.detail-trigger:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* What: Body text typography rules. Why: improve long-text readability with serif and line height. */
.panel p,
.timeline p {
  font-family: "Source Serif 4", serif;
  font-size: 1.02rem;
  line-height: 1.6;
}

#bioText {
  text-align: justify;
}

/* What: Horizontal group for featured links. Why: keep key links compact and responsive. */
.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 0.8rem;
}

/* What: Visual style for thesis/MLOps links. Why: make important links distinct from plain text. */
.action-link {
  text-decoration: none;
  color: var(--accent);
  border: 1px solid var(--accent-soft);
  background: #fff;
  border-radius: 12px;
  padding: 0.55rem 0.8rem;
}

/* What: Timeline container spacing. Why: structure experience/education entries with consistent rhythm. */
.timeline {
  display: grid;
  gap: 0.8rem;
  margin-top: 0.8rem;
}

/* What: Individual timeline item marker. Why: create a simple visual timeline cue. */
.timeline-item {
  border-left: 3px solid var(--accent-soft);
  padding-left: 0.8rem;
}

/* What: Timeline item heading reset. Why: prevent default margins from breaking card spacing. */
.timeline-item h3 {
  margin: 0;
}

.timeline-role,
.timeline-org {
  display: block;
  font-size: calc(1em - 4px);
}

.timeline-org {
  font-weight: 500;
}

.timeline-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

/* What: Timeline period text style. Why: keep dates readable but visually secondary. */
.timeline-item .period {
  font-size: 0.9rem;
  color: var(--muted);
}

/* What: Responsive certifications grid. Why: adapt card count to available width automatically. */
.cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
  margin-top: 0.8rem;
}

/* What: Certification card shell. Why: frame each certificate preview consistently. */
.cert-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

/* What: Certificate image constraints. Why: keep grid uniform and avoid layout shift. */
.cert-card img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
}

/* What: Certificate link text area. Why: make title/click target easy to use. */
.cert-card a {
  display: block;
  padding: 0.65rem;
  text-decoration: none;
  color: var(--text);
}

/* What: Skills chip layout. Why: make skills compact and clickable for evidence drill-down. */
.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.8rem;
}

.skills-cv-list {
  display: grid;
  gap: 0.75rem;
  width: 100%;
}

.skills-cv-row {
  border-left: 3px solid var(--accent-soft);
  padding-left: 0.75rem;
}

.skills-cv-title {
  margin: 0;
  font-size: 0.98rem;
}

.skills-cv-text {
  margin: 0.25rem 0 0;
}

.skill-chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  font: inherit;
  cursor: pointer;
}

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

/* What: Right-side section rail container. Why: provide always-available section shortcuts with soft visual presence. */
.section-rail {
  grid-column: 3;
  grid-row: 1;
  position: sticky;
  top: 1rem;
  align-self: start;
  justify-self: end;
}

.section-rail ul {
  list-style: none;
  margin: 0;
  padding: 0.4rem;
  display: grid;
  gap: 0.5rem;
  border: 1px solid rgba(223, 212, 197, 0.7);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.rail-link {
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  position: relative;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  overflow: visible;
  border-radius: 999px;
  transition: opacity 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.rail-link:hover {
  background: rgba(196, 76, 40, 0.14);
  transform: translateX(-1px);
}

.rail-link.active {
  background: rgba(196, 76, 40, 0.2);
}

.rail-dot {
  width: 0.46rem;
  height: 0.46rem;
  border-radius: 999px;
  background: currentColor;
}

.rail-glyph {
  font-size: 0.85rem;
  line-height: 1;
  font-weight: 700;
}

.rail-link-edge {
  border: 1px solid rgba(196, 76, 40, 0.22);
  background: rgba(196, 76, 40, 0.08);
}

.rail-label {
  position: absolute;
  left: calc(100% + 0.55rem);
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  font-size: 0.78rem;
  color: var(--text);
  background: transparent;
  border-radius: 999px;
  padding: 0.1rem 0.25rem;
  opacity: 0.5;
  visibility: visible;
  pointer-events: auto;
  cursor: pointer;
  transition: opacity 150ms ease, transform 150ms ease;
}

.rail-link.active .rail-label {
  opacity: 0.75;
}

.rail-link:hover .rail-label,
.rail-link:focus-visible .rail-label {
  opacity: 1;
  transform: translateY(-50%);
}

/* What: Shared hidden utility. Why: toggle modal visibility without DOM removal. */
.hidden {
  display: none;
}

/* What: Backdrop for detail modal. Why: focus user attention on deep-dive content. */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(20, 16, 12, 0.45);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.modal-backdrop.hidden {
  display: none;
}

.detail-modal {
  width: min(980px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1rem;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
}

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

#detailModalTitle {
  margin: 0 2.2rem 0.7rem 0;
}

/* A modal image gives a user the ability to display a larger version of an image */
.modal-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.65rem;
  margin-top: 0.9rem;
}

.modal-images img {
  width: 100%;
  height: auto;
  max-height: 30vh;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--line);
  display: block;
  cursor: zoom-in;
}

.about-resource-block {
  margin-top: 1rem;
}

.about-resource-block h4 {
  margin: 0;
  font-size: 1rem;
}

.about-resource-block p {
  margin: 0.45rem 0 0;
}

.about-resource-list {
  margin: 0.65rem 0 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.35rem;
}

.about-resource-list a {
  color: var(--accent);
  text-decoration: none;
}

.about-resource-list a:hover {
  text-decoration: underline;
}

.about-resource-note {
  color: var(--muted);
}

.image-lightbox-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(12, 10, 8, 0.78);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.image-lightbox-backdrop.hidden {
  display: none;
}

.image-lightbox {
  position: relative;
  width: min(1200px, 96vw);
  max-height: 92vh;
  display: grid;
  place-items: center;
}

.image-lightbox-caption {
  position: absolute;
  left: 0;
  right: 3.2rem;
  bottom: calc(100% + 0.45rem);
  margin: 0;
  padding: 0.42rem 0.65rem;
  text-align: center;
  border-radius: 10px;
  background: rgba(12, 10, 8, 0.66);
  color: #fff;
  font-size: 0.98rem;
  line-height: 1.35;
  z-index: 1;
  pointer-events: none;
}

.image-lightbox img {
  max-width: 100%;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(0, 0, 0, 0.2);
}

.image-lightbox-close {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(12, 10, 8, 0.8);
  color: #fff;
  border-radius: 999px;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
}

.image-lightbox-close:hover {
  border-color: #fff;
}

.modal-links {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.9rem;
}

.modal-links a {
  color: var(--accent);
  text-decoration: none;
}

.modal-links a:hover {
  text-decoration: underline;
}

.modal-body {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.5rem;
}

.modal-body p {
  margin: 0;
}

.modal-tabs {
  margin-top: 0.9rem;
}

.modal-tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}

.modal-tab-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font: inherit;
  cursor: pointer;
}

.modal-tab-button[aria-selected="true"] {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, #fff);
}

.modal-tab-button:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
}

.modal-tab-panel {
  border-top: 1px solid var(--line);
  padding-top: 0.25rem;
}

/* What: Footer width and tone. Why: align with page grid while keeping low emphasis. */
.footer {
  max-width: 1100px;
  margin: 0 auto 2rem;
  padding: 0 1rem;
  color: var(--muted);
}

/* What: Entry animation hook. Why: add subtle perceived polish during page load. */
.reveal {
  animation: revealUp 540ms ease both;
}

/* What: Upward fade keyframes. Why: provide gentle motion without being distracting. */
@keyframes revealUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* What: Tablet/mobile layout adjustments. Why: collapse to one column for narrow screens. */
@media (max-width: 900px) {
  /* What: Single-column content flow. Why: improve readability and avoid cramped sidebars on mobile. */
  .layout {
    grid-template-columns: 1fr;
  }

  /* What: Disable sticky sidebar on small screens. Why: prevent awkward scroll behavior on mobile. */
  .profile-card {
    position: static;
  }

  .section-rail {
    display: none;
  }
}

/* What: Print-specific styles for PDF export. Why: produce a clean CV document without UI chrome. */
@media print {
  /* Keep print output visually close to the on-screen design. */
  body {
    background: var(--bg);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Hide UI/navigation and interactive overlays in print. */
  .bg-shape,
  .topbar,
  .controls,
  .footer,
  .section-rail,
  .detail-trigger,
  .modal-backdrop,
  .image-lightbox-backdrop {
    display: none;
  }

  /* Use a compact two-column print layout to keep profile and first sections on page one. */
  .layout {
    grid-template-columns: 220px minmax(0, 1fr);
    max-width: none;
    padding: 0;
    gap: 0.6rem;
    align-items: start;
  }

  .profile-card {
    position: static;
    top: auto;
    padding: 0.75rem;
    break-inside: avoid;
  }

  .profile-photo {
    max-height: 180px;
    width: 100%;
    object-fit: cover;
  }

  .content {
    gap: 0.6rem;
  }

  .panel {
    break-inside: auto;
  }

  .timeline-item {
    break-inside: avoid;
  }

  /* Remove certifications from print output. */
  #certSection {
    display: none;
  }
}
