/* ------------------------------------------------------------------ */
/* Tokens (from the Flutter app's CustomColors / AppTextTheme)          */
/* ------------------------------------------------------------------ */
:root {
  --primary: #FA7E39;
  --primary-20: rgba(250, 126, 57, 0.2);
  --primary-40: rgba(250, 126, 57, 0.4);
  --primary-50: rgba(250, 126, 57, 0.5);
  --surface: #424346;
  --surface-dark: #2D2F33;
  --surface-dark-10: rgba(45, 47, 51, 0.1);
  --hint: #D3D3D3;
  --on-surface: #FFFFFF;
  --white-10: rgba(255, 255, 255, 0.1);
  --white-40: rgba(255, 255, 255, 0.4);
  --white-50: rgba(255, 255, 255, 0.5);
  --white-65: rgba(255, 255, 255, 0.65);
  --white-80: rgba(255, 255, 255, 0.8);

  --nav-h: 75px;
  /* mobile gutter; desktop overrides below */
  --gutter: 16px;
  --carousel: 360px;
  --arrow-opacity: 1;
}

@media (min-width: 1100px) {
  :root {
    /* Flutter getHorizontalPadding: 3.2% -> 13.9% of width between 500 and
       1440 px, capped at 13.9% above. Linear fit for the desktop range. */
    --gutter: min(calc(26.44vw - 180.6px), 13.9vw);
    --carousel: 420px;
  }
}

/* ------------------------------------------------------------------ */
/* Fonts                                                               */
/* ------------------------------------------------------------------ */
@font-face { font-family: Manrope; font-weight: 200; src: url(/fonts/Manrope-ExtraLight.ttf) format('truetype'); font-display: swap; }
@font-face { font-family: Manrope; font-weight: 300; src: url(/fonts/Manrope-Light.ttf) format('truetype'); font-display: swap; }
@font-face { font-family: Manrope; font-weight: 400; src: url(/fonts/Manrope-Regular.ttf) format('truetype'); font-display: swap; }
@font-face { font-family: Manrope; font-weight: 500; src: url(/fonts/Manrope-Medium.ttf) format('truetype'); font-display: swap; }
@font-face { font-family: Manrope; font-weight: 600; src: url(/fonts/Manrope-SemiBold.ttf) format('truetype'); font-display: swap; }
@font-face { font-family: Manrope; font-weight: 700; src: url(/fonts/Manrope-Bold.ttf) format('truetype'); font-display: swap; }
@font-face { font-family: Manrope; font-weight: 800; src: url(/fonts/Manrope-ExtraBold.ttf) format('truetype'); font-display: swap; }

/* ------------------------------------------------------------------ */
/* Base                                                                */
/* ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--on-surface);
  font-family: Manrope, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: 0.5px;
  min-height: 100vh;
}

body { overflow-x: hidden; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, p { margin: 0; }

.container { padding-inline: var(--gutter); }

.hairline {
  border: 0;
  height: 0.2px;
  min-height: 1px;
  background: var(--hint);
  opacity: 0.6;
  margin: 0;
}

.icon-white { filter: brightness(0) invert(1); }
.icon-primary { filter: brightness(0) saturate(100%) invert(58%) sepia(64%) saturate(2060%) hue-rotate(338deg) brightness(101%) contrast(96%); }

/* Type scale: Manrope, line-height 1.6, letter-spacing 0.5px */
.display  { font-size: 48px; font-weight: 700; letter-spacing: 1.5px; line-height: 1.6; }
.title-md { font-size: 24px; font-weight: 800; }
.title-sm { font-size: 18px; font-weight: 800; }
.body-lg  { font-size: 24px; font-weight: 400; }
.body-md  { font-size: 16px; font-weight: 400; }
.body-sm  { font-size: 14px; font-weight: 400; }
.label-lg { font-size: 16px; font-weight: 400; }
.label-md { font-size: 14px; font-weight: 500; }
.label-sm { font-size: 12px; font-weight: 700; }

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  white-space: nowrap;
  transition: filter 150ms ease;
}
.btn--wide { gap: 16px; }
.btn--primary { background: var(--primary); color: var(--on-surface); }
.btn--primary:hover { filter: brightness(1.08); }
.btn--outline {
  background: var(--surface-dark);
  color: var(--primary);
  border: 1px solid var(--primary);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 24px 0 16px;
  border-radius: 4px;
  background: var(--surface);
  color: var(--on-surface);
  position: relative;
  overflow: hidden;
}
.icon-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--primary);
  opacity: 0;
  transition: opacity 150ms ease;
}
.icon-btn:hover::after { opacity: 0.08; }

