/* ===== Screen-reader only ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== Custom Properties ===== */
:root {
  --denim: #677BA8;
  --ice: #CDDCE8;
  --sage: #C4D6CB;
  --slate: #7C9A95;
  --bg: #EEDCCC;
  --text-dark: #1e293b;
  --text-sage: #3d4f4a;
  --text-ice: #3a4a5c;
  --text-light: #FFFFFF;
  --text-denim-light: #f8f9fd;
  --text-slate-light: #f7faf8;
  --card-radius: 24px;
  --flip-speed: 0.5s;
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: linear-gradient(to bottom, #ebdecb 0%, var(--bg) 20%, #dfc3b2 100%);
  background-attachment: fixed;
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(238, 220, 204, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  width: 100%;
  max-width: 1200px;
  padding: 0.5rem 3rem;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-logo {
  width: 2rem;
  height: 2rem;
  color: var(--denim);
}

.header-title {
  font-family: 'Signika Negative', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-ice);
}

/* ===== Hint Pill ===== */
.hint {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  background: var(--ice);
  color: var(--text-ice);
  border: 1.5px solid var(--text-ice);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.6rem 1.25rem;
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  opacity: 0;
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
  pointer-events: none;
  cursor: pointer;
  z-index: 101;
  white-space: nowrap;
}

.hint.visible {
  opacity: 1;
  transform: translateX(-50%) scale(1);
  pointer-events: auto;
}

/* Bubble-pop dismiss animation */
@keyframes bubble-pop {
  0% {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }

  40% {
    opacity: 1;
    transform: translateX(-50%) scale(1.15);
  }

  100% {
    opacity: 0;
    transform: translateX(-50%) scale(1.5);
    filter: blur(2px);
  }
}

.hint.popping {
  animation: bubble-pop 0.4s ease-out forwards;
  pointer-events: none;
}

/* ===== Card Grid ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  padding: 0.75rem 3rem 1rem;
  max-width: 1080px;
  width: 100%;
  margin-top: auto;
  margin-bottom: auto;
  position: relative;
}

/* ===== Card Base ===== */
.card {
  perspective: 1000px;
  cursor: pointer;
  height: 270px;
}

.card--tall {
  grid-row: span 2;
  height: auto;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform var(--flip-speed) ease-in-out;
  transform-style: preserve-3d;
}

.card.flipped .card-inner {
  transform: rotateY(180deg);
}

/* Visibility toggle at flip midpoint — bulletproof fix for backface bleed-through */
.card.flipped .card-front {
  visibility: hidden;
  transition: visibility 0s calc(var(--flip-speed) / 2);
}

.card.flipped .card-back {
  visibility: visible;
  transition: visibility 0s calc(var(--flip-speed) / 2);
}

.card-face {
  position: absolute;
  inset: 0;
  border-radius: var(--card-radius);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 2rem;
  overflow: hidden;
}

.card-back {
  transform: rotateY(180deg);
  justify-content: flex-start;
  padding: 4rem 2rem 2rem 2rem;
  visibility: hidden;
  transition: visibility 0s calc(var(--flip-speed) / 2);
}

/* ===== Card Plus / Close Icon ===== */
.card-plus {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1;
  color: inherit;
  z-index: 2;
}

.card-back .card-plus {
  background: rgba(255, 255, 255, 0.2);
}

/* ===== Card SVG Buttons (Close/Expand) ===== */
.card-btn-icon {
  position: absolute;
  top: 1.5rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  z-index: 2;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s, transform 0.2s;
}

.card-btn-icon:hover {
  background: rgba(255, 255, 255, 0.4);
}

.card-btn-close {
  left: 1.5rem;
}

.card-btn-expand {
  right: 1.5rem;
}

.icon-shrink {
  display: none;
}

.card.expanded .icon-expand {
  display: none;
}

.card.expanded .icon-shrink {
  display: block !important;
}

/* Color variant button overrides matching .card-plus */
.card--sage .card-btn-icon {
  background: rgba(0, 0, 0, 0.08);
  color: var(--text-sage);
}

.card--sage .card-btn-icon:hover {
  background: rgba(0, 0, 0, 0.15);
}

.card--slate .card-btn-icon {
  background: rgba(255, 255, 255, 0.25);
}

/* ===== Card SVG ===== */
.card-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 2rem;
  opacity: 0.2;
  color: white;
  pointer-events: none;
}

/* ===== Card Title ===== */
.card-title {
  font-family: 'Signika Negative', sans-serif;
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.1;
  position: relative;
  z-index: 1;
}

/* ===== Card Back Watermark (faint mirrored title) ===== */
.card-back-watermark {
  position: absolute;
  bottom: 2rem;
  right: 2rem;
  font-family: 'Signika Negative', sans-serif;
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: right;
  opacity: 0.06;
  pointer-events: none;
  z-index: 0;
  transform: scaleX(-1);
}

/* ===== Card Back Content ===== */
.card-content {
  font-size: 0.875rem;
  line-height: 1.6;
  overflow-y: auto;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.card-content h3 {
  font-family: 'Signika Negative', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.card-content p {
  margin-bottom: 0.75rem;
}

/* Custom scrollbar for card backs */
.card-content::-webkit-scrollbar {
  width: 6px;
}

.card-content::-webkit-scrollbar-track {
  background: transparent;
}

.card-content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 10px;
}

/* ===== Badges ===== */
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.badge {
  padding: 0.35rem 0.75rem;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 2rem;
  font-size: 0.75rem;
  font-weight: 500;
}

/* ===== Experience List ===== */
.exp-list {
  list-style: none;
  margin-bottom: 1rem;
}

.exp-list li {
  margin-bottom: 0.75rem;
}

.exp-list li strong {
  display: block;
  font-size: 0.875rem;
}

.exp-role {
  display: block;
  font-size: 0.75rem;
  opacity: 0.8;
}

/* ===== Card Button (e.g. View Full PDF) ===== */
.card-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: auto;
  padding: 0.6rem 1rem;
  border-radius: 2rem;
  background: white;
  color: var(--denim);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
  transition: background 0.2s;
}

.card-btn:hover {
  background: #f1f5f9;
}

/* ===== Icon List ===== */
.icon-list {
  list-style: none;
  margin-top: auto;
}

.icon-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  font-size: 0.875rem;
}

