:root {
  --bg: #f6f0e6;
  --bg-soft: #fbf7f0;
  --surface: rgba(255, 251, 246, 0.84);
  --surface-strong: rgba(255, 253, 250, 0.94);
  --ink: #181512;
  --ink-soft: #4e4338;
  --line: rgba(24, 21, 18, 0.12);
  --line-strong: rgba(24, 21, 18, 0.2);
  --shadow: 0 18px 46px rgba(68, 50, 32, 0.12);
  --shadow-strong: 0 30px 72px rgba(46, 31, 16, 0.18);
  --radius: 28px;
  --radius-sm: 18px;
  --content-width: min(1200px, calc(100vw - 40px));
  --font-sans: "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Baskerville", "Palatino Linotype", "URW Palladio L", "Book Antiqua", Georgia, serif;
}

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

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(201, 160, 96, 0.18), transparent 24%),
    radial-gradient(circle at 85% 15%, rgba(126, 80, 48, 0.12), transparent 20%),
    linear-gradient(180deg, #f8f4ed 0%, #f3ece1 42%, #efe6d9 100%);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.5;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0.38)),
    repeating-linear-gradient(
      90deg,
      rgba(24, 21, 18, 0.015) 0,
      rgba(24, 21, 18, 0.015) 1px,
      transparent 1px,
      transparent 120px
    );
  pointer-events: none;
  z-index: -1;
}

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

a {
  color: inherit;
}

section {
  position: relative;
  width: var(--content-width);
  min-height: auto;
  margin: 0 auto;
  padding: clamp(56px, 8vw, 96px) 0;
  text-align: center;
}

section + section {
  border-top: 1px solid rgba(24, 21, 18, 0.08);
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-serif);
  font-weight: 500;
  letter-spacing: -0.025em;
  text-rendering: optimizeLegibility;
}

h1 {
  font-size: clamp(3.4rem, 10vw, 7rem);
  line-height: 0.92;
  max-width: 12ch;
}

h2 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  letter-spacing: 0;
}

h3 {
  margin-bottom: 22px;
  color: var(--ink-soft);
  font-size: clamp(1.05rem, 2vw, 1.4rem);
  letter-spacing: 0.01em;
}

p {
  max-width: 65ch;
  color: var(--ink-soft);
  font-size: 1.02rem;
}

#intro {
  min-height: 96vh;
  align-items: flex-start;
  justify-content: center;
  text-align: left;
  display: flex;
}

#intro h1,
#intro p,
.intro-eyebrow,
.intro-mark {
  position: relative;
}

.intro-mark {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  margin-left: 22px;
}

.intro-eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}

#intro h1 {
  margin-left: 0;
}

#intro p {
  margin-top: 100px;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.7;
  margin-left: auto;
  margin-right: auto;
  max-width: 34rem;
}

#work {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.work-container {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  justify-items: center;
  align-items: end;
  gap: 24px;
  width: 100%;
  margin-top: 36px;
}

.card {
  position: relative;
  cursor: pointer;
  outline: none;
}

.card:nth-child(1) { z-index: 8; }
.card:nth-child(2) { z-index: 7; }
.card:nth-child(3) { z-index: 6; }
.card:nth-child(4) { z-index: 5; }
.card:nth-child(5) { z-index: 4; }
.card:nth-child(6) { z-index: 3; }
.card:nth-child(7) { z-index: 2; }
.card:nth-child(8) { z-index: 1; }

.card img {
  width: clamp(190px, 24vw, 250px);
  aspect-ratio: 1 / 1;
  object-fit: cover;
  transform: skew(14deg) rotate(14deg);
  transform-origin: center bottom;
  border: 12px solid rgba(255, 253, 250, 0.96);
  box-shadow: var(--shadow-strong);
  transition:
    transform 400ms cubic-bezier(.22, 1, .36, 1),
    box-shadow 300ms ease,
    filter 300ms ease;
  will-change: transform;
  backface-visibility: hidden;
}

