/* ===== Tokens ===== */
:root {
  --bg: #000000;
  --bg-elevated: #0a0a0a;
  --text: #ffffff;
  --muted: #a1a1aa;
  --muted-2: #71717a;
  --border: #27272a;
  --border-soft: #1c1c1f;
  --accent: #22c55e;
  --radius: 12px;
  --radius-sm: 8px;
  --container: 900px;
  --space-section: clamp(3.5rem, 8vw, 5.5rem);
  --font: "DM Sans", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ===== Reset ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--muted);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(40, 40, 48, 0.55), transparent),
    linear-gradient(180deg, #050505 0%, #000 40%);
  background-attachment: fixed;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s var(--ease), opacity 0.2s var(--ease);
}

a:hover {
  color: var(--muted);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

h1,
h2,
h3 {
  color: var(--text);
  font-weight: 600;
  line-height: 1.25;
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

p {
  margin: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100%;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  top: 1rem;
}

.container {
  width: min(100% - 2.5rem, var(--container));
  margin-inline: auto;
}

/* ===== Nav ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(0, 0, 0, 0.72);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s var(--ease);
}

.site-header.is-scrolled {
  border-bottom-color: var(--border-soft);
}

.nav__inner {
  width: min(100% - 2.5rem, var(--container));
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.75rem;
  gap: 1rem;
}

.nav__brand {
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.nav__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1.15rem;
}

.nav__list a {
  font-size: 0.875rem;
  color: var(--muted);
}

.nav__list a:hover,
.nav__list a.is-active {
  color: var(--text);
}

.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.nav__toggle span {
  display: block;
  height: 1.5px;
  width: 100%;
  background: var(--text);
  transition: transform 0.25s var(--ease);
}

/* ===== Hero ===== */
.hero {
  padding-top: clamp(2.5rem, 6vw, 4rem);
  padding-bottom: var(--space-section);
  scroll-margin-top: 4.5rem;
}

.hero__panel {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.hero__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem 2rem;
  padding-bottom: 1.35rem;
}

.hero__identity {
  display: flex;
  gap: 1.15rem;
  align-items: flex-start;
  min-width: 0;
}

.hero__avatar {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 14px;
  background: linear-gradient(145deg, #222228, #111114);
  border: 1px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
}

.hero__avatar::after {
  content: "DG";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 600;
  color: var(--muted);
  font-size: 1.25rem;
  letter-spacing: 0.04em;
  z-index: 0;
}

.hero__avatar img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero__avatar--fallback img {
  display: none;
}

.hero__text {
  padding-top: 0.1rem;
}

.hero__text h1 {
  font-size: clamp(1.85rem, 4vw, 2.35rem);
  letter-spacing: -0.035em;
  font-weight: 700;
  margin-bottom: 0.28rem;
}

.hero__role {
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 400;
  margin-bottom: 0.85rem;
}

.hero__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.84rem;
  color: var(--muted-2);
}

.hero__location {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.hero__status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.hero__status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.08);
  }
}

.hero__cv {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  align-self: flex-end;
  margin-top: auto;
  padding-bottom: 0.15rem;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  white-space: nowrap;
  flex-shrink: 0;
}

.hero__cv:hover {
  color: var(--muted);
}

.hero__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
  padding-top: 1.1rem;
  border-top: 1px solid #2a2a2e;
}

.hero__email {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s var(--ease);
}

.hero__email:hover {
  color: var(--text);
}

.hero__email.is-copied {
  color: var(--accent);
}

.hero__socials {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.35rem;
  margin: 0;
}

.hero__socials a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.hero__socials a:hover {
  color: var(--text);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.1rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition:
    background 0.2s var(--ease),
    border-color 0.2s var(--ease),
    color 0.2s var(--ease),
    transform 0.2s var(--ease);
}

.btn--ghost {
  border: 1px solid var(--border);
  color: var(--text);
  background: transparent;
}

