/* Targeted improvements to the original portfolio. Original layout and themes are retained. */
:root {
  scrollbar-gutter: stable;
}
[hidden] {
  display: none !important;
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 5px;
}
.skip-link {
  position: fixed;
  top: 0;
  left: 20px;
  transform: translateY(calc(-100% - 12px));
  background: var(--accent-fill);
  color: var(--on-accent);
  padding: 12px 20px;
  border-radius: 8px;
  z-index: 4000;
}
.skip-link:focus {
  transform: translateY(12px);
}
html {
  scroll-padding-top: calc(var(--nav-height) + 24px);
}
.hero {
  min-height: 680px;
  min-height: min(780px, 92svh);
  padding: calc(var(--nav-height) + 58px) 0 90px;
}
.hero__content {
  max-width: 900px;
}
.hero__name {
  letter-spacing: -0.045em;
}
.hero__current {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 14px;
  margin: -4px 0 22px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  background: var(--bg-card);
}
.hero__current strong {
  color: var(--text);
}
.hero__tagline {
  max-width: 600px;
  margin-bottom: 30px;
}
.hero__stats {
  margin-bottom: 30px;
}
.hero__scroll-indicator {
  font-size: 12px;
  bottom: 20px;
}
.hero__scroll-line {
  height: 25px;
}
.nav__link {
  display: flex;
  align-items: center;
  min-height: 44px;
}
.nav__link.active {
  color: var(--accent-text);
}
.nav__link.active::after {
  width: 100%;
}
.nav__hamburger,
.theme-toggle,
.project-card__link {
  min-width: 44px;
  min-height: 44px;
}
.btn {
  min-height: 46px;
}
.section__title {
  letter-spacing: -0.035em;
}
.section__subtitle {
  line-height: 1.75;
  max-width: 660px;
  margin-bottom: 42px;
}
.about__grid {
  gap: 56px;
}
.skills__categories {
  gap: 34px;
}
.skills__grid {
  max-width: 940px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.skill-card {
  padding: 19px 12px;
}
.recent-stack {
  max-width: 940px;
  margin: 32px auto 0;
  padding: 22px 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}
.recent-stack h3 {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-secondary);
}
.experience__technologies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.experience__note {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: 16px;
}
.current-badge {
  margin-left: 10px;
  padding: 4px 9px;
  border-radius: var(--radius-full);
  background: var(--accent-glow);
  letter-spacing: 0;
  text-transform: none;
}
.timeline__item--current .timeline__content {
  border-color: var(--accent);
}
.timeline__desc,
.timeline__highlights li {
  color: var(--text-secondary);
  line-height: 1.8;
}
.timeline {
  max-width: 820px;
}
.timeline__item {
  margin-bottom: 28px;
}
.project-card[data-project] {
  padding: 22px 14px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  min-width: 0;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.project-card[data-project]:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow);
}
.projects__grid--apps {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 22px;
  align-items: stretch;
}
.phone-mockup {
  height: 490px;
  overflow: hidden;
  touch-action: pan-y;
  position: relative;
}
.phone-mockup .device {
  transform: scale(0.55);
}
.phone-mockup .device-screen {
  object-fit: contain;
  background: #090b0e;
}
.phone-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 4px;
  min-height: 44px;
}
.phone-controls__count {
  min-width: 55px;
  color: var(--text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.gallery-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background: var(--bg-secondary);
  color: var(--text);
  font-size: 19px;
  cursor: pointer;
  transition:
    background 0.2s,
    border-color 0.2s;
}
.gallery-button:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
}
.project-card__info {
  margin-top: 20px;
}
.project-card__desc {
  min-height: 68px;
}
.project-card__links:empty {
  display: none;
}
.project-card__expand {
  min-height: 44px;
  margin-top: auto;
}
.phone-mockup__placeholder small {
  font-size: 20px;
  max-width: 260px;
  line-height: 1.5;
}
.phone-mockup__placeholder span {
  font-size: 32px;
  font-weight: 600;
}
/* Keep the original details modal, with readable screens and the complete gallery. */
dialog.modal {
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 28px;
}
dialog.modal::backdrop {
  background: rgba(0, 0, 0, 0.76);
}
.modal__backdrop {
  background: transparent;
  animation: none;
}
.modal__container {
  max-width: 1060px;
  max-height: calc(100dvh - 56px);
  padding: 50px 40px 36px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.modal__body {
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 42px;
}
.modal__close {
  width: 44px;
  height: 44px;
  top: 12px;
  right: 12px;
}
.modal__phone-row {
  display: block;
}
.gallery-stage {
  display: block;
  position: relative;
  width: 100%;
  height: 470px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  cursor: zoom-in;
  padding: 12px;
  touch-action: pan-y;
}
.gallery-stage img {
  height: 100%;
  width: 100%;
  object-fit: contain;
  border-radius: 12px;
}
.gallery-stage__zoom {
  position: absolute;
  bottom: 15px;
  right: 13px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 10px;
  font: 12px var(--font);
  color: var(--text);
  box-shadow: var(--shadow);
}
.gallery-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}
.gallery-count {
  font-size: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.gallery-thumbnails {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 3px 8px;
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
}
.gallery-thumbnail {
  width: 50px;
  height: 98px;
  flex: 0 0 50px;
  padding: 3px;
  border: 2px solid transparent;
  border-radius: 7px;
  background: var(--bg-secondary);
  cursor: pointer;
  opacity: 0.6;
}
.gallery-thumbnail[aria-pressed="true"] {
  border-color: var(--accent);
  opacity: 1;
}
.gallery-thumbnail:hover {
  opacity: 1;
}
.gallery-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 3px;
}
.gallery-empty {
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-secondary);
  background: var(--bg-secondary);
}
.modal__actions {
  flex-wrap: wrap;
}
.modal__socials {
  gap: 8px;
}
.modal__social-item {
  padding: 8px 10px;
}
/* The full-screen layer uses native dialog focus and Escape behaviour. */
.screenshot-viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 20px 32px;
  border: 0;
  background: #090b10;
  color: #f0f0f0;
}
.screenshot-viewer[open] {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.screenshot-viewer::backdrop {
  background: #090b10;
}
.viewer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-shrink: 0;
}
.viewer__header h2 {
  font-size: 16px;
  font-weight: 500;
}
.viewer__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  min-height: 0;
  flex: 1;
  touch-action: pan-y;
}
.viewer__stage img {
  min-width: 0;
  width: auto;
  height: 100%;
  max-width: calc(100% - 144px);
  object-fit: contain;
  border-radius: 10px;
}
.viewer__caption {
  text-align: center;
  font-size: 13px;
  color: #b1b6bf;
  flex-shrink: 0;
}
.screenshot-viewer .gallery-button {
  background: #1a1d25;
  color: #f0f0f0;
  border-color: #363b46;
}
.form-note {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  line-height: 1.7;
  margin-top: 14px;
}
.blog-card__pending {
  color: var(--text-muted);
}
.reveal {
  opacity: 1;
  transform: none;
}
.js .reveal:not(.visible) {
  opacity: 0;
  transform: translateY(12px);
}
@media (max-width: 1100px) {
  .projects__grid--apps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px;
  }
  .project-card[data-project] {
    padding: 24px;
  }
  .project-card__desc {
    min-height: 45px;
  }
}
@media (max-width: 768px) {
  .container {
    padding-inline: 22px;
  }
  .hero {
    min-height: 0;
    padding: calc(var(--nav-height) + 42px) 0 48px;
  }
  .hero__tagline {
    padding: 0;
    font-size: 15px;
  }
  .hero__name {
    font-size: clamp(34px, 7.5vw, 56px);
  }
  .hero__cta {
    flex-direction: row;
    gap: 10px;
  }
  .hero__cta .btn {
    padding: 12px 20px;
  }
  .hero__current {
    margin-bottom: 20px;
  }
  .hero__stats {
    margin-bottom: 26px;
  }
  .about__grid {
    gap: 30px;
  }
  .nav__links {
    width: min(340px, 88vw);
    max-width: 88vw;
    padding: calc(var(--nav-height) + 20px) 28px 28px;
    gap: 12px;
    height: 100dvh;
    overflow-y: auto;
  }
  .nav__link {
    font-size: 20px;
    width: 100%;
    padding-block: 6px;
  }
  .nav__actions {
    position: relative;
    z-index: 3;
  }
  .nav__hamburger {
    background: var(--bg);
  }
  .skill-card {
    padding: 16px 10px;
  }
  .skills__grid {
    grid-template-columns: repeat(auto-fit, minmax(125px, 1fr));
  }
  .recent-stack {
    padding: 20px;
  }
  .project-card[data-project] {
    padding: 20px 12px;
  }
  .phone-mockup {
    height: 425px;
  }
  .phone-mockup .device {
    transform: scale(0.48);
  }
  .modal__body {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  .modal__container {
    padding: 60px 24px 28px;
    max-width: 600px;
  }
  .modal__screenshots {
    max-width: 360px;
    margin: auto;
  }
  .modal__details {
    min-width: 0;
  }
  .modal__desc {
    font-size: 15px;
  }
  .gallery-stage {
    height: 430px;
  }
  .timeline {
    padding-left: 28px;
  }
  .timeline::before {
    left: 7px;
  }
  .timeline__dot {
    left: -26px;
  }
  .timeline__content {
    padding: 22px;
  }
  .screenshot-viewer {
    padding: 14px;
  }
  .viewer__stage {
    gap: 8px;
  }
  .viewer__stage img {
    max-width: calc(100% - 96px);
  }
  .viewer__header h2 {
    font-size: 14px;
  }
}
@media (max-width: 580px) {
  .projects__grid--apps {
    grid-template-columns: 1fr;
    max-width: 400px;
    margin-inline: auto;
  }
  .project-card[data-project] {
    padding: 24px 16px;
  }
  .phone-mockup {
    height: 490px;
  }
  .phone-mockup .device {
    transform: scale(0.55);
  }
  .project-card__desc {
    min-height: 0;
  }
  .hero__stat-number {
    font-size: 27px;
  }
  .hero__stat-label {
    font-size: 12px;
  }
  .hero__stats {
    gap: 24px;
  }
  .hero__cta .btn {
    font-size: 12px;
    padding-inline: 16px;
  }
  .about__stats {
    flex-direction: row;
    gap: 24px;
    justify-content: center;
  }
  .about__stat-number {
    font-size: 28px;
  }
  .about__stat-label {
    font-size: 12px;
  }
  .modal {
    padding: 10px !important;
  }
  .modal__container {
    max-height: calc(100dvh - 20px);
    padding: 56px 18px 24px;
    border-radius: 18px;
  }
  .gallery-stage {
    height: 400px;
  }
  .section__subtitle {
    font-size: 15px;
  }
  .timeline__title {
    font-size: 18px;
  }
  .viewer__stage {
    position: relative;
  }
  .viewer__stage img {
    max-width: 100%;
    max-height: calc(100% - 54px);
    align-self: flex-start;
  }
  .viewer__stage .gallery-button {
    position: absolute;
    bottom: 0;
  }
  .viewer__stage #viewerPrevious {
    left: calc(50% - 56px);
  }
  .viewer__stage #viewerNext {
    right: calc(50% - 56px);
  }
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .js .reveal:not(.visible) {
    opacity: 1;
    transform: none;
  }
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