/* ------------------------------------------------------------------ */
/* Nav bar                                                             */
/* ------------------------------------------------------------------ */
.nav {
  height: var(--nav-h);
  background: var(--surface-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: var(--gutter);
}
.nav__logo img { width: auto; height: var(--nav-h); }
.nav__links, .nav__actions { display: none; }
/* mobile: hamburger left, logo centred (balanced by an empty spacer) */
.nav::after { content: ""; width: 40px; flex: none; }

@media (min-width: 1100px) {
  .nav { padding-inline: 0 6vw; justify-content: flex-start; }
  .nav::after { display: none; }
  .nav__logo { margin-right: 16px; }
  .nav__links { display: flex; margin: 0 auto; }
  .nav__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 35px;
    margin: 0 18px;
    position: relative;
  }
  .nav__link::after {
    content: "";
    position: absolute;
    bottom: 0;
    height: 1px;
    width: 100%;
    max-width: 60px;
    background: var(--primary);
    opacity: 0;
  }
  .nav__link:hover { color: var(--primary); }
  .nav__link:hover::after { opacity: 1; }
  .nav__actions { display: flex; align-items: center; gap: 16px; margin-left: 16px; }
}

/* ------------------------------------------------------------------ */
/* Mobile menu / drawer                                                */
/* ------------------------------------------------------------------ */
.mobile-menu { display: contents; }
.mobile-menu__toggle {
  width: 40px;
  height: 40px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}
.mobile-menu__bar { display: block; height: 2px; width: 100%; background: var(--on-surface); border-radius: 1px; }

.drawer {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--surface-dark);
  display: flex;
  flex-direction: column;
  padding: 16px var(--gutter) 32px;
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform 250ms ease, visibility 250ms;
}
.drawer--open { transform: none; visibility: visible; }
.drawer__top { display: flex; align-items: center; justify-content: space-between; }
.drawer__top img { width: auto; height: 68px; }
.drawer__close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--on-surface);
  font-size: 24px;
  line-height: 1;
  display: grid;
  place-items: center;
}
.drawer__links { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }
.drawer__link { font-size: 24px; font-weight: 700; }
.drawer__link:hover { color: var(--primary); }
.drawer__spacer { flex: 1; min-height: 32px; }
.drawer__social { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; margin-top: 32px; }
.drawer__actions { display: flex; flex-wrap: wrap; gap: 16px 24px; margin-top: 32px; }

@media (min-width: 1100px) {
  .mobile-menu { display: none; }
}

/* ------------------------------------------------------------------ */
/* Landing                                                             */
/* ------------------------------------------------------------------ */
.landing {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 16px;
}
.landing__text { width: 100%; padding-top: 48px; }
.landing__hello { }
.landing__tagline {
  font-size: 24px;
  font-weight: 700;
  color: var(--white-40);
  margin-top: 4px;
}
.landing__desc { margin-top: 16px; margin-bottom: 48px; }
.down-arrow { display: none; }

@media (min-width: 1100px) {
  .landing {
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 32px;
    /* viewport minus nav bar, capped so very tall windows do not stretch it */
    min-height: min(calc(100vh - var(--nav-h)), 1000px);
    padding-top: 0;
  }
  .landing__text { flex: 1; }
  .down-arrow {
    display: block;
    position: absolute;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    padding: 12px;
    opacity: var(--arrow-opacity);
    transition: opacity 120ms linear;
  }
  .down-arrow img {
    filter: brightness(0) invert(1);
    opacity: 0.5;
    animation: arrow-bob 1s ease-in-out infinite alternate;
  }
}

@keyframes arrow-bob {
  from { transform: translateY(0); }
  to { transform: translateY(10px); }
}

