/* Transport Republic: one page. Colours from the logo plate: wood, gold, cream, ink. */

@font-face {
  font-family: "Barlow Condensed";
  src: url("../fonts/BarlowCondensed-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Barlow Condensed";
  src: url("../fonts/BarlowCondensed-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}

:root {
  --ink: #1f1a15;
  --ink-soft: #4a3f33;
  --paper: #f4ecd8;
  --cream: #f4e7c1;
  --gold: #cdac54;
  --gold-deep: #a8842f;
  --wood: #70341e;
  --wood-deep: #4f2414;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-6: 3rem;
  --space-8: 4rem;
  --measure: 36rem;
  --page: 72rem;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.125rem/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--wood); }

h1, h2, .bar__name, .hero__slogan, .button, figcaption {
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
}
h2 {
  font-weight: 600;
  font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem);
  line-height: 1.1;
  margin: 0 0 var(--space-3);
  letter-spacing: 0.01em;
}
p { margin: 0 0 var(--space-2); max-width: var(--measure); }

/* Bar: the call to action stays in reach while scrolling. The game's wooden plank (T_UI_Plate), its ends kept. */
.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: 64px;
  padding: var(--space-1) var(--space-2);
  border: solid transparent;
  border-width: 0 12px;
  border-image: url("../img/ui-plate.webp?v=4") 0 24 fill / 0 12px stretch;
  /* Dark under the plank's rounded ends, so the page does not show through at the edges. */
  background: #2a140b;
  color: var(--cream);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.bar__name {
  color: var(--cream);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Buttons: the game's gold key (T_UI_Key: normal, hover, pressed), wood text; 56 px tall. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0 var(--space-4);
  border: 0 solid transparent;
  border-image: url("../img/ui-key.webp") 26 fill / 26px stretch;
  background: none;
  color: var(--wood-deep);
  font-weight: 600;
  font-size: 1.375rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(255, 248, 220, 0.6);
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.3));
}
.button:hover { border-image-source: url("../img/ui-key-hover.webp"); }
.button:active { border-image-source: url("../img/ui-key-pressed.webp"); transform: translateY(1px); }
.button:focus-visible, .bar__name:focus-visible { outline: 3px solid var(--cream); outline-offset: 3px; }
.button--small { min-height: 44px; padding: 0 var(--space-3); font-size: 1.125rem; border-image-width: 20px; }

/* Hero: the town, the plate, the slogan. */
.hero {
  position: relative;
  min-height: min(92vh, 56rem);
  display: grid;
  align-items: center;
  justify-items: center;
  overflow: hidden;
  color: var(--cream);
}
.hero__picture, .hero__picture img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.8s ease;
}
.hero__video.is-playing { opacity: 1; }
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center 40%, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0.45) 100%),
    linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.35));
}
.hero__content {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  text-align: center;
  padding: var(--space-8) var(--space-3);
  width: 100%;
  min-width: 0;          /* a grid item: the slogan would set its width, wider than a 320 px phone */
}
.hero__title { margin: 0 0 var(--space-3); width: min(640px, 86vw); }
.hero__title img { filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.55)); }
.hero__slogan {
  margin: 0;
  max-width: none;
  font-weight: 600;
  font-size: clamp(1.5rem, 0.9rem + 3.2vw, 3.25rem);
  letter-spacing: clamp(0.04em, 2vw, 0.1em);
  text-wrap: balance;
  text-transform: uppercase;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}
.hero__lead {
  margin: var(--space-1) 0 var(--space-4);
  font-size: 1.25rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}
.hero__actions { display: grid; gap: var(--space-2); justify-items: center; width: 100%; }
.hero__actions .button { width: 100%; max-width: 26rem; }
/* Facebook and Discord: icons (Bootstrap Icons, MIT), 48 px to tap. */
.social { display: flex; gap: var(--space-2); justify-content: center; margin-top: var(--space-1); }
.social__link {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: var(--cream);
  background: rgba(31, 26, 21, 0.55);
  border: 2px solid rgba(244, 231, 193, 0.7);
  transition: background-color 0.15s, color 0.15s;
}
.social__link svg { width: 24px; height: 24px; fill: currentColor; }
.social__link:hover { background: var(--cream); color: var(--wood-deep); }
.social__link:focus-visible { outline: 3px solid var(--cream); outline-offset: 3px; }
.social--foot .social__link { color: var(--wood); background: none; border-color: var(--wood); }
.social--foot .social__link:hover { background: var(--wood); color: var(--cream); }
.social--foot .social__link:focus-visible { outline-color: var(--wood); }

