:root {
  --bg: #1e3a2c;
  --bg-rgb: 30, 58, 44;
  --bg-surface: #244a30;
  --text: #f2ead8;
  --text-rgb: 242, 234, 216;
  --text-muted: #b8ae95;
  --border: #3c5748;
  --accent: #d8a84e;
  --accent-fill: #d8a84e;
  --accent-contrast: #1e3a2c;
  --font-display: "Bitter", serif;
  --font-body: "Nunito Sans", system-ui, sans-serif;
}

/* Light theme — beige counterpart to the default dark green/gold palette */

[data-theme="light"] {
  --bg: #f2ead8;
  --bg-rgb: 242, 234, 216;
  --bg-surface: #e9ddbe;
  --text: #1e3a2c;
  --text-rgb: 30, 58, 44;
  --text-muted: #636b59;
  --border: #ddcda0;
  --accent: #8b6119;
  --accent-fill: #d8a84e;
  --accent-contrast: #1e3a2c;
}

* {
  box-sizing: border-box;
}

/* Several component classes below (.btn, .project-link, etc.) set their own
   `display`, which as author CSS overrides the UA stylesheet's [hidden] rule
   regardless of selector specificity. Restated here so toggling the `hidden`
   attribute on any element always hides it. */
[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-fill) var(--bg);
}

/* Scrollbars — matches the page everywhere a scrollbar can appear (page, modal, etc.) */

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background-color: var(--accent-fill);
  border-radius: 999px;
  border: 3px solid var(--bg);
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background-color: #c99a3f;
}

::-webkit-scrollbar-corner {
  background: var(--bg);
}

::-webkit-scrollbar-button {
  background-color: var(--bg);
  background-repeat: no-repeat;
  background-position: center;
  height: 14px;
  width: 14px;
}

::-webkit-scrollbar-button:vertical:start:decrement {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d8a84e' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 15 12 9 18 15'%3E%3C/polyline%3E%3C/svg%3E");
}

::-webkit-scrollbar-button:vertical:end:increment {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d8a84e' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

::-webkit-scrollbar-button:vertical:start:increment,
::-webkit-scrollbar-button:vertical:end:decrement,
::-webkit-scrollbar-button:horizontal {
  display: none;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.65;
}

::selection {
  background: var(--accent-fill);
  color: var(--accent-contrast);
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent-fill);
  outline-offset: 3px;
}

/* Click feedback (Extra User Story 16) — buttons and button-like links shrink slightly when pressed */

button,
.btn,
.project-link,
.social-icon,
.badge-link {
  transition: transform 0.15s ease;
}

button:active,
.btn:active,
.project-link:active,
.social-icon:active,
.badge-link:active {
  transform: scale(0.96);
}

/* Loading screen (Extra User Story 14) */

#loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
  opacity: 1;
  transition: opacity 0.45s ease;
}

#loader.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.loader-mark {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  animation: loader-pulse 1.3s ease-in-out infinite;
}

.loader-mark svg {
  animation: loader-rotate 4s linear infinite;
}

.loader-word {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0;
}

@keyframes loader-pulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.75;
  }

  50% {
    transform: scale(1.12);
    opacity: 1;
  }
}

@keyframes loader-rotate {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {

  .loader-mark,
  .loader-mark svg {
    animation: none;
  }
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(var(--bg-rgb), 0.9);
  backdrop-filter: blur(8px);
}

/* Scroll progress (Extra User Story 11) — sits at the bottom edge of the sticky header */

.scroll-progress {
  width: 100%;
  height: 4px;
  background: var(--border);
}

.scroll-progress-fill {
  width: 0%;
  height: 100%;
  background: var(--accent-fill);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent);
  position: relative;
}

/* Easter egg (Extra User Story 15) — click the compass logo 5x quickly */

.brand.is-spinning svg {
  animation: egg-spin 0.9s cubic-bezier(0.2, 0.8, 0.3, 1);
}

@keyframes egg-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(1080deg);
  }
}

.egg-sparkle {
  position: absolute;
  top: 50%;
  left: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-fill);
  opacity: 0;
  pointer-events: none;
}

.brand.is-spinning .egg-sparkle {
  animation: egg-sparkle-burst 0.7s ease-out forwards;
}

.egg-sparkle:nth-child(1) {
  --dx: -26px;
  --dy: -18px;
  animation-delay: 0.05s;
}

