@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap");

/* Brand values alias styles/tokens.css; home keeps its own neutrals. */
:root {
  --page-width: 1080px;
  --blue: var(--brand-accent);
  --project-blue: #3850f5;
  --ink: #000000;
  --muted: #999999;
  --soft: #f0f0f0;
  --line: #999999;
  --white: var(--brand-white);
  --font: var(--brand-font);
  --leading-display: 1.34;
  --leading-title: 1.3;
  --leading-body: 1.45;
  --leading-ui: 1.25;
  --leading-tag: 1.1;

  /* Fluid vertical rhythm — scales with viewport, clamped to an 8px scale.
     Hierarchy: page-top ≥ section > grid row > grid column > card internals. */
  --space-page-top: clamp(40px, 5.5vw, 72px);
  --space-section: clamp(40px, 5vw, 64px);
  --space-row: clamp(28px, 3.5vw, 40px);
  --space-col: clamp(20px, 2.5vw, 28px);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--white);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--white);
}

.home-motion-pending .hero > *,
.home-motion-pending .project-card,
.home-motion-pending .feature-link,
.home-motion-pending .site-footer > * {
  opacity: 0;
}

.topbar {
  position: fixed;
  z-index: 50;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  padding: 12px 24px 20px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-18px);
  transition:
    opacity 220ms ease,
    transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

.topbar__inner {
  position: relative;
  width: min(100%, var(--page-width));
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  transition:
    width 260ms cubic-bezier(0.22, 1, 0.36, 1),
    padding 260ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 220ms ease,
    transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.topbar__links a {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: var(--leading-ui);
  white-space: nowrap;
  will-change: transform;
}

.topbar__links {
  display: flex;
  align-items: center;
  gap: 2px;
}

.topbar__links a {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border-radius: 999px;
  transition:
    background-color 180ms ease,
    color 180ms ease;
}

.topbar__links a:hover {
  background: var(--blue);
  color: var(--white);
}

.topbar-condensed .topbar__inner {
  width: fit-content;
  max-width: calc(100% - 24px);
  min-height: 46px;
  padding: 5px 7px;
  border-color: rgba(0, 0, 0, 0.07);
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  box-shadow: none;
}

.topbar-condensed .topbar__links a {
  font-size: 14px;
}

.topbar-condensed .topbar {
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0);
}

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

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

.home {
  width: min(calc(100% - 48px), var(--page-width));
  margin: var(--space-page-top) auto 0;
}

.hero {
  display: grid;
  gap: 32px;
  align-items: start;
}

.hero__avatar {
  width: 84px;
  height: 84px;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  object-fit: cover;
}

.hero h1 {
  margin: 0;
  max-width: var(--page-width);
  color: var(--ink);
  font-size: 36px;
  font-weight: 500;
  line-height: var(--leading-display);
  letter-spacing: -0.01em;
}

.hero__links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

.pill {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  padding: 14px 22px;
  border-radius: 64px;
  background: var(--soft);
  color: var(--ink);
  font-size: 18px;
  font-weight: 600;
  line-height: var(--leading-ui);
  letter-spacing: -0.022em;
  transition:
    background-color 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

.pill:hover {
  transform: translateY(-1px);
  background: #e7e7e7;
}

.pill--primary {
  background: var(--blue);
  color: var(--white);
}

.pill--primary:hover {
  background: #004be0;
}

.projects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-row) var(--space-col);
  margin-top: var(--space-section);
}

.project-card,
.feature-link {
  min-width: 0;
}

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform-origin: center top;
  will-change: transform;
  /* Lets the tag overlay measure the card width (cqw) to find the
     bottom edge of the 638/392 media. */
  container-type: inline-size;
}

a.project-card {
  cursor: pointer;
}

.project-card--pending {
  cursor: help;
}

.project-card--pending:focus {
  outline: none;
}

.project-card--pending::after {
  content: attr(data-status);
  position: absolute;
  left: 18px;
  top: 18px;
  z-index: 3;
  max-width: min(250px, calc(100% - 36px));
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  line-height: var(--leading-ui);
  box-shadow: 0 12px 30px rgba(8, 15, 35, 0.16);
  -webkit-backdrop-filter: blur(14px) saturate(170%);
  backdrop-filter: blur(14px) saturate(170%);
  opacity: 0;
  transform: translate3d(0, 8px, 0) scale(0.96);
  transform-origin: left top;
  transition:
    opacity 180ms ease,
    transform 260ms cubic-bezier(0.3, 1.25, 0.5, 1);
  pointer-events: none;
}