/* About. */
.about {
  max-width: var(--page);
  margin: 0 auto;
  padding: var(--space-8) var(--space-3);
  display: grid;
  gap: var(--space-4);
  align-items: center;
}
.still { margin: 0; }
.still img { border-radius: 8px; border: 6px solid var(--wood); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18); }
figcaption {
  margin-top: var(--space-1);
  font-weight: 500;
  font-size: 1.25rem;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

/* Gallery. */
.gallery {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--space-3) var(--space-8);
  display: grid;
  gap: var(--space-4);
}

/* Beta: the decision again, at the end, in the game's window (T_UI_WindowFrame, its panel stretched). */
.beta {
  padding: var(--space-6) var(--space-2);
  display: grid;
  justify-items: center;
}
.window {
  --frame-top: 100px;
  --frame: 64px;
  width: 100%;
  min-width: 0;          /* a grid item: otherwise its longest word or the button sets its width, wider than a phone */
  max-width: 48rem;
  display: grid;
  justify-items: center;
  text-align: center;
  color: var(--cream);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  border: solid transparent;
  border-width: var(--frame-top) var(--frame) var(--frame);
  border-image: url("../img/ui-window.webp") 100 64 64 fill / var(--frame-top) var(--frame) var(--frame) stretch;
  padding: var(--space-2) var(--space-2) var(--space-3);
}
.window p { margin-bottom: var(--space-4); }
.window .button { width: 100%; max-width: 26rem; text-shadow: 0 1px 0 rgba(255, 248, 220, 0.6); }

/* Lines between the sections: the game's vehicles at one scale, on a rail, a tram track and a road. Each drives
   across as its line scrolls through the window; standing still where scroll-driven animation is missing or motion
   is reduced. */
.line {
  --h: clamp(72px, 4rem + 4vw, 120px);
  --ground: 12px;
  position: relative;
  height: calc(var(--h) + var(--ground) + 8px);
  /* clip, not hidden: hidden would make the line its own scroller, and view() would follow it instead of the page. */
  overflow: clip;
}
.line__vehicle {
  position: absolute;
  bottom: calc(var(--ground) - 3px);
  left: 50%;
  width: auto;
  height: var(--h);
  max-width: none;
  transform: translateX(-50%);
}
.line::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--ground);
}
/* Rail: a steel line on wooden sleepers over gravel. */
.line--rail::after {
  background:
    linear-gradient(#8d9196, #5d6166) top / 100% 3px no-repeat,
    repeating-linear-gradient(90deg, #6b4a2f 0 8px, transparent 8px 22px) 0 3px / 100% 6px no-repeat,
    linear-gradient(#a59a86, #8a7f6c);
}
/* Tram: rails set in the street and the wire its pole touches. */
.line--tram { margin-bottom: var(--space-6); }
.line--tram::after {
  background:
    linear-gradient(#7a7e83, #7a7e83) 0 3px / 100% 2px no-repeat,
    linear-gradient(#8f8a80, #77726a);
}
.line--tram::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% - var(--ground) + 3px - var(--h));
  height: 2px;
  background: #3d3a36;
}
/* Road: asphalt with a dashed middle line. */
.line--road::after {
  background:
    repeating-linear-gradient(90deg, #efe6cf 0 28px, transparent 28px 56px) 0 50% / 100% 2px no-repeat,
    linear-gradient(#5a5753, #45423e);
}
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .line__vehicle {
      left: 0;
      animation: drive linear both;
      animation-timeline: view();
      animation-range: cover;
    }
    .line--tram .line__vehicle { animation-name: drive-back; }
    /* The road is the page's last line, too near its end for a whole crossing: the truck drives in and parks. */
    .line--road .line__vehicle { animation-name: park; animation-range: entry 0% entry 100%; }
  }
}
@keyframes park {
  from { transform: translateX(-100%); }
  to { transform: translateX(calc(50vw - 50%)); }
}
@keyframes drive {
  from { transform: translateX(-100%); }
  to { transform: translateX(100vw); }
}
@keyframes drive-back {
  from { transform: translateX(100vw); }
  to { transform: translateX(-100%); }
}

.foot {
  padding: var(--space-4) var(--space-3);
  text-align: center;
  font-size: 1rem;
  color: var(--ink-soft);
}
.foot p { margin: 0 auto var(--space-1); }

@media (max-width: 420px) {
  .bar { padding-inline: var(--space-2); }
  .bar__name { font-size: 1.0625rem; letter-spacing: 0.03em; }
  .button--small { padding: 0 var(--space-2); font-size: 1rem; }
  .window .button { padding-inline: var(--space-2); font-size: 1.125rem; }
}
@media (max-width: 640px) {
  .window { --frame-top: 64px; --frame: 40px; padding-inline: 0; }
}
@media (min-width: 640px) {
  .hero__actions .button, .window .button { width: auto; }
}
@media (min-width: 900px) {
  .about { grid-template-columns: 1fr 1fr; gap: var(--space-6); }
  .gallery { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