.egg-sparkle:nth-child(2) {
  --dx: 4px;
  --dy: -30px;
  animation-delay: 0.1s;
}

.egg-sparkle:nth-child(3) {
  --dx: 30px;
  --dy: -14px;
  animation-delay: 0.02s;
}

.egg-sparkle:nth-child(4) {
  --dx: -30px;
  --dy: 12px;
  animation-delay: 0.14s;
}

.egg-sparkle:nth-child(5) {
  --dx: 28px;
  --dy: 16px;
  animation-delay: 0.08s;
}

.egg-sparkle:nth-child(6) {
  --dx: 0px;
  --dy: 30px;
  animation-delay: 0.16s;
}

@keyframes egg-sparkle-burst {
  0% {
    transform: translate(0, 0) scale(0.4);
    opacity: 1;
  }

  100% {
    transform: translate(var(--dx), var(--dy)) scale(1);
    opacity: 0;
  }
}

.egg-badge {
  position: fixed;
  top: 74px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface);
  border: 1.5px solid var(--accent);
  border-radius: 14px;
  padding: 14px 20px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.egg-badge.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.egg-badge-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
  font-size: 1.2rem;
}

.egg-badge-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  margin: 0 0 2px;
}

.egg-badge-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  .brand.is-spinning svg {
    animation: none;
  }

  .egg-sparkle {
    display: none;
  }

  .egg-badge {
    transition: opacity 0.2s ease;
  }
}

.nav-links {
  display: flex;
  gap: 26px;
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(var(--text-rgb), 0.82);
}

.nav-links a {
  transition: opacity 0.15s ease;
}

.nav-links a:hover {
  opacity: 0.65;
}

.lang-toggle {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
}

.lang-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.lang-btn.is-active {
  background: var(--accent-fill);
  color: var(--accent-contrast);
}

/* Theme toggle */

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
}

.theme-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.theme-btn.is-active {
  background: var(--accent-fill);
  color: var(--accent-contrast);
}

/* Section shell */

.section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 40px 96px;
}

.section-num {
  font-family: var(--font-display);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 500;
  margin: 0 0 10px;
}

.section h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 2vw + 1rem, 2.2rem);
  margin: 0 0 8px;
}

.section-lead {
  color: var(--text-muted);
  margin: 0 0 32px;
  font-size: 0.98rem;
}

/* Hero */

.hero {
  max-width: 1100px;
  margin: 0 auto;
  padding: 88px 40px 96px;
  display: flex;
  gap: 56px;
  align-items: center;
}

.hero-text {
  flex: 1;
  min-width: 0;
}

.eyebrow {
  font-family: var(--font-display);
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 500;
  margin: 0 0 18px;
}

.hero-text h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.1rem, 4.4vw + 1rem, 3.5rem);
  line-height: 1.12;
  margin: 0 0 18px;
}

.role {
  font-size: clamp(1.05rem, 1vw + 0.9rem, 1.25rem);
  color: rgba(var(--text-rgb), 0.85);
  font-weight: 600;
  margin: 0 0 24px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}

.badge {
  border: 1px dashed var(--accent);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  color: rgba(var(--text-rgb), 0.9);
}

.summary {
  max-width: 470px;
  color: rgba(var(--text-rgb), 0.78);
  margin: 0;
  font-size: 1rem;
}

.hero-photo {
  flex-shrink: 0;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  border: 3px double var(--accent);
  overflow: hidden;
}

.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 46% 38%;
  display: block;
}

/* About */

.pref-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 680px;
}

.pref-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pref {
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.88rem;
}

.pref-yes {
  background: var(--accent-fill);
  border-color: var(--accent-fill);
  color: var(--accent-contrast);
  font-weight: 700;
}

/* Timeline */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 680px;
}

.timeline-item {
  display: flex;
  gap: 18px;
}

.timeline-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 14px;
  flex-shrink: 0;
}

.timeline-marker {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--bg);
  flex-shrink: 0;
  margin-top: 3px;
}

.timeline-connector {
  flex: 1;
  width: 0;
  border-left: 2px dashed var(--border);
  margin-top: 6px;
}

.timeline-content {
  padding-bottom: 30px;
}

.timeline-year {
  font-family: var(--font-display);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
  margin: 0 0 5px;
}

.timeline-content p:last-child {
  color: rgba(var(--text-rgb), 0.82);
  font-size: 0.98rem;
  margin: 0;
}

/* Skills */