.btn--ghost:hover {
  border-color: var(--muted-2);
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.btn--solid {
  background: var(--text);
  color: var(--bg);
  border: 1px solid var(--text);
}

.btn--solid:hover {
  background: #e4e4e7;
  color: var(--bg);
}

/* ===== Sections ===== */
.section {
  padding-bottom: var(--space-section);
}

.section h2 {
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  margin-bottom: 1.35rem;
}

.section__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.35rem;
}

.section__header h2 {
  margin-bottom: 0;
}

.section__link {
  font-size: 0.9rem;
  color: var(--muted);
  flex-shrink: 0;
}

.section__link:hover {
  color: var(--text);
}

.prose {
  display: grid;
  gap: 1rem;
  max-width: none;
  width: 100%;
}

.prose p {
  font-size: 1.02rem;
}

/* ===== Projects ===== */
.projects-grid,
.projects-more {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.75rem 1.25rem;
}

.projects-more {
  margin-top: 1.75rem;
}

.project-card {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  font-family: inherit;
  color: inherit;
  cursor: pointer;
  transition: transform 0.3s var(--ease);
}

.project-card:hover {
  transform: translateY(-3px);
}

.project-card:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 4px;
  border-radius: var(--radius);
}

.project-card__media {
  aspect-ratio: 16 / 11;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  margin-bottom: 0.85rem;
}

.project-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s var(--ease), opacity 0.3s var(--ease);
}

.project-card:hover .project-card__media img {
  transform: scale(1.03);
}

