/* Every page of the theme (frame in layout.php). The front page's intro
   has its own styles in intro.css. */

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: #010408;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Segoe UI", sans-serif;
  line-height: 1.55;
  color: #e6f4ff;
  background:
    radial-gradient(
      90% 420px at 50% 0%,
      rgba(0, 176, 255, 0.16) 0%,
      rgba(0, 176, 255, 0.05) 55%,
      rgba(1, 4, 8, 0) 100%
    ),
    #010408;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* The front page: plain black, no glow, the mark in the corner. Room for
   content to come in .home-main. */
body.home {
  background: #010408;
}

.home-main {
  flex: 1;
}

.contact,
.page {
  width: min(600px, calc(100% - 32px));
  margin-inline: auto;
}

/* The docked mark on every page: cat at the top left, wordmark turned
   90deg beneath it (cat 60px tall, wordmark 20px thick, 12px apart). On
   narrow screens it lies flat along the top instead. */
.brand {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.brand-cat {
  width: calc(60px * 3048 / 3253);
  height: 60px;
  background: #d0efff;
  opacity: 0.6;
  -webkit-mask: url("/images/pingato_gato.svg") center / contain no-repeat;
  mask: url("/images/pingato_gato.svg") center / contain no-repeat;
}

/* The cat's eyes: the intro's red almonds, in the cat's eye openings
   (same artwork coordinates, so the box matches the cat's). Dark until
   site.js lights them now and then. */
.brand {
  --eyes-glow: #ff2a30;
}

.brand-eyes {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(60px * 3048 / 3253);
  height: 60px;
  pointer-events: none;
  opacity: 0;
}

.brand-eyes svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: #ff3b3f;
  filter: drop-shadow(0 0 1.5px var(--eyes-glow)) drop-shadow(0 0 4px var(--eyes-glow))
    drop-shadow(0 0 8px rgba(255, 42, 48, 0.6));
}

/* Light up, hold, blink, hold, go out. */
.brand-eyes.lit {
  animation: eyes-lit 2.6s ease-in-out;
}

.brand-eyes.lit.twice {
  animation: eyes-lit-blink 3.4s ease-in-out;
}

