/* Piero Borgo — personal website
   Tokens from the Piero Borgo Design System (tokens/colors.css, typography.css, spacing.css) */

@font-face {
  font-family: "Argent Pixel CF";
  src: url("Assets/Fonts/ArgentPixelCF-Regular.woff2") format("woff2"),
       url("Assets/Fonts/ArgentPixelCF-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Argent Pixel CF";
  src: url("Assets/Fonts/ArgentPixelCF-Italic.woff2") format("woff2"),
       url("Assets/Fonts/ArgentPixelCF-Italic.woff") format("woff");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  /* design system: base colors */
  --pb-navy: rgb(44, 58, 67);
  --pb-cream: rgb(252, 245, 235);
  --pb-blue: rgb(28, 98, 174);
  --pb-blue-muted: rgb(149, 179, 198);
  /* site-specific: body copy and the ghost stamp, taken from the live site */
  --pb-slate: rgb(101, 121, 134);
  --pb-navy-ghost: rgb(77, 93, 103);

  /* semantic aliases */
  --surface-page: var(--pb-navy);
  --surface-card: var(--pb-cream);
  --text-primary: var(--pb-navy);
  --text-body: var(--pb-slate);

  /* type */
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-pixel: "Argent Pixel CF", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* layout */
  --page-gutter: 20px;
  --card-max: 770px;
  --card-padding: 30px;
  --card-radius: 30px;
  --stack-gap: 20px;
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--surface-page);
  color: var(--text-primary);
  font-family: var(--font-body);
}

h1,
p {
  margin: 0;
}

a {
  color: inherit;
}

/* ---------- intro card ---------- */

.card {
  max-width: var(--card-max);
  margin: var(--page-gutter) auto 0;
  padding: var(--card-padding) var(--card-padding) calc(var(--card-padding) + 9px);
  background: var(--surface-card);
  border-radius: var(--card-radius);
}

.card__inner {
  display: flex;
  flex-direction: column;
  gap: var(--stack-gap);
}

.logo {
  display: block;
  width: 46px;
  height: 35px;
  color: var(--pb-navy);
}

.hello {
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 36px;
  font-weight: 400;
}

.hello__ciao {
  display: block;
  font-family: var(--font-pixel);
  font-style: italic;
}

.hello strong {
  font-weight: 700;
}

.lead {
  font-family: var(--font-display);
  font-size: 25px;
  line-height: 30px;
}

.lead strong {
  font-weight: 600;
}

.body {
  font-size: 16px;
  line-height: 1.2;
  color: var(--text-body);
}

.body strong {
  font-weight: 700;
}

.body a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.body a:hover {
  color: var(--pb-navy);
}

.redacted {
  display: inline-block;
  width: 73px;
  height: 1.05em;
  vertical-align: -0.2em;
  background: currentColor;
}

.connect {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  color: var(--text-primary);
}

.connect svg {
  width: 20px;
  height: 21px;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.connect:hover svg {
  transform: translateY(-2px);
}

.connect:focus-visible,
.footnote:focus-visible,
.body a:focus-visible {
  outline: 2px solid var(--pb-blue);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- footer ---------- */

.footer {
  padding: 70px var(--page-gutter) 60px;
}

.footnote {
  display: inline-block;
  font-size: 15px;
  line-height: 18px;
  color: var(--text-body);
  text-decoration: none;
}

.footnote em {
  font-family: var(--font-pixel);
  font-style: italic;
}

.footnote:hover {
  color: var(--pb-blue-muted);
}

.thanks {
  margin: 0;
  font-family: var(--font-pixel);
  font-style: italic;
  font-weight: 400;
  /* fills the page width on one line, like the original fit-text */
  font-size: calc((100vw - 2 * var(--page-gutter)) / 11.3);
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  color: var(--pb-navy-ghost);
  user-select: none;
}

/* ---------- entrance: blocks rise in one at a time, top to bottom ---------- */

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.card__inner > *,
.footer > * {
  animation: rise-in 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--rise-step, 0) * 250ms + var(--rise-pause, 0ms) + 150ms);
}

/* home: a short pause after the intro (logo, greeting, lead) before the rest */
.card:not(.card--404) .card__inner > :nth-child(n + 4),
.footer > * {
  --rise-pause: 500ms;
}

.card__inner > :nth-child(2) { --rise-step: 1; }
.card__inner > :nth-child(3) { --rise-step: 2; }
.card__inner > :nth-child(4) { --rise-step: 3; }
.card__inner > :nth-child(5) { --rise-step: 4; }
.card__inner > :nth-child(6) { --rise-step: 5; }
.card__inner > :nth-child(7) { --rise-step: 6; }
.card__inner > :nth-child(8) { --rise-step: 7; }
.card__inner > :nth-child(9) { --rise-step: 8; }
.footer > :nth-child(1) { --rise-step: 9; }
.footer > :nth-child(2) { --rise-step: 10; }

@media (prefers-reduced-motion: reduce) {
  .card__inner > *,
  .footer > * {
    animation: none;
  }
}

/* ---------- desktop: the card fills the browser window ---------- */

@media (min-width: 1200px) {
  :root {
    --page-gutter: 40px;
    --card-padding: 50px;
  }

  .card {
    max-width: none;
    margin: var(--page-gutter) var(--page-gutter) 0;
    min-height: calc(100vh - 2 * var(--page-gutter));
    padding: var(--card-padding);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .card__inner {
    width: 100%;
    max-width: 1020px;
  }

  .logo {
    width: 67px;
    height: 51px;
    margin-bottom: 12px;
  }

  .hello {
    font-size: 37px;
    line-height: 1.2;
  }

  .lead {
    font-size: 30px;
    line-height: 36px;
  }

  .footer {
    padding-top: 120px;
  }
}

/* ---------- phone ---------- */

@media (max-width: 809px) {
  :root {
    --card-padding: 25px;
  }

  .card {
    margin-left: var(--page-gutter);
    margin-right: var(--page-gutter);
  }

  .hello {
    margin-top: 10px;
  }

  .lead {
    font-size: 22px;
    line-height: 1.2;
  }

  .body {
    font-size: 14px;
  }

  .connect {
    align-self: center;
  }

  .thanks {
    font-size: 53px;
    line-height: 0.9;
    white-space: normal;
  }
}

/* ---------- 404 page ---------- */

.page-404 {
  padding: 40px;
}

.card--404 {
  max-width: none;
  margin: 0;
  min-height: 720px;
  /* content sits slightly above centre, as on the live page */
  padding: 50px 50px 59px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card--404 .card__inner {
  width: 100%;
  max-width: 1020px;
}

.home-link,
.error__text {
  font-size: 18px;
  line-height: 1.2;
  color: var(--text-body);
}

.home-link {
  align-self: flex-start;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.home-link:hover {
  color: var(--pb-navy);
}

.home-link:focus-visible {
  outline: 2px solid var(--pb-blue);
  outline-offset: 3px;
  border-radius: 2px;
}

.error {
  margin-top: -15px;
  font-weight: 400;
}

.error__code {
  display: block;
  margin-bottom: 5px;
  font-family: var(--font-pixel);
  font-size: 100px;
  line-height: 120px;
}

.error__title {
  display: block;
  font-family: var(--font-display);
  font-size: 35px;
  line-height: 1.2;
}

@media (max-width: 809px) {
  .page-404 {
    padding: 20px;
  }

  .card--404 .connect {
    align-self: flex-start;
  }
}
