@font-face {
  font-family: "Carlito";
  src: url("assets/fonts/Carlito-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Carlito";
  src: url("assets/fonts/Carlito-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

:root {
  --bg: #ffffff;
  --surface: #f4f5f6;
  --text: #111820;
  --muted: #67717d;
  --line: #cfd4da;
  --placeholder: #d9dde1;
  --placeholder-text: #929aa3;
  --shadow: 0 18px 60px rgba(17, 24, 32, 0.16);
}

:root[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #171a20;
  --text: #f4f7fb;
  --muted: #a8b0ba;
  --line: #2a2f36;
  --placeholder: #252a31;
  --placeholder-text: #7c858f;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.5);
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Carlito", Calibri, "Segoe UI", Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

body.modal-open {
  overflow: hidden;
}

.page-shell {
  width: min(1680px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 56px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  gap: 40px;
  align-items: flex-start;
  padding: 28px 0 24px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(12px);
}

.site-header h1 {
  margin: 0;
  font-size: clamp(2.5rem, 4.8vw, 4.7rem);
  line-height: 0.95;
  letter-spacing: -0.045em;
  font-weight: 800;
}

.site-header > div:first-child {
  min-width: 0;
}

.role {
  display: inline-block;
  max-width: 100%;
  margin: 10px 0 8px;
  padding: 6px 10px;
  background: #2e74b5;
  color: #ffffff;
  font-size: 1.05rem;
  letter-spacing: 0.28em;
  font-weight: 500;
}

.stack,
.meta {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.stack {
  color: var(--text);
  letter-spacing: 0.08em;
  font-size: 0.85rem;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  margin-top: 16px;
}

.email-link,
.linkedin-link,
.github-link,
.resume-link,
.theme-toggle {
  border: 1px solid var(--text);
  color: var(--text);
  background: transparent;
  text-decoration: none;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  font-weight: 700;
  padding: 14px 18px;
  min-height: 46px;
  transition: 0.2s ease;
}

.header-actions > a,
.header-actions > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.button-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.theme-toggle {
  cursor: pointer;
  font-family: inherit;
}

.email-link:hover,
.linkedin-link:hover,
.github-link:hover,
.resume-link:hover,
.theme-toggle:hover {
  background: var(--text);
  color: var(--bg);
}

.work-section {
  padding-top: 28px;
}

.section-heading {
  margin-bottom: 28px;
}

.section-heading h2 {
  margin: 0 0 8px;
  font-size: clamp(1.8rem, 2.7vw, 2.7rem);
  letter-spacing: -0.025em;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 48px 40px;
}

.project-card {
  min-width: 0;
}

.project-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.project-open:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 5px;
}

.project-cover {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  background: var(--surface);
  margin-bottom: 14px;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.project-open:hover .project-cover {
  transform: translateY(-3px);
}

.project-status {
  color: var(--muted);
  line-height: 1.5;
}

.project-card h3 {
  margin: 0 0 8px;
  font-size: 1.35rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.project-card p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.95rem;
}

.about-section {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 64px;
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

.about-section h2 {
  margin: 0 0 18px;
  font-size: clamp(1.8rem, 2.7vw, 2.7rem);
  letter-spacing: -0.025em;
}

.about-section p {
  max-width: 70ch;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.about-focus h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.about-focus p {
  margin: 0 0 20px;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  color: var(--text);
  text-underline-offset: 4px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.tags,
.modal-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.88rem;
}

.tech-tag {
  display: inline-block;
  max-width: 100%;
  padding: 4px 10px;
  background: #edf0f3;
  color: #111820;
  font-weight: 500;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

:root[data-theme="dark"] .tech-tag {
  background: #303640;
  color: #f4f7fb;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
}

.modal.is-open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(7px);
}

.modal-panel {
  position: relative;
  width: min(1180px, calc(100% - 40px));
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  margin: 0;
  overflow: auto;
  background: var(--bg);
  box-shadow: var(--shadow);
}

.modal-close {
  position: sticky;
  top: 14px;
  z-index: 3;
  float: right;
  margin: 14px 14px 0 0;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}

.modal-content {
  padding: 34px;
}

.modal-copy {
  max-width: 760px;
  margin-bottom: 26px;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  font-weight: 700;
  color: var(--muted);
}

.modal-copy h2 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 4vw, 4.4rem);
  letter-spacing: -0.04em;
  line-height: 0.98;
}

.modal-copy p {
  color: var(--muted);
  line-height: 1.6;
}

.modal-tech {
  font-size: 0.92rem;
}

.modal-gallery {
  display: grid;
  place-items: center;
  background: var(--surface);
}

.gallery-figure {
  margin: 0;
}

.gallery-caption {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.project-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.project-details h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.project-details p,
.project-details ul {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.project-details ul {
  padding-left: 20px;
}

.project-details li + li {
  margin-top: 8px;
}

.gallery-navigation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
}

.gallery-navigation[hidden] {
  display: none;
}

.gallery-arrow {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--text);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1.5rem;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.gallery-arrow:hover {
  background: var(--text);
  color: var(--bg);
}

.gallery-arrow:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

.gallery-counter {
  min-width: 4ch;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.gallery-media {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: clamp(260px, 55vh, 580px);
  object-fit: contain;
  background: var(--surface);
}

@media (max-width: 1200px) {
  .site-header {
    flex-direction: column;
    gap: 20px;
  }

  .header-actions {
    margin-top: 0;
  }
}

@media (max-width: 980px) {
  .portfolio-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}

@media (max-width: 640px) {
  .page-shell {
    width: calc(100% - 20px);
  }

  .site-header {
    position: static;
    gap: 20px;
    padding: 20px 0;
  }

  .site-header h1 {
    font-size: clamp(1.75rem, 8.5vw, 2.5rem);
    line-height: 1.05;
    overflow-wrap: anywhere;
  }

  .portfolio-grid {
    grid-template-columns: 1fr;
    gap: 44px;
  }

  .role {
    font-size: 0.85rem;
    letter-spacing: 0.14em;
    line-height: 1.5;
  }

  .stack,
  .meta {
    font-size: 0.82rem;
  }

  .header-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .email-link,
  .linkedin-link,
  .github-link,
  .resume-link,
  .theme-toggle {
    min-width: 0;
    min-height: 46px;
    padding: 12px;
    text-align: center;
  }

  .about-section,
  .project-details {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .about-section {
    margin-top: 44px;
    padding-top: 24px;
  }

  .work-section {
    padding-top: 24px;
  }

  .section-heading {
    margin-bottom: 22px;
  }

  .section-heading p {
    font-size: 0.95rem;
    line-height: 1.5;
  }

  .modal-panel {
    width: min(100% - 20px, 1180px);
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
    margin: 0;
  }

  .modal-content {
    padding: 22px;
  }

  .gallery-media {
    height: min(55vh, 480px);
    height: min(55dvh, 480px);
  }
}