/* Carousel: portrait + 4 groups of 4 tiles cycling every 4 s */
.carousel {
  position: relative;
  width: var(--carousel);
  height: var(--carousel);
  flex: none;
  --r: calc(var(--carousel) * 0.2);
}
.carousel__portrait {
  position: absolute;
  inset: 0;
  margin: auto;
  width: auto;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
}
.carousel__group {
  position: absolute;
  inset: 0;
  opacity: 0;
  animation: group-cycle 16s linear infinite;
  animation-delay: calc(var(--i) * 4s);
}
@keyframes group-cycle {
  0%      { opacity: 0; }
  4.375%  { opacity: 1; }
  25%     { opacity: 1; }
  29.375% { opacity: 0; }
  100%    { opacity: 0; }
}
.carousel__slot {
  position: absolute;
  left: calc(50% + var(--dx) * var(--r) - 21px);
  top: calc(50% + var(--dy) * var(--r) - 21px);
  transform: rotate(var(--rot));
}
.carousel__slot--0 { --dx: -1.5; --dy: -0.65; --rot: 25deg; }
.carousel__slot--1 { --dx: -1.5; --dy: 1.35;  --rot: 18deg; }
.carousel__slot--2 { --dx: 1.0;  --dy: -1.85; --rot: -15deg; }
.carousel__slot--3 { --dx: 1.0;  --dy: 2.10;  --rot: -27.7deg; }
.tile {
  width: 42px;
  height: 42px;
  padding: 8px;
  border-radius: 12px;
  background: var(--on-surface);
  box-shadow: 0 2px 4px var(--surface-dark-10);
  display: grid;
  place-items: center;
  overflow: hidden;
  will-change: transform;
  animation: tile-bob 1.4s ease-in-out infinite alternate;
}
.tile img { width: 26px; height: 26px; object-fit: contain; }
@keyframes tile-bob {
  from { transform: translateY(3.36px); }
  to { transform: translateY(-0.84px); }
}

@media (prefers-reduced-motion: reduce) {
  .carousel__group, .tile, .down-arrow img { animation: none; }
  .carousel__group { opacity: 0; }
  .carousel__group:first-of-type { opacity: 1; }
  html { scroll-behavior: auto; }
}

/* ------------------------------------------------------------------ */
/* Privacy + 404                                                       */
/* ------------------------------------------------------------------ */
.privacy { padding-block: 16px 48px; max-width: 900px; margin-inline: auto; }
.privacy__home { display: inline-block; margin-bottom: 16px; }
.privacy__home img { width: auto; height: 68px; }
.markdown { font-size: 16px; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 { margin: 24px 0 8px; line-height: 1.3; }
.markdown h1 { font-size: 28px; font-weight: 700; }
.markdown h2 { font-size: 24px; font-weight: 700; }
.markdown h3 { font-size: 20px; font-weight: 600; }
.markdown h4 { font-size: 18px; font-weight: 600; }
.markdown p, .markdown ul, .markdown ol { margin: 0 0 16px; }
.markdown li { margin-bottom: 4px; }
.markdown a { color: var(--primary); text-decoration: underline; }
.markdown hr { border: 0; border-top: 1px solid var(--hint); opacity: 0.4; margin: 24px 0; }
.markdown code { font-family: ui-monospace, Consolas, monospace; font-size: 14px; background: var(--white-10); padding: 1px 4px; border-radius: 4px; }
.markdown blockquote { margin: 0 0 16px; padding: 8px 12px; border-left: 4px solid var(--hint); background: var(--white-10); border-radius: 4px; font-style: italic; }

.not-found {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  padding: 32px var(--gutter);
}
.not-found__logo img { width: auto; height: 120px; }

/* ------------------------------------------------------------------ */
/* Section rhythm                                                      */
/* ------------------------------------------------------------------ */
.container-hairline { margin-inline: var(--gutter); }
.landing { padding-bottom: 32px; }
.about { padding-top: 24px; padding-bottom: 96px; }
.projects { padding-top: 48px; padding-bottom: 48px; }
@media (min-width: 1100px) {
  .landing { padding-bottom: 0; }
  .about { padding-top: 48px; }
  .projects { padding-bottom: 108px; }
}

/* ------------------------------------------------------------------ */
/* About                                                               */
/* ------------------------------------------------------------------ */
.about__title { margin-bottom: 24px; }
.about__body { display: flex; flex-direction: column; gap: 48px; }
.about__text p + p { margin-top: 22px; }
.about__cta { margin-top: 48px; }

.about-images {
  display: flex;
  align-items: stretch;
  gap: 8px;
  height: 450px;
  width: 100%;
}
.about-tile {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 100px;
  overflow: hidden;
  cursor: pointer;
  filter: grayscale(0.85);
  transition: flex 300ms ease-in-out, border-radius 300ms ease-in-out,
              filter 300ms ease-in-out, margin 300ms ease-in-out;
}
.about-tile img { width: 100%; height: 100%; object-fit: cover; }
.about-tile.is-active { flex-grow: 4; border-radius: 24px; filter: grayscale(0); }
.about-tile.is-dim { filter: grayscale(1); }
/* Spread the neighbours away from the active tile. A margin takes part in
   flex layout, so the row never crosses the container edge (a transform did). */
.about-tile.is-active:not(:first-child) { margin-left: 12px; }
.about-tile.is-active:not(:last-child) { margin-right: 12px; }
.about-images:has(.is-active) { gap: 5.2px; }

@media (min-width: 1100px) {
  .about__body { flex-direction: row; align-items: flex-start; gap: 32px; }
  .about__text { flex: 4 1 0; }
  .about-images { flex: 3 1 0; width: auto; }
}

/* ------------------------------------------------------------------ */
/* Projects                                                            */
/* ------------------------------------------------------------------ */
.projects__title { margin-bottom: 32px; }
.projects__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 48px; }

