/* ============================================================
   Adham Kiwan — Portfolio
   Design system: near-black minimalism, vertical spine,
   Space Grotesk / Inter / JetBrains Mono, electric blue accent
   ============================================================ */

:root {
  --bg: #050508;
  --surface: #0b0b10;
  --text: #f2f0ec;
  --muted: #8a8f98;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #4d7cff;
  --accent-soft: rgba(77, 124, 255, 0.12);
  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
  --header-h: 84px;
}

* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

html {
  scroll-padding-top: var(--header-h);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

::selection {
  background: var(--accent);
  color: #fff;
}

img {
  max-width: 100%;
  display: block;
}

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

/* ---------- Custom cursor ---------- */

.cursor {
  display: none;
}

@media (pointer: fine) {
  .cursor {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    pointer-events: none;
  }
  .cursor-dot {
    position: fixed;
    width: 6px;
    height: 6px;
    margin: -3px 0 0 -3px;
    border-radius: 50%;
    background: var(--accent);
  }
  .cursor-ring {
    position: fixed;
    width: 34px;
    height: 34px;
    margin: -17px 0 0 -17px;
    border-radius: 50%;
    border: 1px solid rgba(77, 124, 255, 0.5);
    transition: transform 0.25s ease, border-color 0.25s ease,
      background-color 0.25s ease;
  }
  .cursor.is-hover .cursor-ring {
    transform: scale(1.7);
    border-color: rgba(77, 124, 255, 0.9);
    background: rgba(77, 124, 255, 0.06);
  }
}

/* ---------- Header ---------- */

header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 48px;
  background: rgba(5, 5, 8, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  z-index: 1000;
}

.logo {
  display: inline-flex;
}

.logo img {
  height: 40px;
  width: auto;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 8px;
}

nav ul li a {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 14px;
  transition: color 0.3s ease;
}

nav ul li a:hover {
  color: var(--text);
}

nav ul li a.active {
  color: var(--accent);
}

.social {
  display: flex;
  align-items: center;
  gap: 8px;
}

.social a {
  display: inline-flex;
  padding: 8px;
  opacity: 0.75;
  transition: opacity 0.3s ease;
}

.social a:hover {
  opacity: 1;
}

.social img {
  height: 20px;
  width: 20px;
}

/* ---------- Hamburger + mobile menu ---------- */

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  width: 44px;
  height: 44px;
  background: none;
  border: 0;
  cursor: pointer;
  z-index: 1002;
}

.hamburger .line {
  display: block;
  width: 26px;
  height: 1.5px;
  margin: 0 auto;
  background: var(--text);
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.hamburger.active .line:nth-child(1) {
  transform: translateY(4.25px) rotate(45deg);
}

.hamburger.active .line:nth-child(2) {
  transform: translateY(-4.25px) rotate(-45deg);
}

.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 1001;
  background: rgba(5, 5, 8, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 48px;
  padding: 0 32px;
  visibility: hidden;
  opacity: 0;
}

.menu-overlay.open {
  visibility: visible;
  opacity: 1;
}

.menu-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-links a {
  display: flex;
  align-items: baseline;
  gap: 16px;
  font-family: var(--font-display);
  font-size: clamp(32px, 8vw, 44px);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
  padding: 6px 0;
}

.menu-num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
}

.menu-social {
  display: flex;
  gap: 24px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

.menu-social a {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Layout / spine ---------- */

main {
  position: relative;
}

.spine {
  position: absolute;
  top: 100vh;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: linear-gradient(
    to bottom,
    transparent,
    var(--line) 6%,
    var(--line) 94%,
    transparent
  );
  transform-origin: top center;
  pointer-events: none;
}

section {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding: 22vh 48px 0;
}

.section-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 96px;
}

.section-index {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--bg);
  padding: 6px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  margin-bottom: 28px;
}