.project-card__placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background:
    linear-gradient(160deg, #141418 0%, #0a0a0c 100%);
  color: var(--muted-2);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.project-card__title {
  font-size: 1.05rem;
  margin-bottom: 0.2rem;
}

.project-card__meta {
  font-size: 0.85rem;
  color: var(--muted-2);
}

/* ===== Project modal ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
}

.modal__dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 640px);
  max-height: min(88vh, 820px);
  overflow: auto;
  background: #0c0c0e;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  animation: modalIn 0.28s var(--ease);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal__close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 2;
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--text);
  cursor: pointer;
}

.modal__close:hover {
  background: rgba(255, 255, 255, 0.08);
}

.modal__media {
  aspect-ratio: 16 / 10;
  background: #111114;
  border-bottom: 1px solid var(--border-soft);
  overflow: hidden;
}

.modal__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal__media-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted-2);
  font-weight: 500;
  background: linear-gradient(160deg, #141418 0%, #0a0a0c 100%);
}

.modal__body {
  padding: 1.35rem 1.4rem 1.6rem;
}

.modal__meta {
  font-size: 0.8rem;
  color: var(--muted-2);
  margin-bottom: 0.35rem;
}

.modal__body h2 {
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.65rem;
}

.modal__summary {
  color: var(--muted);
  font-size: 0.98rem;
  margin-bottom: 1rem;
}

.modal__content {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1.35rem;
}

.modal__content p {
  color: var(--muted);
  font-size: 0.95rem;
}

.modal__content h3 {
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.45rem;
  color: var(--text);
}

.modal__content ul {
  display: grid;
  gap: 0.35rem;
  padding-left: 1.1rem;
  list-style: disc;
}

.modal__content li {
  color: var(--muted);
  font-size: 0.92rem;
}

.modal__content li::marker {
  color: var(--muted-2);
}

.modal__tech {
  font-size: 0.88rem;
  color: var(--muted-2);
}

.modal__tech strong {
  color: var(--muted);
  font-weight: 500;
}

.modal__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.modal__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--text);
  background: transparent;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.modal__link-icon {
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}

.modal__link:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--muted-2);
  color: var(--text);
}

.modal__link:hover .modal__link-icon {
  opacity: 1;
  transform: translate(1px, -1px);
}

body.modal-open {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .modal__dialog {
    animation: none;
  }
}

/* ===== Skills ===== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem 1.5rem;
}

.skill {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
}

.skill h3 {
  font-size: 0.98rem;
  margin-bottom: 0.15rem;
}

.skill p {
  font-size: 0.85rem;
  color: var(--muted-2);
}

.skill__icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: contain;
  flex-shrink: 0;
  background: #111114;
  border: 1px solid var(--border-soft);
  padding: 6px;
}

/* ===== Timeline ===== */
.timeline {
  display: grid;
  gap: 2.25rem;
}

.timeline__item {
  border-left: 1px solid #3f3f46;
  padding-left: 1.25rem;
}

.timeline__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.timeline__header h3 {
  font-size: 1.05rem;
  margin-bottom: 0.2rem;
}

.timeline__org {
  font-size: 0.9rem;
  color: var(--muted-2);
}

.timeline__header time {
  font-size: 0.85rem;
  color: var(--muted-2);
  white-space: nowrap;
  flex-shrink: 0;
}

.timeline__bullets {
  display: grid;
  gap: 0.45rem;
  padding-left: 1.1rem;
  list-style: disc;
}

.timeline__bullets li {
  font-size: 0.95rem;
  color: var(--muted);
}

.timeline__bullets li::marker {
  color: var(--muted-2);
}

/* ===== Awards ===== */
.awards-list {
  display: grid;
  gap: 1.25rem;
}

.awards-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.awards-list h3 {
  font-size: 1.02rem;
  margin-bottom: 0.15rem;
}

.awards-list p {
  font-size: 0.9rem;
  color: var(--muted-2);
}

.awards-list time {
  font-size: 0.85rem;
  color: var(--muted-2);
  white-space: nowrap;
}

/* ===== Recommendations ===== */
.recs {
  display: grid;
  gap: 2rem;
}

.rec {
  margin: 0;
  padding: 0 0 0 1.25rem;
  border: 0;
  border-left: 1px solid #3f3f46;
}

.rec p {
  font-size: 1.02rem;
  color: var(--muted);
  margin-bottom: 1rem;
  max-width: 62ch;
}

.rec footer {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.rec cite {
  font-style: normal;
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

.rec footer span {
  font-size: 0.85rem;
  color: var(--muted-2);
}

/* ===== Contact ===== */
.section--contact {
  padding-bottom: calc(var(--space-section) * 0.85);
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
  border-left: 1px solid #3f3f46;
  padding-left: 1.25rem;
}

.contact-label {
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  margin-bottom: 0.55rem;
}

.contact-grid a {
  font-size: 0.98rem;
}

.contact-socials {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.contact-socials a {
  color: var(--muted);
}

.contact-socials a:hover {
  color: var(--text);
}

/* ===== Footer ===== */
.site-footer {
  padding: 2rem 0 2.5rem;
  border-top: 1px solid var(--border-soft);
}

.site-footer p {
  font-size: 0.85rem;
  color: var(--muted-2);
}

/* ===== Reveal motion ===== */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 0.7s var(--ease),
    transform 0.7s var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .hero__status-dot,
  .project-card,
  .project-card__media img {
    animation: none;
    transition: none;
  }
}

/* ===== Responsive ===== */
@media (max-width: 720px) {
  .nav__toggle {
    display: flex;
  }

  .nav__list {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    flex-direction: column;
    gap: 0;
    padding: 0.75rem 1.25rem 1.25rem;
    background: rgba(0, 0, 0, 0.95);
    border-bottom: 1px solid var(--border);
  }

  .nav__list.is-open {
    display: flex;
  }

  .nav__list a {
    display: block;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border-soft);
  }

  .nav__list li:last-child a {
    border-bottom: 0;
  }

  .hero__top {
    flex-direction: column;
    align-items: stretch;
  }

  .hero__cv {
    align-self: flex-start;
    margin-top: 0.25rem;
  }

  .hero__bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .projects-grid,
  .projects-more,
  .skills-grid {
    grid-template-columns: 1fr;
  }

  .timeline__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .awards-list li {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}

@media (min-width: 721px) and (max-width: 860px) {
  .nav__list {
    gap: 0.1rem 0.85rem;
  }

  .nav__list a {
    font-size: 0.8rem;
  }
}