.icon-list-svg {
  flex-shrink: 0;
  margin-top: 0.15rem;
}

/* ===== Bullet List ===== */
.bullet-list {
  list-style: disc;
  list-style-position: inside;
  font-size: 0.875rem;
}

.bullet-list li {
  margin-bottom: 0.5rem;
}

/* ===== Talk Links ===== */
.talk-links {
  margin-top: auto;
}

.talk-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 0.5rem;
  color: inherit;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.2s;
}

.talk-link:hover {
  background: rgba(255, 255, 255, 0.2);
}

.talk-link svg {
  opacity: 0;
  transition: opacity 0.2s;
}

.talk-link:hover svg {
  opacity: 1;
}

/* ===== Contact Rows ===== */
.contact-content {
  justify-content: center;
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
  font-size: 0.875rem;
  padding: 0.5rem 0;
  transition: opacity 0.2s;
}

.contact-row:hover {
  opacity: 0.8;
}

.contact-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

/* ===== Card Color Variants ===== */

/* Ice Blue */
.card--ice .card-front {
  background: var(--ice);
  color: var(--text-ice);
}

.card--ice .card-back {
  background: var(--ice);
  color: var(--text-ice);
}

.card--ice .card-svg {
  color: white;
}

.card--ice .card-plus {
  background: rgba(255, 255, 255, 0.3);
}

/* Denim Blue */
.card--denim .card-front {
  background: var(--denim);
  color: var(--text-denim-light);
}

.card--denim .card-back {
  background: var(--denim);
  color: var(--text-denim-light);
}

.card--denim .card-svg {
  color: white;
}

.card--denim .card-plus {
  background: rgba(255, 255, 255, 0.3);
}

/* Sage Green */
.card--sage .card-front {
  background: var(--sage);
  color: var(--text-sage);
}

.card--sage .card-back {
  background: var(--sage);
  color: var(--text-sage);
}