.card::after {
  content: attr(data-title);
  position: absolute;
  left: 50%;
  bottom: -20px;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(24, 21, 18, 0.82);
  color: #fff8f0;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  opacity: 0;
  transition: opacity 250ms ease, transform 250ms ease;
  pointer-events: none;
  white-space: nowrap;
}

.card:hover img,
.card:focus-visible img,
.card.cardActive img {
  transform: translateY(-24px) skew(14deg) rotate(14deg);
  box-shadow: 0 36px 72px rgba(46, 31, 16, 0.22);
  filter: saturate(1.03);
}

.card:hover::after,
.card:focus-visible::after,
.card.cardActive::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-8px);
}

.card:focus-visible img {
  outline: 3px solid rgba(24, 21, 18, 0.9);
  outline-offset: 8px;
}

.work-detail {
  position: relative;
  width: 100vw;
  margin-top: 40px;
  padding: 34px 0 44px;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  background:
    linear-gradient(180deg, rgba(100, 70, 41, 0.08), rgba(100, 70, 41, 0.02)),
    linear-gradient(180deg, #f3ecdf 0%, #e7dece 100%);
}

.work-detail[hidden] {
  display: none;
}

.work-detail::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--detail-pointer-left, 50%);
  width: 30px;
  height: 30px;
  background: #f3ecdf;
  transform: translate(-50%, -50%) rotate(45deg);
  box-shadow: -8px -8px 20px rgba(0, 0, 0, 0.03);
}

.work-detail-shell {
  position: relative;
  width: min(1320px, calc(100vw - 56px));
  margin: 0 auto;
  padding: 30px;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
  gap: 28px;
  align-items: start;
  border-radius: 30px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.18)),
    rgba(255, 252, 247, 0.34);
  border: 1px solid rgba(24, 21, 18, 0.09);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.work-detail-media {
  position: relative;
  min-height: 620px;
  padding: 18px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.28)),
    #231a14;
  box-shadow:
    inset 0 26px 56px rgba(0, 0, 0, 0.22),
    inset 0 -36px 56px rgba(0, 0, 0, 0.26);
  overflow: hidden;
}

.work-detail-media::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  pointer-events: none;
}

.work-detail-media::after {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 26%, transparent 72%, rgba(17, 17, 17, 0.24) 100%),
    linear-gradient(90deg, rgba(17, 17, 17, 0.14) 0%, transparent 14%, transparent 86%, rgba(17, 17, 17, 0.16) 100%);
  pointer-events: none;
}

.work-detail-media img {
  width: 100%;
  height: 100%;
  min-height: 584px;
  object-fit: cover;
  border-radius: 18px;
  filter: saturate(0.98) contrast(1.02);
}

.work-detail-copy {
  position: relative;
  align-self: start;
  padding: 30px;
  border-radius: 24px;
  background: var(--surface-strong);
  text-align: left;
  border: 1px solid rgba(24, 21, 18, 0.08);
  box-shadow: 0 24px 54px rgba(38, 26, 16, 0.14);
}

.work-detail-copy h4 {
  margin-bottom: 14px;
  padding-top: 18px;
  font-size: clamp(1.9rem, 2.8vw, 2.8rem);
  line-height: 0.95;
}

.work-detail-subheading {
  margin-top: -4px;
  margin-bottom: 14px;
  color: var(--ink-soft);
  font-size: 0.83rem;
  line-height: 1.45;
}

.work-detail-subheading[hidden] {
  display: none;
}

.work-detail-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px solid rgba(24, 21, 18, 0.82);
  padding-bottom: 4px;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.work-detail-link[hidden] {
  display: none;
}

.work-detail-copy p {
  margin-bottom: 0;
  max-width: none;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.75;
}

.work-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.work-detail-tags[hidden] {
  display: none;
}

.work-detail-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  box-shadow:
    0 8px 18px rgba(51, 37, 23, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  white-space: nowrap;
}