.project-card--pending:hover::after,
.project-card--pending:focus::after,
.project-card--pending.is-status-visible::after {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

.project-card__media {
  width: 100%;
  height: auto;
  aspect-ratio: 638 / 392;
  border-radius: 20px;
  object-fit: cover;
  background: var(--white);
  clip-path: inset(0 round 20px);
  isolation: isolate;
  backface-visibility: hidden;
  -webkit-mask-image: -webkit-radial-gradient(white, black);
  will-change: transform;
}

.project-card__media--blue {
  background: var(--project-blue);
}

.project-card__copy {
  display: grid;
  gap: 6px;
}

.project-card h2,
.feature-link h2 {
  margin: 0;
  color: var(--ink);
  font-size: 21px;
  font-weight: 500;
  line-height: var(--leading-title);
}

.project-card p {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  font-weight: 400;
  line-height: var(--leading-body);
}

.project-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Overlay the tags on the media (its bottom edge sits at width x 392/638). */
@supports (width: 100cqw) {
  .project-card__tags {
    position: absolute;
    left: 14px;
    right: 14px;
    top: calc(100cqw * 392 / 638 - 14px);
    transform: translateY(-100%);
    z-index: 2;
    pointer-events: none;
  }
}

.project-card__tags span,
.feature-link__tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 28px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: var(--leading-tag);
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Frosted-glass bubbles when sitting on the image. */
.project-card__tags span {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  backdrop-filter: blur(12px) saturate(160%);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.more-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-row) var(--space-col);
  margin-top: var(--space-section);
}

.feature-link {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  text-align: center;
  transform-origin: center top;
  will-change: transform;
}

.feature-link img {
  width: 100%;
  height: auto;
  aspect-ratio: 638 / 392;
  border: 0.5px solid #e8e8e8;
  border-radius: 20px;
  object-fit: cover;
  clip-path: inset(0 round 20px);
  isolation: isolate;
  backface-visibility: hidden;
  -webkit-mask-image: -webkit-radial-gradient(white, black);
  will-change: transform;
}

.feature-link > div {
  display: grid;
  gap: 12px;
  justify-items: center;
}

.feature-link__tag {
  color: var(--white);
  font-weight: 600;
}

.feature-link__tag--red {
  border-color: #ff1c22;
  background: #ff1c22;
}

.feature-link__tag--blue {
  border-color: #3050ff;
  background: #3050ff;
}

/* Tags pop out like little bubbles on hover. */
@media (hover: hover) and (pointer: fine) {
  .project-card__tags span,
  .feature-link__tag {
    opacity: 0;
    transform: translate3d(0, 8px, 0) scale(0.8);
    transform-origin: center bottom;
    transition:
      opacity 180ms ease,
      transform 380ms cubic-bezier(0.3, 1.4, 0.5, 1);
    transition-delay: 0ms;
    will-change: opacity, transform;
  }

  .project-card:hover .project-card__tags span,
  .project-card:focus-within .project-card__tags span,
  .feature-link:hover .feature-link__tag,
  .feature-link:focus-within .feature-link__tag {
    opacity: 0.72;
    transform: translate3d(0, 0, 0) scale(1);
  }

  /* Glass bubbles on the image read at full strength; the frosted
     background carries the transparency instead of element opacity. */
  .project-card:hover .project-card__tags span,
  .project-card:focus-within .project-card__tags span {
    opacity: 1;
  }

  .project-card:hover .project-card__tags span:nth-child(2),
  .project-card:focus-within .project-card__tags span:nth-child(2) {
    transition-delay: 42ms;
  }

  .project-card:hover .project-card__tags span:nth-child(3),
  .project-card:focus-within .project-card__tags span:nth-child(3) {
    transition-delay: 84ms;
  }

  .project-card:hover .project-card__tags span:nth-child(4),
  .project-card:focus-within .project-card__tags span:nth-child(4) {
    transition-delay: 126ms;
  }

  .project-card:hover .project-card__tags span:nth-child(5),
  .project-card:focus-within .project-card__tags span:nth-child(5) {
    transition-delay: 168ms;
  }
}

@media (prefers-reduced-motion: reduce) {
  .topbar__inner,
  .topbar__links a {
    transform: none !important;
  }

  .project-card__tags span,
  .feature-link__tag {
    animation: none !important;
    transition: opacity 180ms ease;
    transform: none;
  }
}

/* Shared London status footer */
.site-footer {
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  text-align: center;
}

.site-footer > .london-status {
  display: flex;
  width: fit-content;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0 auto 26px;
  padding: 4px 18px 4px 10px;
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}