.card--sage .card-svg {
  color: white;
}

.card--sage .card-plus {
  background: rgba(0, 0, 0, 0.08);
  color: var(--text-sage);
}

/* Slate Green */
.card--slate .card-front {
  background: var(--slate);
  color: var(--text-slate-light);
}

.card--slate .card-back {
  background: var(--slate);
  color: var(--text-slate-light);
}

.card--slate .card-svg {
  color: white;
}

.card--slate .card-plus {
  background: rgba(255, 255, 255, 0.25);
}

/* ===== Subtle Shadow on Cards ===== */
.card-front {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  visibility: visible;
  transition: visibility 0s calc(var(--flip-speed) / 2);
}

.card-back {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* ===== Expanded Card Styles ===== */
.card-grid.has-expanded-card .card:not(.expanded) {
  pointer-events: none;
}

.card.expanded {
  position: absolute;
  z-index: 50;
  top: 0.75rem;
  left: 3rem;
  right: 3rem;
  bottom: 0;
  height: auto;
  cursor: default;
}

.card.expanded .card-content {
  font-size: 1rem;
}

.card.expanded .card-content h3 {
  font-size: 1.75rem;
}

/* ===== Responsive — Tablet ===== */
@media (max-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    padding: 0 1.5rem 1rem;
  }

  .card--tall {
    grid-row: span 1;
    height: 270px;
  }

  .site-header {
    padding: 0.4rem 1.5rem;
  }

  .card-title {
    font-size: 1.75rem;
  }

  .card.expanded {
    position: relative;
    inset: auto;
    grid-column: span 2;
    grid-row: span 2;
    height: 564px;
    /* 2 vertical cards (270px) + gap (24px) */
    z-index: 10;
  }
}

/* ===== Responsive — Mobile ===== */
@media (max-width: 600px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding: 0 1rem 1rem;
  }

  .site-header {
    padding: 0.35rem 1rem;
  }

  .header-title {
    font-size: 1rem;
    letter-spacing: 0.1em;
  }

  .card {
    height: 216px;
  }

  .card--tall {
    grid-row: span 1;
    height: 216px;
  }

  .card-title {
    font-size: 1.35rem;
  }

  .card-face {
    padding: 1.25rem;
  }

  .card-back {
    padding: 3.5rem 1.25rem 1.25rem;
  }

  .card-content {
    font-size: 0.78rem;
  }

  .card-content h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
  }

  .card-plus {
    top: 1rem;
    right: 1rem;
    width: 1.75rem;
    height: 1.75rem;
  }

  .card-back-watermark {
    font-size: 1.35rem;
    bottom: 1.25rem;
    left: 1.25rem;
  }

  .card-btn-icon {
    top: 1rem;
    width: 1.75rem;
    height: 1.75rem;
  }

  .card-btn-close {
    left: 1rem;
  }

  .card-btn-expand {
    right: 1rem;
  }

  .card.expanded {
    position: relative;
    inset: auto;
    grid-column: 1 / -1;
    height: auto;
    min-height: 480px;
    z-index: 10;
  }
}

/* ===== Responsive — Small phone ===== */
@media (max-width: 380px) {
  .card-grid {
    grid-template-columns: 1fr;
  }

  .card {
    height: 252px;
  }

  .card--tall {
    height: 252px;
  }
}

/* ===== View Transitions ===== */
::view-transition-group(active-card),
::view-transition-old(active-card),
::view-transition-new(active-card) {
  animation-duration: 0.25s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

::view-transition-old(active-card),
::view-transition-new(active-card) {
  height: 100%;
  width: 100%;
  object-fit: cover;
  object-position: center;
}

/* On expand, hide the old small card and only show the big page view expanding */
html.is-expanding ::view-transition-old(active-card) {
  display: none;
}

html.is-expanding ::view-transition-new(active-card) {
  animation: none;
  opacity: 1;
}

/* On shrink, hide the new small card and only show the big page view shrinking */
html.is-shrinking ::view-transition-new(active-card) {
  display: none;
}

html.is-shrinking ::view-transition-old(active-card) {
  animation: none;
  opacity: 1;
}