.section-head h1 {
  font-family: var(--font-display);
  font-size: clamp(44px, 7vw, 88px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.05;
  background: var(--bg);
  padding: 0 24px;
}

.mask {
  display: block;
  overflow: hidden;
}

.mask-inner {
  display: inline-block;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 20px 40px;
  border-radius: 2px;
  cursor: pointer;
  transition: background-color 0.35s ease, color 0.35s ease,
    border-color 0.35s ease, box-shadow 0.35s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}

.btn-primary:hover {
  background: transparent;
  color: var(--accent);
  box-shadow: 0 0 32px rgba(77, 124, 255, 0.25);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* ---------- Hero ---------- */

.hero {
  max-width: none;
  min-height: 100vh;
  min-height: 100svh;
  padding: 0 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.hero-code-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  /* Soft accent glow behind the panels — also the no-JS fallback. */
  background:
    radial-gradient(ellipse 60% 45% at 50% 42%, rgba(77, 124, 255, 0.1), transparent 70%),
    radial-gradient(ellipse 40% 30% at 62% 60%, rgba(0, 229, 195, 0.05), transparent 70%);
}

/* ----- Ghost IDE panels ----- */

.code-panel {
  position: absolute;
  width: 340px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.75;
  will-change: transform;
}

.panel-rise {
  opacity: 0;
  animation: panel-in 1.3s ease var(--enter-delay, 1s) forwards;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(26px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel-drift {
  background: rgba(11, 11, 16, 0.72);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  backdrop-filter: blur(2px);
  animation: panel-drift 24s ease-in-out infinite alternate;
}

@keyframes panel-drift {
  from {
    transform: translate(0, 0);
  }
  to {
    transform: translate(9px, -12px);
  }
}

/* Depth layers: far panels are dimmer and softer. */
.code-panel.depth-1 {
  opacity: 0.42;
  filter: blur(1.6px);
}
.code-panel.depth-2 {
  opacity: 0.55;
  filter: blur(0.7px);
}
.code-panel.depth-3 {
  opacity: 0.68;
}

/* Panel placement — kept clear of the centered title. */
.panel-skills {
  top: 14%;
  left: 5%;
}
.panel-sql {
  top: 16%;
  right: 4%;
}
.panel-cs {
  bottom: 13%;
  left: 7%;
  width: 380px;
}
.panel-term {
  bottom: 15%;
  right: 6%;
  width: 300px;
}
.panel-sql .panel-drift {
  animation-delay: -8s;
  animation-duration: 28s;
}
.panel-cs .panel-drift {
  animation-delay: -15s;
  animation-duration: 21s;
}
.panel-term .panel-drift {
  animation-delay: -5s;
  animation-duration: 26s;
}

.panel-chrome {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.chrome-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
}

.panel-file {
  margin-left: 8px;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.panel-body {
  padding: 12px 14px;
  color: rgba(242, 240, 236, 0.68);
}

.code-line {
  display: flex;
  gap: 14px;
  white-space: pre;
  border-radius: 3px;
  transition: background 0.6s ease;
}

.code-line.line-hl {
  background: rgba(77, 124, 255, 0.12);
}

.line-num {
  width: 14px;
  text-align: right;
  color: rgba(138, 143, 152, 0.45);
  user-select: none;
  flex-shrink: 0;
}

/* Syntax tokens — low-saturation, on-theme. */
.tk-kw {
  color: rgba(77, 124, 255, 0.85);
}
.tk-str {
  color: rgba(0, 229, 195, 0.7);
}
.tk-type {
  color: rgba(178, 138, 255, 0.8);
}
.tk-cmt {
  color: rgba(138, 143, 152, 0.7);
}

/* ----- Terminal panel ----- */

.term-body {
  min-height: 92px;
}

.term-line {
  white-space: pre-wrap;
}

.term-prompt {
  color: rgba(77, 124, 255, 0.85);
}

.term-result {
  color: rgba(61, 220, 132, 0.75);
}

.term-caret {
  display: inline-block;
  width: 7px;
  height: 1.05em;
  margin-left: 3px;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: caret-blink 1.1s steps(1) infinite;
}

/* Mobile: fewer, dimmer panels tucked to the corners. */
@media (max-width: 768px) {
  .panel-sql,
  .panel-cs {
    display: none;
  }
  .code-panel {
    width: 210px;
    font-size: 9px;
    line-height: 1.7;
  }
  .code-panel.depth-2,
  .code-panel.depth-3 {
    opacity: 0.25;
    filter: none;
  }
  .panel-skills {
    top: 9%;
    left: -30px;
  }
  .panel-term {
    bottom: 5%;
    right: -24px;
    width: 200px;
  }
  .term-body {
    min-height: 74px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel-rise {
    opacity: 1;
    animation: none;
  }
  .panel-drift {
    animation: none;
  }
}

.hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero-kicker {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 24px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(64px, 13vw, 168px);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 0.94;
  text-transform: uppercase;
}

.hero-title .mask + .mask .mask-inner {
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(242, 240, 236, 0.85);
}

.hero-role {
  font-family: var(--font-mono);
  font-size: clamp(13px, 1.6vw, 16px);
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-top: 32px;
  min-height: 1.7em;
}

.hero-role .caret {
  display: inline-block;
  width: 8px;
  height: 1.1em;
  margin-left: 4px;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: caret-blink 1.1s steps(1) infinite;
}

@keyframes caret-blink {
  50% {
    opacity: 0;
  }
}

.hero-buttons {
  display: flex;
  gap: 20px;
  margin-top: 56px;
  flex-wrap: wrap;
  justify-content: center;
}

.hero-scroll {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero-scroll-line {
  width: 1px;
  height: 56px;
  background: linear-gradient(to bottom, var(--accent), transparent);
  animation: scroll-pulse 2.2s ease-in-out infinite;
  transform-origin: top center;
}

@keyframes scroll-pulse {
  0%,
  100% {
    transform: scaleY(0.35);
    opacity: 0.4;
  }
  50% {
    transform: scaleY(1);
    opacity: 1;
  }
}

/* ---------- About ---------- */

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 96px;
  align-items: center;
}

.about-photo {
  display: flex;
  justify-content: center;
}

.about-photo-frame {
  position: relative;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  max-width: 400px;
}

.about-photo-frame::after {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  width: 28px;
  height: 28px;
  border-top: 1px solid var(--accent);
  border-left: 1px solid var(--accent);
}

.about-photo-frame img {
  filter: grayscale(1) contrast(1.05);
  transition: filter 0.6s ease;
}

.about-photo-frame:hover img {
  filter: grayscale(0) contrast(1);
}

.about-text {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.about-text p {
  font-size: 17px;
  line-height: 1.85;
  color: var(--muted);
}

.highlighted {
  color: var(--accent);
  font-weight: 500;
}

/* ---------- Skills ---------- */

.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: var(--bg);
}

.skill-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  aspect-ratio: 1 / 0.72;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transition: background-color 0.4s ease;
  position: relative;
}

.skill-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 70% 60% at 50% 50%,
    var(--accent-soft),
    transparent 75%
  );
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.skill-card:hover::after {
  opacity: 1;
}

.skill-card img {
  height: 44px;
  width: 44px;
  object-fit: contain;
  filter: grayscale(1) brightness(1.4);
  transition: filter 0.4s ease, transform 0.4s ease;
}

.skill-card:hover img {
  filter: grayscale(0) brightness(1);
  transform: translateY(-4px);
}

.skill-name {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.4s ease;
}

.skill-card:hover .skill-name {
  color: var(--text);
}

/* ---------- Experience / timeline ---------- */

.timeline {
  position: relative;
  padding: 24px 0 48px;
}

.timeline-track {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: var(--line);
}

.timeline-progress {
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, var(--accent), rgba(0, 229, 195, 0.6));
  transform-origin: top center;
  transform: scaleY(0);
}

.timeline-item {
  position: relative;
  width: 50%;
  padding: 0 64px 96px 0;
}

.timeline-item:nth-child(odd) {
  left: 50%;
  padding: 0 0 96px 64px;
}

.timeline-item:last-child {
  padding-bottom: 24px;
}

.timeline-dot {
  position: absolute;
  top: 8px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--accent);
  box-shadow: 0 0 0 6px var(--bg), 0 0 18px rgba(77, 124, 255, 0.45);
  z-index: 1;
}

.timeline-item:nth-child(even) .timeline-dot {
  right: -5.5px;
}

.timeline-item:nth-child(odd) .timeline-dot {
  left: -5.5px;
}

.timeline-item:nth-child(even) .timeline-content {
  text-align: right;
}

.timeline-item:nth-child(even) .timeline-description ul {
  direction: rtl;
}

.timeline-item:nth-child(even) .timeline-description li {
  direction: ltr;
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.timeline-role {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.timeline-company {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}

.timeline-type {
  margin-top: 14px;
}

.employment-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.employment-badge.full-time {
  border-color: rgba(77, 124, 255, 0.4);
  color: var(--accent);
}

.employment-badge.internship {
  border-color: rgba(0, 229, 195, 0.35);
  color: #00e5c3;
}

.timeline-description {
  margin-top: 18px;
}

.timeline-description ul {
  list-style: none;
}

.timeline-description li {
  position: relative;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
  padding-left: 18px;
  margin-bottom: 8px;
}

.timeline-description li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 6px;
  height: 1px;
  background: var(--accent);
}

.timeline-item:nth-child(even) .timeline-description li {
  padding-left: 0;
  padding-right: 18px;
}

.timeline-item:nth-child(even) .timeline-description li::before {
  left: auto;
  right: 0;
}

/* ---------- Projects ---------- */

.projects-tagline {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 400;
  color: var(--muted);
  max-width: 440px;
  margin-top: 28px;
  background: var(--bg);
  padding: 0 16px;
}

.project {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: center;
  padding: 64px 0;
}

.project + .project {
  border-top: 1px solid var(--line);
}

.project-reverse .project-media {
  order: 2;
}

.project-reverse .project-info {
  order: 1;
  align-items: flex-end;
  text-align: right;
}

.project-media {
  display: flex;
  justify-content: center;
}

.project-media img {
  max-height: 420px;
  width: auto;
  filter: drop-shadow(0 30px 60px rgba(0, 0, 0, 0.6));
}

.project-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
}

.project-num {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--accent);
}

.project-name {
  font-family: var(--font-display);
  font-size: clamp(26px, 3.4vw, 40px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.project-link {
  padding: 16px 32px;
}

/* ---------- Workspace ---------- */

.workspace-frame {
  overflow: hidden;
  border: 1px solid var(--line);
}

.workspace-image img {
  width: 100%;
  transform: scale(1.15);
}

/* ---------- Contact ---------- */

.contact {
  padding-bottom: 10vh;
}

.contact-rows {
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.contact-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 32px;
  padding: 36px 8px;
  border-top: 1px solid var(--line);
}

.contact-row:last-of-type {
  border-bottom: 1px solid var(--line);
}

.contact-label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
  flex-shrink: 0;
}

.contact-row h2 {
  font-family: var(--font-display);
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.contact-row > a {
  font-family: var(--font-display);
  font-size: clamp(18px, 3vw, 28px);
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: color 0.3s ease;
  overflow-wrap: anywhere;
  text-align: right;
}

.contact-row > a:hover {
  color: var(--accent);
}

.contact-social {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px 32px;
}

.contact-social a {
  font-family: var(--font-display);
  font-size: clamp(16px, 2.2vw, 28px);
  font-weight: 500;
  transition: color 0.3s ease;
}

.contact-social a:hover {
  color: var(--accent);
}

.contact-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32px 8px 0;
}

.copyrights {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.to-top {
  background: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.3s ease, background-color 0.3s ease;
}

.to-top:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.to-top img {
  height: 18px;
  width: auto;
}

/* ---------- Footer ---------- */

footer {
  padding: 12vh 48px 64px;
  display: flex;
  justify-content: center;
}

footer img {
  width: min(90%, 1100px);
  opacity: 0.9;
}

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
  nav ul li a {
    padding: 10px 8px;
    letter-spacing: 0.08em;
  }

  .about-grid {
    gap: 56px;
  }

  .project {
    gap: 48px;
  }
}

@media (max-width: 768px) {
  :root {
    --header-h: 72px;
  }

  header {
    padding: 0 20px;
  }

  nav,
  header .social {
    display: none;
  }

  .hamburger {
    display: flex;
  }

  section {
    padding: 16vh 20px 0;
  }

  .hero {
    padding: 0 20px;
  }

  .section-head {
    margin-bottom: 56px;
  }

  .spine {
    left: 20px;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 48px;
  }

  .about-photo-frame {
    max-width: 320px;
  }

  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .skill-card {
    aspect-ratio: 1 / 0.85;
  }

  /* Timeline collapses to a single left rail */
  .timeline-track {
    left: 5px;
  }

  .timeline-item,
  .timeline-item:nth-child(odd) {
    width: 100%;
    left: 0;
    padding: 0 0 72px 36px;
  }

  .timeline-item:nth-child(even) .timeline-dot,
  .timeline-item:nth-child(odd) .timeline-dot {
    left: 0;
    right: auto;
  }

  .timeline-item:nth-child(even) .timeline-content {
    text-align: left;
  }

  .timeline-item:nth-child(even) .timeline-description ul {
    direction: ltr;
  }

  .timeline-item:nth-child(even) .timeline-description li {
    padding-left: 18px;
    padding-right: 0;
  }

  .timeline-item:nth-child(even) .timeline-description li::before {
    left: 0;
    right: auto;
  }

  .project,
  .project-reverse .project-media,
  .project-reverse .project-info {
    display: flex;
    flex-direction: column;
    order: initial;
    align-items: center;
    text-align: center;
  }

  .project {
    gap: 40px;
    padding: 48px 0;
  }

  .project-info {
    align-items: center;
    text-align: center;
  }

  .project-media img {
    max-height: 300px;
    max-width: 100%;
  }

  .contact-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 28px 4px;
  }

  .contact-row > a,
  .contact-social {
    text-align: left;
    justify-content: flex-start;
  }

  .contact-foot {
    padding: 28px 4px 0;
  }

  footer {
    padding: 8vh 20px 48px;
  }
}