.work-detail-close {
  position: absolute;
  top: 18px;
  right: 18px;
  padding: 8px 12px;
  border: 1px solid rgba(24, 21, 18, 0.16);
  border-radius: 999px;
  background: rgba(24, 21, 18, 0.04);
  color: var(--ink);
  font: inherit;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 180ms ease, transform 180ms ease;
}

.work-detail-close:hover,
.work-detail-close:focus-visible {
  background: rgba(24, 21, 18, 0.1);
  transform: translateY(-1px);
}

#skills {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#skills > p {
  margin-bottom: 28px;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
}

#skills br {
  display: none;
}

.skills {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  margin-bottom: 24px;
}

.skills-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  width: 100%;
}

.bubble {
  position: relative;
  display: flex;
  align-self: flex-start;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 18px;
  border: 1px solid rgba(24, 21, 18, 0.1);
  box-shadow:
    0 12px 28px rgba(51, 37, 23, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: default;
  transition:
    transform 220ms ease,
    box-shadow 220ms ease,
    border-color 220ms ease,
    background 220ms ease;
  overflow: visible;
}

.bubble.bubbleInteractive {
  cursor: pointer;
}

.bubble.bubbleInteractive:hover,
.bubble.bubbleInteractive:focus-visible {
  transform: translateY(-4px);
  box-shadow:
    0 20px 36px rgba(51, 37, 23, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.bubble.bubbleInteractive:focus-visible {
  outline: 3px solid rgba(24, 21, 18, 0.82);
  outline-offset: 4px;
}

.bubbleLabel,
.bubble > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.bubbleText {
  position: absolute;
  left: 50%;
  top: calc(100% + 14px);
  z-index: 30;
  width: min(320px, calc(100vw - 48px));
  max-height: 280px;
  padding: 18px 18px 20px;
  border: 1px solid rgba(24, 21, 18, 0.12);
  border-radius: 20px;
  background: rgba(255, 251, 246, 0.96);
  box-shadow:
    0 26px 56px rgba(51, 37, 23, 0.18),
    0 8px 20px rgba(51, 37, 23, 0.08);
  text-align: left;
  line-height: 1.6;
  font-size: 0.93rem;
  font-weight: 400;
  opacity: 0;
  pointer-events: none;
  overflow: auto;
  color: inherit;
  transform: translateX(-50%) translateY(-10px) scale(0.97);
  transform-origin: top center;
  transition:
    opacity 240ms ease,
    transform 280ms cubic-bezier(.22, 1, .36, 1);
}

#sql .bubbleText,
#kql .bubbleText,
#express .bubbleText {
  color: #111;
}

#python .bubbleText {
  color: rgb(76, 117, 164);
}

#stripeApi .bubbleText {
  color: rgb(102, 96, 246);
}

.bubbleActive {
  z-index: 40;
  box-shadow:
    0 26px 56px rgba(51, 37, 23, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.36);
  transform: translateY(-3px);
}

.bubble.bubbleActive .bubbleText {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0) scale(1);
  animation: bubble-overlay-in 320ms cubic-bezier(.22, 1, .36, 1);
}

.bubble.bubbleActive::after {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  z-index: 31;
  width: 16px;
  height: 16px;
  background: rgba(255, 251, 246, 0.96);
  border-top: 1px solid rgba(24, 21, 18, 0.12);
  border-left: 1px solid rgba(24, 21, 18, 0.12);
  transform: translateX(-50%) rotate(45deg);
  box-shadow: -6px -6px 10px rgba(51, 37, 23, 0.04);
}

#contact {
  padding-bottom: 96px;
}

.contact p {
  margin: 0;
  font-size: 1.1rem;
  text-align: center;
  max-width: none;
  width: 100%;
}

.contact a {
  display: inline-block;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-decoration: underline;
  text-underline-offset: 0.16em;
  text-decoration-thickness: 1px;
  transition: transform 180ms ease;
}

