/* =========================================================================
   SIMAH Event Survey — kiosk styles
   Theme: Saudi National Day (SND-GUIDELINE.pdf), SIMAH logo retained
   ========================================================================= */

/* ---- Brand typefaces ----------------------------------------------------
   Saudi National Day specifies the Saudi Font; SIMAH specifies RB. Drop
   either family's .woff2 files into assets/fonts/ and they take over.
   Until then the stack falls back to IBM Plex Sans Arabic.
   ------------------------------------------------------------------------ */
@font-face {
  font-family: "SaudiFont";
  src: url("../fonts/SaudiFont-Light.woff2") format("woff2");
  font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "SaudiFont";
  src: url("../fonts/SaudiFont-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "SaudiFont";
  src: url("../fonts/SaudiFont-Bold.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  /* Saudi National Day palette */
  --ground:    #002628;   /* deep green ground  */
  --deep-teal: #00343A;
  --green:     #00894A;   /* national green     */
  --lime:      #5ABA1C;
  --crimson:   #971A4D;
  --gold:      #7C5D21;
  --blue:      #0050AF;
  --purple:    #6565E0;
  --sage:      #607C4F;

  --white:     #FFFFFF;
  --ink:       #002628;

  --font: "SaudiFont", "IBM Plex Sans Arabic", -apple-system, BlinkMacSystemFont,
          "Segoe UI", Tahoma, sans-serif;

  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body.kiosk {
  font-family: var(--font);
  background: var(--ground);
  color: var(--white);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

/* ---- Background ---------------------------------------------------------- */

.bg-art {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-color: var(--ground);
  background-image: url("../img/snd-bg.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Scrim: the woven ground is bright at the top and bottom edges, which is
   exactly where the logos and the language button sit. This darkens those
   bands enough for white type without flattening the fabric in the middle. */
.bg-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 18, 16, .74) 0%,
    rgba(0, 18, 16, .30) 20%,
    rgba(0, 18, 16, .22) 50%,
    rgba(0, 18, 16, .34) 80%,
    rgba(0, 18, 16, .76) 100%
  );
}

/* ---- Logo bar ------------------------------------------------------------
   National Day mark on the left, SIMAH on the right. `direction: ltr` pins
   them to physical sides so they don't swap when the page flips to RTL.
   ------------------------------------------------------------------------ */

.topmarks {
  position: fixed;
  z-index: 3;
  inset-block-start: 0;
  inset-inline: 0;
  direction: ltr;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: clamp(1rem, 2.6vh, 2.1rem) clamp(1.25rem, 3.5vw, 3rem);

  transition: opacity .45s var(--ease);
}
body.is-thanking .topmarks { opacity: 0; }

.topmarks__snd {
  height: clamp(30px, 5vh, 58px);
  width: auto;
}
.topmarks__simah {
  height: clamp(32px, 5.4vh, 62px);
  width: auto;
  filter: drop-shadow(0 2px 12px rgba(0, 0, 0, .35));
}

/* ---- Layout -------------------------------------------------------------- */

.stage {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(1.25rem, 3.5vh, 3rem);
  padding: clamp(5.5rem, 13vh, 9rem) clamp(1.5rem, 5vw, 5rem) clamp(4.5rem, 11vh, 7rem);
  text-align: center;
  transition: opacity .45s var(--ease), transform .45s var(--ease);
}

body.is-thanking .stage {
  opacity: 0;
  transform: scale(.97);
  pointer-events: none;
}

/* ---- Prompt -------------------------------------------------------------- */

.prompt {
  display: grid;
  gap: clamp(.35rem, 1vh, .85rem);
  width: 100%;
}

.prompt__title {
  margin: 0;
  font-size: clamp(1.6rem, 3.4vw, 3rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.01em;
  text-wrap: balance;
  text-shadow: 0 2px 24px rgba(0, 0, 0, .35);
}

.prompt__question {
  margin: 0;
  font-size: clamp(.95rem, 1.5vw, 1.35rem);
  font-weight: 300;
  line-height: 1.45;
  color: rgba(255, 255, 255, .88);
  max-width: 46ch;
  margin-inline: auto;
}

/* ---- Options ------------------------------------------------------------- */

.options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(.75rem, 1.8vw, 1.75rem);
  width: 100%;
  max-width: 1500px;
  margin-inline: auto;
}

.opt {
  --opt-color: var(--green);

  display: grid;
  justify-items: center;
  align-content: center;
  gap: clamp(.5rem, 1.6vh, 1.4rem);

  min-height: clamp(170px, 30vh, 340px);
  padding: clamp(1rem, 2.5vh, 2.25rem) clamp(.5rem, 1.5vw, 1.5rem);

  font-family: inherit;
  background: var(--white);
  border: 3px solid transparent;
  border-radius: clamp(20px, 2.2vw, 34px);
  box-shadow: 0 18px 42px -18px rgba(0, 12, 10, .7);
  cursor: pointer;

  transition:
    transform .35s var(--ease),
    box-shadow .35s var(--ease),
    border-color .35s var(--ease),
    opacity .35s var(--ease);
}

.opt__face {
  display: block;
  color: var(--opt-color);
  width: clamp(64px, 9.5vw, 132px);
}
.opt__face svg { display: block; width: 100%; height: auto; }

.opt__label {
  font-size: clamp(1rem, 1.9vw, 1.85rem);
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
}

/* Pointer devices only — a kiosk finger shouldn't leave a stuck hover state */
@media (hover: hover) and (pointer: fine) {
  .opt:hover {
    transform: translateY(-8px);
    border-color: var(--opt-color);
    box-shadow: 0 30px 60px -22px rgba(0, 12, 10, .8);
  }
}

.opt:active,
.opt.is-pressed {
  transform: translateY(-4px) scale(.97);
  border-color: var(--opt-color);
}

.opt:focus-visible {
  outline: 4px solid var(--lime);
  outline-offset: 5px;
}

.options.is-locked .opt { pointer-events: none; }
.options.is-locked .opt:not(.is-chosen) { opacity: .38; }

.opt.is-chosen {
  border-color: var(--opt-color);
  box-shadow: 0 0 0 10px color-mix(in srgb, var(--opt-color) 35%, transparent);
}

/* ---- Language toggle ----------------------------------------------------
   Sits centred at the foot, clear of both logos.
   ------------------------------------------------------------------------ */

.lang-toggle {
  position: fixed;
  z-index: 3;
  inset-block-end: clamp(1rem, 2.6vh, 2rem);
  inset-inline: 0;
  margin-inline: auto;
  width: max-content;

  padding: .7em 1.7em;
  font-family: inherit;
  font-size: clamp(.85rem, 1.25vw, 1.1rem);
  font-weight: 600;
  color: var(--white);

  background: rgba(0, 137, 74, .26);
  border: 1.5px solid rgba(90, 186, 28, .55);
  border-radius: 999px;
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: background .25s var(--ease), transform .25s var(--ease), opacity .3s;
}
.lang-toggle:active { transform: scale(.95); }
@media (hover: hover) and (pointer: fine) {
  .lang-toggle:hover { background: rgba(0, 137, 74, .42); }
}

body.is-thanking .lang-toggle { opacity: 0; pointer-events: none; }

/* Show only the string for the active language */
[data-when]            { display: none; }
body[data-lang="ar"] [data-when="ar"],
body[data-lang="en"] [data-when="en"] { display: inline; }

/* ---- Thank you ----------------------------------------------------------- */

.thanks {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 2rem;
  text-align: center;

  background:
    radial-gradient(110% 80% at 50% 12%, rgba(0, 137, 74, .38) 0%, transparent 60%),
    linear-gradient(162deg, #00473A 0%, #00343A 45%, #002628 100%);
  opacity: 0;
  visibility: hidden;
  transition: opacity .5s var(--ease), visibility .5s;
}

body.is-thanking .thanks { opacity: 1; visibility: visible; }

.thanks__inner {
  display: grid;
  justify-items: center;
  gap: clamp(1rem, 3vh, 2.25rem);
  transform: translateY(18px) scale(.94);
  opacity: 0;
  transition: transform .6s var(--ease) .12s, opacity .6s var(--ease) .12s;
}
body.is-thanking .thanks__inner { transform: none; opacity: 1; }

.thanks__check { width: clamp(96px, 16vh, 168px); height: auto; }

.thanks__ring {
  fill: none;
  stroke: var(--lime);
  stroke-width: 3.5;
  opacity: .5;
}
.thanks__tick {
  fill: none;
  stroke: var(--lime);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 46;
  stroke-dashoffset: 46;
}
body.is-thanking .thanks__tick {
  animation: tick .55s var(--ease) .3s forwards;
}
@keyframes tick { to { stroke-dashoffset: 0; } }

.thanks__title {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 700;
  line-height: 1.1;
}
.thanks__text {
  margin: 0;
  font-size: clamp(1rem, 1.7vw, 1.5rem);
  font-weight: 300;
  color: rgba(255, 255, 255, .88);
}

/* ---- Offline queue badge ------------------------------------------------- */

.net-badge {
  position: fixed;
  z-index: 5;
  inset-block-end: clamp(.75rem, 2vh, 1.5rem);
  inset-inline-start: clamp(.75rem, 2vw, 1.5rem);

  display: flex;
  align-items: center;
  gap: .6em;
  padding: .55em 1.1em;

  font-size: .8rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--lime);
  border-radius: 999px;
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .6);
}

/* `display: flex` above outranks the browser's own [hidden] rule, so the
   badge needs this or it never hides. */
.net-badge[hidden] { display: none; }

.net-badge b {
  display: grid;
  place-items: center;
  min-width: 1.6em;
  padding: .1em .4em;
  background: rgba(0, 38, 40, .18);
  border-radius: 999px;
}

/* ---- Responsive ---------------------------------------------------------- */

/* Portrait screens and tablets — 2 x 2 */
@media (max-aspect-ratio: 1/1), (max-width: 900px) {
  .options { grid-template-columns: repeat(2, 1fr); }
  .opt     { min-height: clamp(150px, 22vh, 280px); }
  .opt__face { width: clamp(56px, 16vw, 110px); }
  .opt__label { font-size: clamp(1rem, 4.2vw, 1.7rem); }

  .topmarks { gap: 1rem; }
  .topmarks__snd   { height: clamp(24px, 4vh, 42px); }
  .topmarks__simah { height: clamp(26px, 4.4vh, 46px); }
}

/* Short landscape screens — keep everything above the fold */
@media (max-height: 620px) and (min-aspect-ratio: 1/1) {
  .stage { padding-block: 4.5rem 3.5rem; }
  .prompt__title { font-size: clamp(1.4rem, 3vw, 2.1rem); }
  .opt { min-height: 145px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