@keyframes eyes-lit {
  0% {
    opacity: 0;
  }
  18%,
  82% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes eyes-lit-blink {
  0% {
    opacity: 0;
  }
  14%,
  44% {
    opacity: 1;
  }
  48% {
    opacity: 0.05;
  }
  53%,
  84% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* The menu button, right of the cat and centred on it. Its shape is
   images/pingato_menu.svg, drawn as a mask in the cat's colour.

   Opening the menu turns the wordmark and the button 90deg anticlockwise
   about the centre of the cat (the pivot): the wordmark swings from below
   the cat to its right, the button off the top. A second button, starting
   opposite the first across the pivot (so off the left edge), swings in
   below the cat to close the menu again; its icon is
   images/pingato_menu_close.svg, drawn upright as it shows there. Wide screens only; on narrow ones
   the mark already lies flat. */
.site-head {
  --mark-top: 12px;
  --mark-left: 12px;
  --cat-h: 60px;
  --cat-w: calc(60px * 3048 / 3253);
  --menu-gap: 28px;
  --menu-w: 20px;
  --menu-h: 22px;
  /* The close icon, upright size. */
  --close-w: 24px;
  --close-h: 16px;
  --menu-turn: 0.8s cubic-bezier(0.65, 0, 0.35, 1);
}

.menu-toggle {
  position: absolute;
  top: calc(var(--mark-top) + (var(--cat-h) - var(--menu-h)) / 2);
  left: calc(var(--mark-left) + var(--cat-w) + var(--menu-gap));
  width: var(--menu-w);
  height: var(--menu-h);
  padding: 0;
  border: 0;
  background: #d0efff;
  opacity: 0.6;
  cursor: pointer;
  -webkit-mask: url("/images/pingato_menu.svg") center / contain no-repeat;
  mask: url("/images/pingato_menu.svg") center / contain no-repeat;
}

.menu-toggle:hover {
  opacity: 0.9;
}

.menu-toggle:focus-visible {
  outline: 2px solid #00b0ff;
  outline-offset: 4px;
}

/* Only the button you can see is in the tab order (site.js). */
.menu-toggle.menu-back {
  display: none;
}

@media (min-width: 761px) {
  .menu-toggle {
    /* The pivot, from the button's own corner. */
    transform-origin: calc(-1 * (var(--cat-w) / 2 + var(--menu-gap))) 50%;
    transition: transform var(--menu-turn), opacity 0.2s ease;
  }

  /* Same centre as the first button, so the same path; its box is the
     close icon turned on its side, and the icon inside is turned back so
     it lands upright once the button has turned 90deg. */
  .menu-toggle.menu-back {
    display: block;
    top: calc(var(--mark-top) + (var(--cat-h) - var(--close-w)) / 2);
    left: calc(var(--mark-left) + var(--cat-w) + var(--menu-gap) + (var(--menu-w) - var(--close-h)) / 2);
    width: var(--close-h);
    height: var(--close-w);
    background: none;
    -webkit-mask: none;
    mask: none;
    transform-origin: calc(-1 * (var(--cat-w) / 2 + var(--menu-gap) + (var(--menu-w) - var(--close-h)) / 2)) 50%;
    transform: rotate(180deg);
  }

  .menu-back span {
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--close-w);
    height: var(--close-h);
    background: #d0efff;
    transform: translate(-50%, -50%) rotate(-90deg);
    -webkit-mask: url("/images/pingato_menu_close.svg") center / contain no-repeat;
    mask: url("/images/pingato_menu_close.svg") center / contain no-repeat;
  }

  .brand-type {
    /* The pivot, from the wordmark's own box (centred under the cat). */
    transform-origin: 50% calc(-1 * (12px + var(--cat-h) / 2));
    transition: transform var(--menu-turn);
  }

  .menu-open .menu-toggle {
    transform: rotate(-90deg);
  }

  .menu-open .menu-toggle.menu-back {
    transform: rotate(90deg);
  }

  .menu-open .brand-type {
    transform: rotate(-90deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .menu-toggle,
  .brand-type {
    transition: none;
  }
}

.brand-type {
  position: relative;
  width: 20px;
  height: calc(20px * 4012 / 429);
}

.brand-type span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(20px * 4012 / 429);
  height: 20px;
  background: #00b0ff;
  transform: translate(-50%, -50%) rotate(90deg);
  -webkit-mask: url("/images/pingato_type.svg") center / contain no-repeat;
  mask: url("/images/pingato_type.svg") center / contain no-repeat;
}

.contact,
.page {
  flex: 1;
  padding: 48px 0 64px;
}

.contact-title {
  margin: 0 0 12px;
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

/* The app's logo stands in for its name, sitting on the text baseline. */
.title-logo {
  display: inline-block;
  height: 0.82em;
  aspect-ratio: var(--ratio);
  vertical-align: baseline;
  background: var(--color);
  -webkit-mask: var(--logo) center / contain no-repeat;
  mask: var(--logo) center / contain no-repeat;
}

.contact-lede {
  margin: 0 0 32px;
  color: rgba(230, 244, 255, 0.7);
}

.contact-form {
  display: grid;
  gap: 22px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 16px;
  align-items: start;
}

.field {
  display: grid;
  gap: 6px;
}

.label {
  font-size: 0.95rem;
  font-weight: 600;
}

.optional,
.hint {
  font-weight: 400;
  font-size: 0.85rem;
  color: rgba(230, 244, 255, 0.5);
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  font-size: 1rem; /* 16px keeps iOS from zooming in on focus */
  color: inherit;
  background: rgba(230, 244, 255, 0.06);
  border: 1px solid rgba(230, 244, 255, 0.18);
  border-radius: 10px;
}

select {
  appearance: none;
  padding-right: 40px;
  background-image:
    linear-gradient(45deg, transparent 50%, #9fd8ff 50%),
    linear-gradient(-45deg, transparent 50%, #9fd8ff 50%);
  background-position:
    calc(100% - 20px) 50%,
    calc(100% - 15px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

select option {
  color: #e6f4ff;
  background: #0b1520;
}

textarea {
  resize: vertical;
  min-height: 160px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #00b0ff;
  outline-offset: 1px;
  border-color: transparent;
}

[aria-invalid="true"] {
  border-color: #ff6b6b;
}

.field-error,
.form-error {
  margin: 0;
  font-size: 0.9rem;
  color: #ff9a9a;
}

.form-error {
  margin-bottom: 20px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255, 107, 107, 0.1);
}

/* Filled only by bots; kept off-screen rather than display:none, which
   some bots check for. */
.trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.send {
  justify-self: start;
  padding: 13px 26px;
  font: inherit;
  font-weight: 600;
  color: #010408;
  background: #00b0ff;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.send:hover {
  background: #4cc8ff;
}

.send:focus-visible {
  outline: 2px solid #e6f4ff;
  outline-offset: 3px;
}

.sent p {
  margin: 0 0 12px;
}

a {
  color: #4cc8ff;
}

/* Pages drawn from the theme (pages.php, text-*.php) */
.page-title {
  margin: 0 0 8px;
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.page-meta {
  margin: 0 0 28px;
  font-size: 0.9rem;
  color: rgba(230, 244, 255, 0.5);
}

.page h2 {
  margin: 36px 0 10px;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.page p,
.page li {
  color: rgba(230, 244, 255, 0.82);
}

.page p {
  margin: 0 0 14px;
}

.page ul {
  margin: 0 0 14px;
  padding-left: 1.2em;
}

.page li + li {
  margin-top: 8px;
}

/* page.php: the "Effective <date>" line (paragraph class "meta"). */
.page p.meta {
  margin: -4px 0 28px;
  font-size: 0.9rem;
  color: rgba(230, 244, 255, 0.5);
}

/* ---------- Footer (same format as fbad.io's) ---------- */

.license-note {
  margin: 0;
  padding: 24px 24px calc(24px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  font-size: 0.68rem;
  font-weight: 400;
  line-height: 1.45;
  color: rgba(225, 239, 251, 0.38);
}

.license-note a {
  color: rgba(225, 239, 251, 0.55);
  text-decoration: none;
  white-space: nowrap;
}

.license-note a:hover {
  color: rgba(225, 239, 251, 0.85);
}

.license-note .footer-links {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

@media (max-width: 600px) {
  .license-note {
    justify-content: center;
    text-align: center;
    font-size: 0.62rem;
    padding-inline: 16px;
  }

  .license-note .license-credit {
    flex-basis: 100%;
  }

  .license-note .footer-links {
    margin-left: 0;
  }
}

@media (max-width: 760px) {
  .site-head {
    padding: 12px 16px 0;
  }

  .brand {
    position: relative;
    flex-direction: row;
    width: fit-content;
  }

  .brand-type {
    width: calc(20px * 4012 / 429);
    height: 20px;
  }

  .brand-type span {
    transform: translate(-50%, -50%);
  }

  /* On narrow screens the mark lies flat; the button follows the wordmark. */
  .site-head {
    display: flex;
    align-items: center;
    gap: 20px;
  }

  .menu-toggle {
    position: static;
  }

  .contact,
  .page {
    padding-top: 28px;
  }
}

@media (max-width: 600px) {
  .field-row {
    grid-template-columns: 1fr;
  }

  .send {
    justify-self: stretch;
  }
}