.skills-card {
  background: var(--bg-surface);
  border: 2px dashed var(--accent);
  border-radius: 18px;
  padding: 30px 34px;
}

.skills-eyebrow {
  font-family: var(--font-display);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 500;
  margin: 0 0 22px;
  letter-spacing: 0.02em;
}

.skills-category+.skills-category {
  margin-top: 30px;
  padding-top: 26px;
  border-top: 1px dashed var(--border);
}

.skills-category-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent);
  margin: 0 0 16px;
}

.skills-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.skill-item {
  display: grid;
  grid-template-columns: 190px 1fr 48px;
  align-items: center;
  gap: 16px;
}

.skill-item-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.skill-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.skill-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

.skill-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.skill-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: var(--accent-fill);
  border-radius: 999px;
  transition: width 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.15s;
}

.reveal-item.is-visible .skill-fill {
  width: var(--target-width, 0%);
}

.skill-pct {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  text-align: right;
}

/* Projects */

.project-featured {
  background: var(--bg-surface);
  border: 2px solid var(--accent);
  border-radius: 18px;
  padding: 32px;
  margin-bottom: 28px;
}

.project-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-fill);
  color: var(--accent-contrast);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 20px;
}

.project-featured-body {
  display: flex;
  gap: 36px;
  align-items: center;
}

.project-thumb {
  flex-shrink: 0;
  width: 240px;
}

.project-thumb svg,
.project-thumb img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  object-fit: cover;
}

.project-featured-content {
  flex: 1;
  min-width: 0;
}

.project-title {
  font-family: var(--font-display);
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--text);
}

.project-featured .project-title {
  font-size: 1.4rem;
}

.project-card .project-title {
  font-size: 1.1rem;
}

.modal-body .project-title {
  font-size: 1.4rem;
}

.project-desc {
  color: rgba(var(--text-rgb), 0.82);
  font-size: 0.98rem;
  margin: 0 0 18px;
  max-width: 520px;
}

.project-card .project-desc {
  font-size: 0.92rem;
  color: rgba(var(--text-rgb), 0.78);
  max-width: none;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.tech-tag {
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
}

.project-links {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.project-link,
.project-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font-family: inherit;
  line-height: inherit;
  cursor: pointer;
}

.project-more {
  opacity: 0.95;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.project-card {
  background: var(--bg-surface);
  border: 2px dashed var(--accent);
  border-radius: 18px;
  padding: 26px;
}

/* Project details modal */

body.modal-open {
  overflow: hidden;
}

.project-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 38, 30, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  z-index: 50;
}

.project-modal-overlay[hidden] {
  display: none;
}

.project-modal {
  position: relative;
  width: min(960px, 85vw);
  height: min(640px, 85vh);
  background: var(--bg-surface);
  border: 2px solid var(--accent);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(var(--bg-rgb), 0.6);
  border: 1.5px solid var(--accent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
}

.modal-banner {
  width: 100%;
  height: 190px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--bg-surface), var(--bg));
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.modal-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 32px 36px 36px;
}

.modal-columns {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 32px;
}

.modal-text h4 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--accent);
  margin: 0 0 8px;
}

.modal-text p {
  color: rgba(var(--text-rgb), 0.85);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0 0 24px;
}

.modal-images {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-images img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 14px;
}

.modal-image-placeholder {
  aspect-ratio: 4 / 3;
  border: 1.5px dashed var(--border);
  border-radius: 14px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--border);
}

/* Interests */

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

.card {
  background: var(--bg-surface);
  border: 2px dashed var(--accent);
  border-radius: 18px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}

.card-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.card h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  margin: 0;
}

.card p {
  color: rgba(var(--text-rgb), 0.78);
  font-size: 0.92rem;
  margin: 0;
}

/* Download CV */

.cv-card {
  background: var(--bg-surface);
  border: 2px dashed var(--accent);
  border-radius: 18px;
  padding: 28px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.cv-card-info {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.cv-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.cv-filename {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  margin: 0 0 4px;
}

.cv-filetype {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0;
}

/* Contact */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--accent-fill);
  color: var(--accent-contrast);
  font-weight: 700;
  padding: 13px 24px;
  border-radius: 999px;
  font-size: 0.98rem;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--border);
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 40px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.social-links {
  display: flex;
  gap: 12px;
}

.social-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--accent);
  color: var(--accent);
  background: transparent;
  transition: background 0.15s ease, color 0.15s ease;
}

