/* ==========================================================================
   Nostii Games — site styles
   One file for both pages. Colours and fonts match the original site.

   QUICK EDITS
   - Logo size on the landing page ........ --logo-w   (below)
   - Gap between logo and tagline ......... --logo-gap (below). It is a share of
     the logo width, so it scales with the logo and never needs nudging.
   - Brand colours ........................ the --blue / --red / --green / --yellow values
   ========================================================================== */

:root {
  /* Palette (same values as the original site) */
  --bg: hsl(45 20% 98%);
  --fg: hsl(0 0% 14%);
  --muted: hsl(0 0% 43%);
  --border: hsl(40 8% 86%);
  --secondary: hsl(40 10% 94%);
  --ring: hsl(0 0% 25%);

  /* Colours taken from the Nostii logo */
  --blue: #1458c5;
  --red: #ed1c24;
  --green: #16a34a;
  --yellow: #ffbf27;
  --yellow-text: #946800;

  /* Layout */
  --page-pad: 6.2%;

  /* Landing page: logo width scales smoothly with the screen (200px up to 520px),
     limited by screen height too so it still fits on a phone held sideways.
     The tagline gap is always 7% of that width. Swap the logo file and the
     spacing stays correct. */
  --logo-w: clamp(200px, min(80vw, 70vh), 520px);
  --logo-gap: calc(var(--logo-w) * 0.07);

  color-scheme: light;
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
p {
  margin: 0;
}

img,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 180ms ease, color 180ms ease, text-decoration-color 180ms ease;
}

/* Hover effects only on devices that really hover, so phones never get "stuck" hover states */
@media (hover: hover) {
  a:hover {
    opacity: 0.72;
  }
}

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

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 12px 20px;
  background: var(--fg);
  color: var(--bg);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---------- Landing page ---------- */

.landing-page {
  background: #fff; /* so the area behind phone address bars / notches is white too */
}

.landing {
  min-height: 100vh;
  min-height: 100svh; /* stays stable while phone address bars show/hide */
  display: flex;
  flex-direction: column;
  background: #fff;
  color: #242424;
  /* Respects phone notches and rounded corners */
  padding: max(35px, env(safe-area-inset-top)) max(5%, env(safe-area-inset-right))
    max(35px, env(safe-area-inset-bottom)) max(5%, env(safe-area-inset-left));
}

.landing-top,
.landing-bottom {
  gap: 20px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.6px;
  color: #777;
}

.landing-top {
  display: flex;
  justify-content: space-between;
}

/* Bottom bar: text on the left, X link truly centred, text on the right */
.landing-bottom {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.landing-bottom > :first-child {
  justify-self: start;
}

.landing-bottom > :last-child {
  justify-self: end;
}

.landing-social {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
  color: #777;
}

.landing-social svg {
  width: 1.15em;
  height: 1.15em;
  fill: currentColor;
}

@media (hover: hover) {
  .landing-social:hover {
    color: #242424;
    opacity: 1;
  }
}

/* On touch screens make the tap area a comfortable 44px without making the bar taller */
@media (pointer: coarse) {
  .landing-social {
    min-height: 44px;
    margin-block: -14px;
    padding-inline: 8px;
  }
}

/* Logo + tagline live in ONE centred column. The gap is set by --logo-gap,
   so there are no negative margins and nothing can overlap the logo. */
.landing-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--logo-gap);
  padding: 20px 0 50px;
}

.landing-brand {
  width: var(--logo-w);
  transition: transform 350ms ease;
}

.landing-logo {
  width: 100%;
  height: auto;
}

.landing-instruction {
  font-size: clamp(10px, 0.25vw + 9px, 11px);
  font-weight: 700;
  letter-spacing: 1.8px;
  padding-left: 1.8px; /* balances the trailing letter-spacing so the text is truly centred */
  color: #777;
  text-align: center;
}

/* Logo grows slightly on hover and presses in when clicked/tapped */
@media (hover: hover) {
  .landing-brand:hover {
    transform: scale(1.025);
  }
}

.landing-brand:active {
  transform: scale(0.98);
}

/* Gentle entrance on load (switched off automatically for visitors who prefer less motion) */
@media (prefers-reduced-motion: no-preference) {
  .landing-logo {
    animation: logo-in 650ms ease-out backwards;
  }

  .landing-instruction {
    animation: fade-in 650ms ease-out 250ms backwards;
  }
}