.contact a:hover,
.contact a:focus-visible {
  transform: translateY(-2px);
}

#intro,
#work,
#skills,
#contact {
  animation: fade-up 700ms ease both;
}

#work { animation-delay: 90ms; }
#skills { animation-delay: 160ms; }
#contact { animation-delay: 220ms; }

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bubble-overlay-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-14px) scale(0.94);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@media (max-width: 900px) {
  #intro {
    min-height: auto;
    padding-top: 96px;
    padding-bottom: 72px;
  }

  .work-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 2px;
  }

  .card img {
    width: clamp(170px, 40vw, 220px);
    transform: none;
  }

  .card:hover img,
  .card:focus-visible img,
  .card.cardActive img {
    transform: translateY(-12px);
  }

  .work-detail-shell {
    width: min(100vw - 28px, 980px);
    padding: 18px;
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .work-detail-media {
    min-height: 460px;
  }

  .work-detail-media img {
    min-height: 424px;
  }

  .work-detail-copy {
    padding: 24px;
  }
}

@media (min-width: 641px) and (max-width: 900px) {
  .card img {
    width: clamp(190px, 44vw, 240px);
  }
}

@media (max-width: 640px) {
  :root {
    --content-width: calc(100vw - 24px);
  }

  section {
    padding: 48px 0;
  }

  h1 {
    font-size: clamp(2.8rem, 16vw, 4.2rem);
  }

  #intro p {
    font-size: 1rem;
  }

  .work-container {
    gap: 14px;
    margin-top: 28px;
  }

  .card img {
    width: min(100%, 220px);
  }

  .card::after {
    display: none;
  }

  .work-detail {
    padding: 24px 0 30px;
  }

  .work-detail-shell {
    width: calc(100vw - 16px);
    padding: 12px;
    border-radius: 20px;
  }

  .work-detail-media {
    min-height: 320px;
    padding: 12px;
    border-radius: 18px;
  }

  .work-detail-media::before,
  .work-detail-media::after {
    inset: 12px;
    border-radius: 12px;
  }

  .work-detail-media img {
    min-height: 296px;
    border-radius: 12px;
  }

  .work-detail-copy {
    padding: 20px 18px 22px;
    border-radius: 18px;
  }

  .work-detail-copy h4 {
    padding-top: 24px;
  }

  .work-detail::before {
    width: 22px;
    height: 22px;
  }

  .skills {
    gap: 12px;
    width: 85%;
  }

  .skills-row {
    gap: 12px;
    width: 100%;
  }

  .bubble {
    width: auto;
    max-width: calc(100vw - 24px);
    min-height: 38px;
    padding: 10px 15px;
    font-size: 0.67rem;
    border-radius: 13px;
  }
  

  .bubbleActive {
    z-index: 40;
    box-shadow:
        0 26px 56px rgba(51, 37, 23, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.36);
    transform: translateY(-3px);  
  }

  .bubble.bubbleActive:b:after {
    display: none;
  }

  .bubbleText {
    position: absolute;
    left: 60%;
    top: calc(100% + 14px);
    z-index: 30;
    width: min(220px, calc(100vw - 48px));
    max-height: 280px;
    padding: 18px 18px 20px;
    border: 1px solid rgba(24, 21, 18, 0.12);
    border-radius: 20px;
    background: rgba(255, 251, 246, 0.96);
    box-shadow:
        0 26px 56px rgba(51, 37, 23, 0.18),
        0 8px 20px rgba(51, 37, 23, 0.08);
    text-align: left;
    line-height: 1.6;
    font-size: 0.93rem;
    font-weight: 400;
    opacity: 0;
    pointer-events: none;
    overflow: auto;
    color: inherit;
    transform: translateX(-50%) translateY(-10px) scale(0.97);
    transform-origin: top center;
    transition:
        opacity 240ms ease,
        transform 280ms cubic-bezier(.22, 1, .36, 1);
  }

  .bubble.bubbleActive .bubbleText {
    display: block;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
