/* Shared styles for the work-in-progress page and the error pages. */

:root {
  --crane: #bcae9f;
  --machine: #5a4f49;
  --bg: #fbf7f2;
  --text: #2b2522;
  --muted: #6f655e;
  --ground: #ebe3d9;
  --seg: #efe8df;
  --seg-active: #fffdfa;
  --button: #2b2522;
  --button-text: #fbf7f2;
  --focus: #3b82f6;
  --coral: #ff8a65;
  --yellow: #ffd166;
  --green: #5cc39f;
  --blue: #7aa7ff;
  --block-text: #2b2522;
  color-scheme: light;
}

:root.dark {
  --crane: #5f5650;
  --machine: #8e837b;
  --bg: #1b1817;
  --text: #f4ede6;
  --muted: #aa9f97;
  --ground: #2f2a27;
  --seg: #2a2522;
  --seg-active: #403935;
  --button: #f4ede6;
  --button-text: #1b1817;
  --focus: #7aa7ff;
  color-scheme: dark;
}

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

body {
  margin: 0;
  min-height: 100vh; /* older browsers */
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--bg);
  color: var(--text);
  font:
    16px/1.55 ui-rounded,
    'SF Pro Rounded',
    'Nunito',
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
  -webkit-font-smoothing: antialiased;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Header: language and theme switches. Spacing uses margins rather than flex `gap`, and the
   groups are divs rather than fieldsets (older browsers can't lay out a fieldset as flex). */

header {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding: 16px;
}

.switch {
  display: flex;
  margin: 0 0 0 8px;
  padding: 3px;
  border-radius: 999px;
  background: var(--seg);
}

.switch button {
  display: block;
  min-width: 34px;
  height: 28px;
  padding: 0 10px;
  line-height: 28px;
  text-align: center;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    background-color 0.15s,
    color 0.15s;
}

.switch button + button {
  margin-left: 2px;
}

.switch button:hover {
  color: var(--text);
}

.switch button[aria-pressed='true'] {
  background: var(--seg-active);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.switch svg {
  display: block;
  width: 15px;
  height: 15px;
  margin: 6.5px auto;
}

/* Main: building site, text and buttons. */

main {
  display: grid;
  place-items: center;
  padding: 16px 20px 32px;
  text-align: center;
}

.content {
  width: 100%;
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Headings stay on one line: the longest ones ("Building something awesome", "Budujemy coś
   niesamowitego") are about 16.3× their font size wide, so the size follows the viewport and
   tops out where they still fit the content column (a media query rather than clamp(), for
   older browsers). */
h1 {
  margin: 0;
  font-size: 5.1vw;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

@media (min-width: 863px) {
  h1 {
    font-size: 44px;
  }
}

.lead {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 18px;
  text-wrap: pretty;
}

/* "Coming soon..." — the dots light up one after another, then fade together. They always take
   their space, so the text doesn't shift. With reduced motion they just stay lit. */

.ellipsis span {
  animation: ellipsis 1.8s infinite;
}

.ellipsis span:nth-child(2) {
  animation-delay: 0.3s;
}

.ellipsis span:nth-child(3) {
  animation-delay: 0.6s;
}

@keyframes ellipsis {
  0%,
  15% {
    opacity: 0;
  }
  35%,
  75% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ellipsis span {
    animation: none;
  }
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 23px;
}

.actions > * {
  margin: 5px;
}

.button {
  display: inline-flex;
  align-items: center;
  padding: 11px 20px;
  border: 2px solid var(--button);
  border-radius: 999px;
  background: var(--button);
  color: var(--button-text);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s;
}

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

.button.secondary {
  background: none;
  color: var(--text);
}

.button svg {
  margin-right: 8px;
  width: 18px;
  height: 18px;
}

footer {
  padding: 16px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* The building site from crane.js, on the work-in-progress page and the error pages, in this
   template's colours (they follow dark mode). The space is reserved up front so the text doesn't
   jump when it mounts. */
.crane-site {
  --crane-block-1: var(--coral);
  --crane-block-2: var(--yellow);
  --crane-block-3: var(--green);
  --crane-block-4: var(--blue);
  --crane-frame: var(--crane);
  --crane-machine: var(--machine);
  --crane-paint: var(--yellow);
  --crane-ground: var(--ground);
  --crane-window: var(--bg);
  --crane-text: var(--block-text);
  width: 320px;
  height: 250px;
  margin: 0 auto 24px;
}

/* Without JS there's no building site, so no empty space for it either. */
:root:not(.js) .crane-site {
  display: none;
}

/* Narrow phones: shrink the whole scene; zoom keeps crane.js's layout maths in step. */
@media (max-width: 359px) {
  .crane-site {
    zoom: 0.85;
  }
}