@keyframes logo-in {
  from {
    opacity: 0;
    transform: scale(1.12);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 600px) {
  .landing {
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
    padding-top: max(26px, env(safe-area-inset-top));
    padding-bottom: max(26px, env(safe-area-inset-bottom));
  }

  .landing-top,
  .landing-bottom {
    font-size: 8px;
    letter-spacing: 1px;
  }

  /* Not enough room for three items in a row: X link on top, the two texts underneath */
  .landing-bottom {
    grid-template-columns: auto auto;
    justify-content: space-between;
    row-gap: 4px;
  }

  .landing-bottom > span {
    white-space: nowrap;
  }

  .landing-social {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-self: center;
  }
}

/* ---------- Hidden extra: logo spin ----------
   Click or tap the logo 3 times within 3 seconds and it spins, then eases to a stop.
   (The click counting is the small script at the bottom of index.html.)

   QUICK EDITS
   - How long the spin lasts ... --spin-time
   - Number of spins ........... --spin-turns
   - Spin direction ............ in "logo-spin" change rotateX to rotateY for a sideways spin */

:root {
  --spin-time: 1.6s;
  --spin-turns: 3;
}

.landing-brand {
  touch-action: manipulation; /* quick taps never zoom the page on phones */
  -webkit-user-select: none;
  user-select: none;
}

.landing-brand img {
  -webkit-user-drag: none;
}

/* Starts fast, then spins down smoothly to a stop */
.landing-brand.is-spinning {
  animation: logo-spin var(--spin-time) cubic-bezier(0.2, 0.6, 0.25, 1);
}

@keyframes logo-spin {
  from {
    transform: perspective(900px) rotateX(0deg);
  }
  to {
    transform: perspective(900px) rotateX(calc(var(--spin-turns) * -360deg));
  }
}

/* ---------- Header and footer (portfolio page) ---------- */

.site-header,
.site-footer {
  max-width: 1440px;
  margin: auto;
  padding: 0 var(--page-pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header {
  min-height: 106px;
  gap: 32px;
  border-bottom: 1px solid var(--border);
}

.header-logo {
  display: block;
  width: clamp(112px, 30vw, 145px);
  flex: none;
}

.site-header nav {
  display: flex;
  gap: 31px;
  font-size: 12px;
}

.site-header nav a {
  min-height: 44px; /* comfortable tap target */
  display: flex;
  align-items: center;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 7px;
}

/* Menu links pick up the logo colours: 1st = blue, 2nd = green */
.site-header nav a:nth-child(1):hover,
.site-header nav a:nth-child(1):focus-visible {
  color: var(--blue);
  text-decoration-color: var(--blue);
}

.site-header nav a:nth-child(2):hover,
.site-header nav a:nth-child(2):focus-visible {
  color: var(--green);
  text-decoration-color: var(--green);
}

@media (hover: hover) {
  .site-header nav a:hover {
    opacity: 1; /* colour change replaces the fade for the menu */
  }
}

.site-footer {
  min-height: 100px;
  gap: 25px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  color: var(--muted);
  padding-bottom: env(safe-area-inset-bottom);
}

.footer-brand {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}

.footer-brand::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 7px;
  border-radius: 50%;
  background: var(--red);
  vertical-align: middle;
}

/* ---------- Content sections ---------- */

.content-page {
  max-width: 1440px;
  margin: auto;
  padding: 90px var(--page-pad) 60px;
  min-height: 75vh;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 10px;
  font-weight: 550;
  letter-spacing: 1.8px;
  line-height: 1.7;
}

.content-page h1 {
  margin: 20px 0;
  font-size: clamp(38px, 5vw, 64px);
  font-weight: 450;
  letter-spacing: -2.5px;
  line-height: 1.15;
}

.page-description {
  max-width: 650px;
  color: var(--muted);
  line-height: 1.8;
}

.page-description + .page-description {
  margin-top: 1em;
}

.about-section {
  padding-top: 30px;
  border-top: 1px solid var(--border);
}

.embed-block {
  margin-top: 55px;
}

.embed-summary {
  max-width: 650px;
  margin-bottom: 18px;
  font-size: 13px;
  line-height: 1.8;
}

.embed-slot {
  aspect-ratio: 16 / 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--secondary);
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 1.3px;
  text-align: center;
  padding: 0 16px;
}

.embed-slot svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Real media dropped into an embed block fills the same 16:9 frame */
.embed-block > img,
.embed-block > video,
.embed-block > iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  object-fit: cover;
}

@media (max-width: 800px) {
  .site-header {
    gap: 16px;
  }

  .site-header nav {
    gap: 22px;
  }

  .site-footer {
    flex-wrap: wrap;
    padding-top: 25px;
    padding-bottom: max(25px, env(safe-area-inset-bottom));
    gap: 15px;
  }

  .site-footer > span {
    order: 3;
    width: 100%;
  }

  .content-page {
    padding-top: 60px;
  }
}

/* ---------- Reduced motion: no animation or smooth scrolling for people who ask for it ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
