/* ==========================================================================
   portfolio.css
   Shared layout and components. Page-specific sections are appended below
   the "Pages" marker as each page is built.
   ========================================================================== */

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

.container {
  width: min(var(--container), 100% - var(--gutter) * 2);
  margin-inline: auto;
}

.section {
  padding-block: var(--section-space);
}

.section--tint {
  background: var(--surface-2);
}

.section-head {
  display: grid;
  gap: 0.75rem;
  max-width: 62ch;
  margin-bottom: clamp(2rem, 5vw, 3.25rem);
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.lead {
  color: var(--text-muted);
  font-size: clamp(1.05rem, 1.5vw, 1.2rem);
  line-height: 1.65;
  max-width: 62ch;
}

.page-header {
  padding-block: clamp(3rem, 8vw, 5.5rem) clamp(2rem, 5vw, 3.5rem);
  border-bottom: 1px solid var(--line);
}

.page-header .container {
  display: grid;
  gap: 1rem;
}

.page-header h1 {
  max-width: 18ch;
}

.stack > * + * {
  margin-top: var(--stack, 1rem);
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--cluster-gap, 0.75rem);
}

/* Buttons and links ------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 44px;
  padding: 0.7rem 1.3rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: var(--accent-contrast);
}

.btn-secondary {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  text-decoration: none;
}

.link-arrow i {
  font-size: 0.85em;
  transition: transform 0.2s ease;
}

.link-arrow:hover i {
  transform: translateX(3px);
}

/* Cards and tags --------------------------------------------------------- */