.site-footer .london-status__weather { display: inline-flex; align-items: center; gap: 5px; }
.site-footer .london-status__icon { display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center; }
.site-footer .london-status__icon svg { width: 100%; height: 100%; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.site-footer .london-status__time { min-width: 66px; font-variant-numeric: tabular-nums; }
.site-footer .london-status__place { color: var(--muted); font-weight: 500; }
.site-footer__brand { display: none; }
.site-footer__social { gap: 18px; }
.site-footer__social a { min-height: auto; padding: 0; font-size: 14px; }
.site-footer__social a::after { display: none; }
.site-footer > p { font-size: 13px; color: var(--muted); }

@media (max-width: 760px) {
  .site-footer { align-items: center; gap: 16px; }
  .site-footer > .london-status { min-height: 42px; margin-bottom: 20px; padding: 3px 15px 3px 9px; font-size: 13px; }
  .site-footer__social { justify-content: center; gap: 14px; }
}

.site-footer {
  width: min(calc(100% - 48px), var(--page-width));
  min-height: auto;
  margin: clamp(56px, 7vw, 88px) auto 0;
  padding: clamp(28px, 3vw, 40px) 0 clamp(40px, 5vw, 60px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 500;
  line-height: var(--leading-body);
}

.site-footer__brand,
.site-footer p {
  margin: 0;
  font-weight: 600;
  white-space: nowrap;
}

.site-footer__social {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.site-footer__social a {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 8px;
  will-change: transform;
  transition: color 180ms ease;
}

.site-footer__social a::after {
  content: "";
  width: 16px;
  height: 16px;
  margin-left: 4px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4.66602 11.3337L11.3327 4.66699M11.3327 11.3337V4.66699H4.66602' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4.66602 11.3337L11.3327 4.66699M11.3327 11.3337V4.66699H4.66602' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / contain;
}

.site-footer__brand:hover,
.site-footer__social a:hover {
  color: var(--blue);
}

@media (max-width: 1180px) {
  .home,
  .site-footer {
    width: min(calc(100% - 40px), 900px);
  }

  .hero h1 {
    font-size: clamp(28px, 4vw, 36px);
  }

  .project-card,
  .feature-link {
    min-height: auto;
  }

  .project-card__media,
  .feature-link img {
    height: auto;
    aspect-ratio: 638 / 392;
  }
}

@media (max-width: 760px) {
  .home {
    width: min(calc(100% - 28px), 520px);
  }

  .hero {
    gap: 24px;
  }

  .hero__avatar {
    width: 64px;
    height: 64px;
  }

  .hero h1 {
    font-size: 23px;
    line-height: var(--leading-display);
  }

  .hero__links {
    gap: 10px;
  }

  .pill {
    min-height: 40px;
    padding: 10px 14px;
    font-size: 13px;
    line-height: var(--leading-ui);
  }

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

  .project-card {
    gap: 12px;
  }

  .project-card__media,
  .feature-link img {
    border-radius: 14px;
    clip-path: inset(0 round 14px);
  }

  .project-card__copy {
    gap: 5px;
  }

  .project-card h2,
  .feature-link h2 {
    font-size: 17px;
    line-height: var(--leading-title);
  }

  .project-card p {
    font-size: 13px;
    line-height: var(--leading-body);
  }

  /* Keep the overlay anchor (container translateY) intact on touch —
     only the spans are always-visible here. */
  .project-card__tags {
    gap: 7px;
  }

  .project-card__tags span,
  .feature-link__tag {
    min-height: 22px;
    padding: 6px 8px;
    font-size: 10px;
    line-height: var(--leading-tag);
    letter-spacing: 0.6px;
    opacity: 1;
    transform: none;
    transition: none;
    transition-delay: 0ms;
  }

  .project-card:hover .project-card__tags span,
  .project-card:focus-within .project-card__tags span,
  .feature-link:hover .feature-link__tag,
  .feature-link:focus-within .feature-link__tag {
    opacity: 1;
    transform: none;
    transition: none;
    transition-delay: 0ms;
  }

  .feature-link {
    gap: 14px;
  }

  .feature-link__tag {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .site-footer {
    width: min(calc(100% - 28px), 520px);
    min-height: auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    font-size: 14px;
  }

  .site-footer__social {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 2px 8px;
  }

  .site-footer__social a {
    padding: 4px 0;
  }

  .topbar {
    padding: 10px 14px 16px;
  }

  .topbar__inner {
    min-height: 38px;
  }

  .topbar__links {
    gap: 2px;
  }

  .topbar__links a {
    min-height: 34px;
    padding: 8px 11px;
    font-size: 13px;
  }
}

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

/* Keep the shared footer treatment after template and responsive rules. */
.site-footer {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
}

.site-footer__brand { display: none; }
.site-footer__social { justify-content: center; gap: 18px; }
.site-footer__social a { min-height: auto; padding: 0; font-size: 14px; }
.site-footer__social a::after { display: none; }
.site-footer > p { font-size: 13px; color: var(--muted); }

@media (max-width: 760px) {
  .site-footer { align-items: center; gap: 16px; }
  .site-footer__social { justify-content: center; gap: 14px; }
}