.card { display: flex; flex-direction: column; }
.card__media {
  aspect-ratio: 5 / 3;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-dark);
}
.card__media img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1); transition: filter 200ms ease; }
.card:hover .card__media img { filter: grayscale(0); }
/* No hover on touch screens: show the screenshots in colour instead of
   waiting for a tap to give the card a sticky :hover. */
@media (hover: none) {
  .card__media img { filter: grayscale(0); }
}
.card__body { display: flex; flex-direction: column; padding-top: 16px; }
.card__title { margin-top: 4px; }
.card__desc { margin-top: 4px; margin-bottom: 16px; }
.card__links { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 8px; margin-top: 24px; }

.tags { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; height: 25px; align-items: center; }
.tag {
  width: 70px;
  padding: 2px 4px;
  border-radius: 4px;
  background: var(--white-10);
  color: var(--white-65);
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge, .btn--ghost { transition: transform 200ms ease-out; }
.badge:hover, .btn--ghost:hover { transform: scale(1.05); }
.badge img { width: 100px; height: 38px; object-fit: contain; }
.btn--ghost { background: var(--white-10); color: var(--on-surface); border-radius: 4px; }

/* chips */
.chips { position: relative; }
.chips__measure-box {
  position: absolute;
  left: 0; top: 0;
  width: 0; height: 0;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
}
.chips__measure {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  width: max-content;
  white-space: nowrap;
}
.chips__row { display: flex; flex-wrap: nowrap; gap: 6px; align-items: center; }
.chips__row--wrap { flex-wrap: wrap; }
.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--primary-20);
  color: var(--primary);
  white-space: nowrap;
}
.chips__more { position: relative; display: inline-flex; }
.chips__pill {
  padding: 4px 16px;
  border-radius: 16px;
  background: var(--primary-50);
  color: var(--white-80);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  cursor: default;
}
.chips__popover {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 160px;
  max-width: min(320px, calc(100vw - 16px));
  width: max-content;
  padding: 12px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid rgba(66, 67, 70, 0.3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 20;
  flex-wrap: wrap;
  gap: 8px;
}
.chips__popover::after { content: ""; position: absolute; left: 0; right: 0; bottom: -8px; height: 8px; }
.chips__more:hover .chips__popover, .chips__more:focus-within .chips__popover { display: flex; }

@media (min-width: 1100px) {
  .card { flex-direction: row; gap: 16px; height: 300px; }
  .card--reverse { flex-direction: row-reverse; }
  .card__media { flex: 1 1 0; aspect-ratio: auto; height: 100%; }
  .card__body { flex: 1 1 0; padding-top: 12px; min-width: 0; }
  .chips { flex: 1; min-height: 0; }
  .card__links { margin-top: auto; padding-top: 24px; flex-wrap: nowrap; height: 40px; }
}

/* ------------------------------------------------------------------ */
/* Footer                                                              */
/* ------------------------------------------------------------------ */
.footer {
  background: var(--surface-dark);
  padding: 16px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.footer__logo { width: auto; height: 68px; }
.footer__social { display: flex; gap: 16px; margin-top: 4px; }
.footer__meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 12px; margin-top: 16px; }
.footer__contact { color: var(--primary); }
.footer__muted, .footer__sep { color: var(--white-50); }
.footer__break { flex-basis: 100%; height: 0; overflow: hidden; }
@media (min-width: 1100px) {
  .footer { padding: 28px 40px; }
  .footer__logo { height: 100px; }
  .footer__break { flex-basis: auto; height: auto; overflow: visible; }
}

/* ------------------------------------------------------------------ */
/* Back to top                                                         */
/* ------------------------------------------------------------------ */
.to-top {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: var(--primary);
  color: var(--on-surface);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 200ms ease, transform 200ms ease, visibility 200ms;
  z-index: 50;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top svg { width: 20px; height: 20px; }
@media (min-width: 1100px) {
  .to-top { width: 56px; height: 56px; }
  .to-top svg { width: 24px; height: 24px; }
}