.social-icon:hover {
  background: var(--accent-fill);
  color: var(--accent-contrast);
}

/* Back to top (Extra User Story 12) */

#back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1.5px solid var(--accent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  z-index: 30;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.15s ease, color 0.15s ease;
}

#back-to-top.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#back-to-top:hover {
  background: var(--accent-fill);
  color: var(--accent-contrast);
}

/* Scroll-reveal animations (Extra User Story 13) — fade + rise, with a staggered cascade for grouped items */

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-item {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-item:nth-child(1) { transition-delay: 0ms; }
.reveal-item:nth-child(2) { transition-delay: 60ms; }
.reveal-item:nth-child(3) { transition-delay: 120ms; }
.reveal-item:nth-child(4) { transition-delay: 180ms; }
.reveal-item:nth-child(5) { transition-delay: 240ms; }
.reveal-item:nth-child(6) { transition-delay: 300ms; }
.reveal-item:nth-child(7) { transition-delay: 360ms; }
.reveal-item:nth-child(8) { transition-delay: 420ms; }
.reveal-item:nth-child(9) { transition-delay: 480ms; }
.reveal-item:nth-child(10) { transition-delay: 540ms; }

/* the % fill should only start growing once its own item has settled */
.reveal-item:nth-child(1) .skill-fill { transition-delay: 150ms; }
.reveal-item:nth-child(2) .skill-fill { transition-delay: 210ms; }
.reveal-item:nth-child(3) .skill-fill { transition-delay: 270ms; }
.reveal-item:nth-child(4) .skill-fill { transition-delay: 330ms; }
.reveal-item:nth-child(5) .skill-fill { transition-delay: 390ms; }
.reveal-item:nth-child(6) .skill-fill { transition-delay: 450ms; }
.reveal-item:nth-child(7) .skill-fill { transition-delay: 510ms; }
.reveal-item:nth-child(8) .skill-fill { transition-delay: 570ms; }
.reveal-item:nth-child(9) .skill-fill { transition-delay: 630ms; }
.reveal-item:nth-child(10) .skill-fill { transition-delay: 690ms; }

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal-item {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .skill-fill {
    transition: none;
    width: var(--target-width, 0%);
  }
}

.badge-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.badge-link svg {
  color: var(--accent);
  transition: color 0.15s ease;
  flex-shrink: 0;
}

.badge-link:hover {
  background: var(--accent-fill);
  color: var(--accent-contrast);
}

.badge-link:hover svg {
  color: var(--accent-contrast);
}

/* Responsive */

@media (max-width: 1200px) {
  .project-modal {
    width: min(680px, 90vw);
    height: min(560px, 85vh);
  }
}

@media (max-width: 860px) {
  .hero {
    flex-direction: column-reverse;
    gap: 32px;
  }

  .hero-photo {
    width: 190px;
    height: 190px;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .project-featured-body {
    flex-direction: column;
    align-items: flex-start;
  }

  .project-thumb {
    width: 100%;
    max-width: 320px;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .modal-columns {
    grid-template-columns: 1fr;
  }

  .modal-images {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .modal-image-placeholder {
    flex: 1 1 140px;
  }
}

@media (max-width: 620px) {
  .nav-links {
    display: none;
  }

  .header-inner,
  .hero,
  .section,
  .site-footer {
    padding-left: 20px;
    padding-right: 20px;
  }

  .skill-item {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "head pct"
      "bar bar";
    row-gap: 8px;
  }

  .skill-item-head {
    grid-area: head;
  }

  .skill-pct {
    grid-area: pct;
  }

  .skill-track {
    grid-area: bar;
  }

  .project-modal {
    width: min(94vw, 480px);
    height: min(90vh, 560px);
    border-radius: 16px;
  }

  .modal-banner {
    height: 130px;
  }

  .modal-body {
    padding: 22px 20px 26px;
  }
}

/* Contact form (Extra User Story 22-24) */

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 480px;
  margin-top: 28px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

.form-field input,
.form-field textarea {
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  resize: vertical;
}

.form-field input:focus,
.form-field textarea:focus {
  border-color: var(--accent);
}

/* Honeypot field: kept in the DOM and in the tab order for nobody but bots,
   visually hidden rather than display:none so naive scrapers still fill it in. */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-status {
  min-height: 1.2em;
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0;
}

.form-status.is-success {
  color: var(--accent);
}

.form-status.is-error {
  color: #e0665a;
}