.card {
  padding: clamp(1.25rem, 3vw, 1.75rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tag {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.5;
}

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

/* The header is a floating, rounded, slightly see-through bar. The wrapper is
   invisible and lets clicks through; only the bar itself catches them. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: 0.75rem;
  pointer-events: none;
}

.header-row {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  width: min(100% - 1.5rem, var(--container));
  max-width: none;
  min-height: 60px;
  padding: 0.4rem 0.6rem 0.4rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  box-shadow: 0 4px 20px rgba(22, 20, 15, 0.05);
  pointer-events: auto;
}

/* A full pill whenever the bar stays on one row. */
.js .header-row {
  border-radius: 999px;
}

@media (min-width: 1041px) {
  .header-row {
    border-radius: 999px;
  }
}

.brand {
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand:hover {
  color: var(--accent);
}

.primary-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.primary-nav a {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.primary-nav a:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.primary-nav a[aria-current='page'] {
  background: var(--accent-soft);
  color: var(--accent);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Round icon buttons. Flex centring with no padding keeps the icon in the middle
   on iPhone browsers, where grid centring and default button padding drifted. */
.icon-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  line-height: 1;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.2s ease, color 0.2s ease;
}

/* Font Awesome 7 icons are 1.25em wide by default. A square box is easier to centre. */
.icon-btn i {
  display: block;
  flex: none;
  width: 1em;
  height: 1em;
  font-size: 1rem;
  line-height: 1;
  text-align: center;
}

/* Hover colours only where a real pointer exists, so a tap on a phone does not leave them stuck. */
@media (hover: hover) {
  .icon-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
  }
}

/* Theme and menu buttons need JavaScript, so they stay hidden without it. */
.theme-toggle,
.nav-toggle {
  display: none;
}

.js .theme-toggle {
  display: inline-flex;
}

@media (min-width: 1041px) {
  .primary-nav {
    margin-left: auto;
  }
}

@media (max-width: 1040px) {
  .js .nav-toggle {
    display: inline-flex;
  }

  /* Without JavaScript the nav simply wraps onto a second row. */
  .primary-nav {
    order: 3;
    width: 100%;
    padding-bottom: 0.75rem;
  }

  /* The open menu is a rounded panel under the bar. It is nearly opaque because
     a blur nested inside the bar's own blur would not show through. */
  .js .primary-nav {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    order: 0;
    width: auto;
    padding: 0.4rem 1.25rem 0.6rem;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--surface);
    box-shadow: 0 12px 32px rgba(22, 20, 15, 0.12);
  }

  .js .primary-nav.is-open {
    display: block;
  }

  .js .primary-nav ul {
    flex-direction: column;
    gap: 0;
  }

  .js .primary-nav a {
    display: block;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    font-size: 1.05rem;
  }

  .js .primary-nav a:hover {
    background: none;
  }

  .js .primary-nav li:last-child a {
    border-bottom: 0;
  }

  .js .primary-nav a[aria-current='page'] {
    background: none;
    color: var(--accent);
  }
}

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

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.footer-main {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2.5rem;
  padding-block: clamp(2.5rem, 6vw, 4rem);
}

.footer-about p {
  margin-top: 0.75rem;
  max-width: 38ch;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.footer-title {
  margin: 0 0 0.85rem;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.footer-links {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-links a {
  display: inline-block;
  padding: 0.15rem 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--accent);
}

.social-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.social-row a {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--text);
  font-size: 1.05rem;
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.social-row a:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.footer-mail {
  margin-top: 1rem;
  font-size: 0.95rem;
}

.footer-mail a {
  color: var(--text);
}

.footer-mail a:hover {
  color: var(--accent);
}

.footer-base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding-block: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 0.88rem;
}

.footer-base a {
  color: var(--text-muted);
}

.footer-base a:hover {
  color: var(--accent);
}

@media (max-width: 820px) {
  .footer-main {
    grid-template-columns: 1fr 1fr;
  }

  .footer-about {
    grid-column: 1 / -1;
  }
}

@media (max-width: 520px) {
  .footer-main {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

/* ==========================================================================
   Pages
   ========================================================================== */

/* Shared grids ----------------------------------------------------------- */

.grid-2,
.grid-3 {
  display: grid;
  gap: 1.25rem;
}

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

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.section-foot {
  margin-top: clamp(1.75rem, 4vw, 2.5rem);
}

.kicker {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.muted {
  color: var(--text-muted);
}

/* Logo tiles and badge tiles stay light in both themes so artwork reads cleanly. */
.logo-tile {
  flex: none;
  width: 72px;
  height: 72px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.logo-tile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

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

.hero {
  padding-block: clamp(2.5rem, 7vw, 5rem) clamp(3rem, 7vw, 5rem);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  align-items: center;
  gap: clamp(2rem, 6vw, 5rem);
}

.hero-copy {
  display: grid;
  justify-items: start;
  gap: 1.25rem;
}

.hero-copy h1 {
  max-width: none;
}

.hero-title {
  max-width: 30ch;
  color: var(--text);
  font-size: clamp(1.2rem, 2.2vw, 1.5rem);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.hero-copy .cluster {
  margin-top: 0.5rem;
}

.portrait {
  justify-self: center;
  width: min(100%, 380px);
  aspect-ratio: 4 / 5;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) * 1.6);
  background: var(--accent-soft);
}

.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  width: 100%;
  margin: 1rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.facts div {
  display: flex;
  flex-direction: column-reverse;
  gap: 0.1rem;
}

.facts dd {
  margin: 0;
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.facts dt {
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* Roles ------------------------------------------------------------------ */

.role-card {
  display: grid;
  align-content: start;
  gap: 1rem;
}

.role-head {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.role-label {
  margin: 0 0 0.2rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.role-org {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Wins ------------------------------------------------------------------- */

.win-card {
  display: grid;
  padding: 0;
  overflow: hidden;
}

.win-card figure {
  margin: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.win-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
}

.win-body {
  display: grid;
  align-content: start;
  gap: 0.7rem;
  padding: clamp(1.25rem, 3vw, 1.75rem);
}

.win-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  width: fit-content;
  padding: 0.25rem 0.8rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
}

.win-meta {
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* Badge grid ------------------------------------------------------------- */

.badge-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(0.75rem, 2vw, 1.25rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.badge-grid li {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.badge-grid img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Projects and events ---------------------------------------------------- */

.project-card {
  display: grid;
  align-content: start;
  gap: 0.85rem;
}

.project-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.project-card strong {
  color: var(--text);
}

/* Closing call to action ------------------------------------------------- */

.cta {
  display: grid;
  justify-items: start;
  gap: 1.1rem;
}

.cta h2 {
  max-width: 22ch;
}

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

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: start;
  gap: clamp(2rem, 6vw, 4.5rem);
}

/* The photo fills its column, and the facts sit under the text as a two-column grid. */
@media (min-width: 901px) {
  .about-side .portrait {
    width: 100%;
  }
}

.fact-list.fact-list--grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(1.5rem, 4vw, 3rem);
  margin-top: clamp(1.75rem, 4vw, 2.5rem);
}

/* Keep each label and value together at the top of its cell. */
.fact-list--grid div {
  align-content: start;
}

@media (max-width: 520px) {
  .fact-list--grid {
    grid-template-columns: 1fr;
  }
}

.prose {
  display: grid;
  gap: 1.1rem;
  max-width: 62ch;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.prose strong {
  color: var(--text);
}

.fact-list {
  margin: 0;
  border-top: 1px solid var(--line);
}

.fact-list div {
  display: grid;
  gap: 0.1rem;
  padding-block: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.fact-list dt {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fact-list dd {
  margin: 0;
}

.about-side {
  display: grid;
  gap: 1.75rem;
}

.timeline {
  display: grid;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  gap: 0.5rem 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.timeline-date {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.timeline h3 {
  margin-bottom: 0.35rem;
}

.timeline p {
  color: var(--text-muted);
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem 1.5rem;
}

.skill-grid h3 {
  margin-bottom: 0.85rem;
  font-size: 1rem;
}

.link-card {
  display: grid;
  align-content: start;
  gap: 0.6rem;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.2s ease;
}

.link-card:hover {
  border-color: var(--accent);
  color: var(--text);
}

.link-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.link-card .link-arrow {
  margin-top: 0.4rem;
  color: var(--accent);
}

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

@media (max-width: 1040px) {
  .skill-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .hero-grid,
  .about-grid {
    grid-template-columns: 1fr;
  }

  .portrait {
    justify-self: start;
    width: min(100%, 320px);
  }

  /* On the home page the photo comes first on narrow screens. */
  .hero-grid .portrait {
    order: -1;
    width: min(100%, 320px);
  }

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

/* On phones the photo spans the full width and is cropped to a square, so it
   fills the row without pushing the name far down the screen. */
@media (max-width: 600px) {
  .hero-grid .portrait {
    width: 100%;
    aspect-ratio: 1 / 1;
  }
}

@media (max-width: 760px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .badge-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .timeline li {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .facts {
    grid-template-columns: 1fr;
  }

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

/* ==========================================================================
   Inner pages: badges, achievements, experience, projects, events, contact
   ========================================================================== */

.logo-tile--lg {
  width: 112px;
  height: 112px;
}

.note {
  padding: 0.8rem 1rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.93rem;
}

.link-list {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.link-list a {
  font-weight: 500;
}

.bullets {
  display: grid;
  gap: 0.4rem;
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
}

.bullets strong {
  color: var(--text);
}

/* Badges ----------------------------------------------------------------- */

.badge-section + .badge-section {
  margin-top: clamp(3rem, 7vw, 5rem);
}

.badge-section-head {
  display: grid;
  gap: 0.6rem;
  max-width: 64ch;
  margin-bottom: 1.75rem;
}

.badge-section-head p:not(.eyebrow) {
  color: var(--text-muted);
}

.badge-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.badge-card {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: start;
  gap: 1.25rem;
  height: 100%;
}

.badge-art {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.badge-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.badge-body {
  display: grid;
  gap: 0.6rem;
}

.badge-body h3 {
  font-size: 1.1rem;
}

.badge-body p {
  color: var(--text-muted);
  font-size: 0.93rem;
}

.badge-body .badge-meta {
  font-size: 0.86rem;
}

/* Features (achievements) ------------------------------------------------ */

.feature {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: center;
  gap: clamp(1.5rem, 5vw, 4rem);
}

.feature + .feature {
  margin-top: clamp(3.5rem, 8vw, 6rem);
}

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

.feature--reverse .notice {
  order: 3;
}

.feature-media {
  display: grid;
  gap: 1rem;
  margin: 0;
}

.feature-media img {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.feature-media figure {
  display: grid;
  gap: 0.6rem;
  margin: 0;
}

.feature-media figcaption {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.certificate-frame {
  padding: clamp(0.75rem, 2vw, 1.25rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.certificate-frame img {
  border: 0;
  border-radius: 0;
}

.feature-body {
  display: grid;
  justify-items: start;
  gap: 1rem;
}

.feature-body h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.feature-body .fact-list {
  width: 100%;
}

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

.exp-list {
  display: grid;
  gap: clamp(2.5rem, 6vw, 4rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.exp-item {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 1.5rem clamp(1.5rem, 4vw, 3rem);
  padding-top: clamp(2rem, 5vw, 3rem);
  border-top: 1px solid var(--line);
}

.exp-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.exp-body {
  display: grid;
  align-content: start;
  gap: 0.75rem;
}

.exp-dates {
  margin: 0;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
}

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

.project-full {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(1.5rem, 5vw, 4rem);
  padding-block: clamp(2.5rem, 6vw, 4rem);
  border-top: 1px solid var(--line);
}

.project-full:first-child {
  padding-top: 0;
  border-top: 0;
}

.project-full-head {
  display: grid;
  align-content: start;
  gap: 0.85rem;
}

.project-full-body {
  display: grid;
  align-content: start;
  gap: 1.25rem;
}

.project-full-body h3 {
  font-size: 1rem;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.data-table th,
.data-table td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.data-table th {
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.data-table .is-me td {
  background: var(--accent-soft);
  font-weight: 600;
}

/* Events ----------------------------------------------------------------- */

.event-group + .event-group {
  margin-top: clamp(3rem, 7vw, 5rem);
}

.event-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}

.event-card {
  display: grid;
  align-content: start;
  padding: 0;
  overflow: hidden;
}

.event-card figure {
  margin: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.event-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
}

.event-body {
  display: grid;
  align-content: start;
  gap: 0.55rem;
  padding: 1.25rem 1.4rem 1.5rem;
}

.event-body h3 {
  font-size: 1.1rem;
}

.event-body p {
  color: var(--text-muted);
  font-size: 0.93rem;
}

.event-card--wide {
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  align-items: stretch;
}

.event-card--wide figure {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  aspect-ratio: auto;
  border-right: 1px solid var(--line);
  border-bottom: 0;
}

.event-card--wide figure img {
  aspect-ratio: 4 / 5;
}

.event-card--wide .event-body {
  align-content: center;
}

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

.contact-group + .contact-group {
  margin-top: clamp(2.5rem, 6vw, 3.5rem);
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.2s ease;
}

.contact-link:hover {
  border-color: var(--accent);
  color: var(--text);
}

.contact-icon {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.2rem;
}

.contact-text {
  display: grid;
  min-width: 0;
}

.contact-label {
  font-weight: 600;
}

.contact-handle {
  overflow-wrap: anywhere;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.contact-link .fa-arrow-up-right-from-square {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Inner page responsive -------------------------------------------------- */

@media (max-width: 1040px) {
  .badge-list {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 900px) {
  .feature,
  .project-full {
    grid-template-columns: 1fr;
  }

  .feature--reverse .feature-media {
    order: 0;
  }
}

@media (max-width: 760px) {
  .event-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .event-card--wide {
    grid-template-columns: 1fr;
  }

  .event-card--wide figure {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 640px) {
  .exp-item {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .badge-card {
    grid-template-columns: 1fr;
  }

  .badge-art {
    width: 132px;
  }
}

/* ==========================================================================
   Refinements
   ========================================================================== */

/* The crescent glyph sits left of its box, so nudge it to look centred. */
.theme-toggle .fa-moon {
  transform: translate(1.5px, -0.5px);
}

/* Photo gallery inside a feature (achievements) */
.gallery {
  display: grid;
  grid-column: 1 / -1;
  gap: 1rem;
}

.gallery-title {
  font-size: 1.1rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gallery-grid figure {
  display: grid;
  gap: 0.6rem;
  margin: 0;
}

.gallery-grid img {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* Mixed portrait and landscape photos: one row, same height, widths follow each photo's shape. */
.gallery-grid--justified {
  display: flex;
  align-items: flex-start;
}

.gallery-grid--justified li {
  flex: var(--ar, 1) 1 0;
  min-width: 0;
}

.gallery-grid--justified img {
  aspect-ratio: auto;
  object-fit: initial;
}

/* A short photo row inside a role on the Experience page. */
.exp-photos {
  max-width: 40rem;
  margin-top: 0.5rem;
}

@media (max-width: 640px) {
  .gallery-grid--justified {
    flex-direction: column;
  }

  .gallery-grid--justified li {
    flex: none;
    width: 100%;
  }
}

.gallery-grid figcaption {
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* Events get more presence on laptops and desktops. */
@media (min-width: 1041px) {
  .event-card {
    box-shadow: var(--shadow);
  }

  .event-card figure {
    aspect-ratio: 3 / 2;
  }

  .event-card--wide figure {
    aspect-ratio: auto;
  }

  .event-body {
    gap: 0.65rem;
    padding: 1.5rem 1.6rem 1.75rem;
  }

  .event-body h3 {
    font-size: 1.3rem;
  }

  .event-body p:not(.kicker) {
    font-size: 1rem;
  }
}

@media (max-width: 760px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }
}

/* Events page: one large event per row, photo and text side by side. */
.event-grid--stacked {
  grid-template-columns: 1fr;
  gap: clamp(1.5rem, 3vw, 2.25rem);
}

@media (min-width: 1041px) {
  .event-grid--stacked .event-card {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr);
    align-items: stretch;
  }

  .event-grid--stacked .event-card:not(.event-card--wide) figure {
    position: relative;
    min-height: 440px;
    aspect-ratio: auto;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .event-grid--stacked .event-card:not(.event-card--wide) figure img {
    position: absolute;
    inset: 0;
    object-position: center 25%;
  }

  .event-grid--stacked .event-card:nth-child(even) {
    grid-template-columns: minmax(0, 0.65fr) minmax(0, 1.35fr);
  }

  .event-grid--stacked .event-card:nth-child(even) figure {
    order: 2;
    border-right: 0;
    border-left: 1px solid var(--line);
  }

  .event-grid--stacked .event-card--wide:nth-child(even) figure {
    border-right: 0;
    border-left: 1px solid var(--line);
  }

  .event-grid--stacked .event-body {
    align-content: center;
    gap: 0.9rem;
    padding: clamp(2rem, 3.5vw, 3rem);
  }

  .event-grid--stacked .event-body h3 {
    font-size: clamp(1.6rem, 2.4vw, 2rem);
    line-height: 1.15;
  }

  .event-grid--stacked .event-body p:not(.kicker) {
    font-size: 1.05rem;
  }

  .event-grid--stacked .event-body .kicker {
    font-size: 0.88rem;
  }
}

@media (min-width: 761px) and (max-width: 1040px) {
  .event-grid--stacked .event-card:not(.event-card--wide) figure {
    aspect-ratio: 16 / 9;
  }
}

/* Tall collage photo: give it a narrower column so it is not cropped. */
@media (min-width: 1041px) {
  .event-grid--stacked .event-card.event-card--portrait {
    grid-template-columns: minmax(0, 1fr) minmax(0, 440px);
  }

  .event-grid--stacked .event-card.event-card--portrait figure {
    min-height: 0;
    aspect-ratio: 4 / 5;
  }

  .event-grid--stacked .event-card.event-card--portrait figure img {
    position: static;
    object-position: center top;
  }
}

/* Public notice (achievements) */
.notice {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 400px) minmax(0, 1fr);
  align-items: start;
  gap: clamp(1.5rem, 4vw, 3rem);
  padding-top: clamp(2rem, 4vw, 3rem);
  border-top: 1px solid var(--line);
}

.notice figure {
  display: grid;
  gap: 0.6rem;
  margin: 0;
}

.notice figure a {
  display: block;
}

.notice figure img {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.notice figcaption {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.notice-body {
  display: grid;
  align-content: start;
  gap: 1rem;
}

@media (max-width: 900px) {
  .notice {
    grid-template-columns: 1fr;
  }

  .notice figure {
    max-width: 420px;
  }
}

/* Photo mosaic event card: one large photo and two smaller ones */
.event-card--gallery figure {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2px;
  min-height: 360px;
  aspect-ratio: auto;
}

/* The mosaic height comes from the card, never from the photos. Without this a tall
   or portrait photo makes its row, and the whole card, grow far too big. */
@media (min-width: 761px) {
  .event-card--gallery figure img {
    contain: size;
    min-height: 0;
    aspect-ratio: auto;
  }
}

/* The cropped photo of Sugam in the Leapfrog card: keep his face in the frame. */
.event-grid .event-card.event-card--gallery figure img[src*='leapfrog-technology-visit-june-19-2025-1800x1200'] {
  object-position: center 18%;
}

.event-card--gallery figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
}

.event-card--gallery figure img:first-child {
  grid-row: 1 / span 2;
}

@media (min-width: 1041px) {
  .event-grid--stacked .event-card.event-card--gallery figure {
    display: grid;
    min-height: 460px;
    aspect-ratio: auto;
  }

  .event-grid--stacked .event-card.event-card--gallery figure img {
    position: static;
    object-position: center 30%;
  }
}

@media (max-width: 760px) {
  .event-card--gallery figure {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
    min-height: 0;
  }

  .event-card--gallery figure img {
    height: auto;
    aspect-ratio: 3 / 2;
  }

  .event-card--gallery figure img:first-child {
    grid-column: 1 / -1;
    grid-row: auto;
  }
}

/* Clickable cards and badge tiles on the home page ------------------------ */

.card--link {
  position: relative;
}

.card-link {
  color: inherit;
  text-decoration: none;
}

/* The whole card becomes the click target. */
.card-link::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
}

.card--link:hover .card-link {
  color: var(--accent);
}

.card-link:focus-visible {
  outline: none;
}

.card--link:has(.card-link:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.badge-link {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: inherit;
}

.badge-grid li:has(.badge-link:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.badge-link:focus-visible {
  outline: none;
}
