/* Shared look for every page. Brand: cocoa #6A4C46, sand #B98B5E (never for text),
   ivory #F7F2EA, espresso #2A2321, stone #CEC3B7. Phone first, right to left. */

/* ---- Ticket 11: the Arabic font, served by this site (public/fonts/; SIL Open Font License, see fonts/OFL.txt).
   Noto Sans Arabic, Arabic subset, weights 400 and 700 (600 uses the 700 file). `swap` shows the
   system font at once and until the file arrives; if it never arrives the system font stays. ---- */
@font-face {
  font-family: "Noto Sans Arabic";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/noto-sans-arabic-arabic-400-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
  font-family: "Noto Sans Arabic";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/noto-sans-arabic-arabic-700-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
/* ---- end of ticket 11 ---- */

:root {
  --cocoa: #6a4c46;
  --sand: #b98b5e;
  --ivory: #f7f2ea;
  --espresso: #2a2321;
  --stone: #cec3b7;
  --font: "Noto Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--ivory);
  color: var(--espresso);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.8;
}

main {
  flex: 1;
  width: 100%;
  max-width: 34rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
}

h1 {
  margin: 0 0 0.5rem;
  color: var(--cocoa);
  font-size: 1.5rem;
  line-height: 1.5;
}

p {
  margin: 0 0 0.75rem;
}

h2 {
  margin: 0 0 0.5rem;
  color: var(--cocoa);
  font-size: 1.2rem;
  line-height: 1.6;
}

a {
  color: var(--cocoa);
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1.25rem;
  padding: 1rem 1.25rem 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--cocoa);
}

.footer-link {
  padding: 0.25rem 0.5rem;
  margin: -0.25rem -0.5rem;
  text-underline-offset: 0.25em;
}

/* Cards, forms and buttons (admin screens first; later pages reuse them). */
.narrow {
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 26rem;
}

.card {
  width: 100%;
  padding: 1.5rem 1.25rem;
  background: #fffdf9;
  border: 1px solid var(--stone);
  border-radius: 1.25rem;
}

.form label {
  display: block;
  margin: 1rem 0 0.35rem;
  font-weight: 600;
  color: var(--cocoa);
}

.form input {
  display: block;
  width: 100%;
  min-height: 3rem;
  padding: 0.5rem 0.85rem;
  border: 1.5px solid var(--stone);
  border-radius: 0.85rem;
  background: #fff;
  color: var(--espresso);
  font: inherit;
  font-size: 1.05rem; /* 16px or more, so phones do not zoom in on focus */
}

.form input:focus-visible,
button:focus-visible,
.button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--sand);
  outline-offset: 2px;
}

.form .pin-input {
  text-align: center;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  font-size: 1.6rem;
  letter-spacing: 0.4em;
  padding-inline-start: calc(0.85rem + 0.4em); /* keeps the digits centred despite the spacing */
}

button,
.button {
  display: block;
  width: 100%;
  min-height: 3rem;
  margin-top: 1.1rem;
  padding: 0.6rem 1rem;
  border: 0;
  border-radius: 0.85rem;
  background: var(--cocoa);
  color: #fffdf9;
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

.form-message {
  margin: 0.85rem 0 0;
  padding: 0.6rem 0.85rem;
  border-radius: 0.85rem;
  background: #f6e7e2;
  color: #7a2e22;
  font-size: 0.95rem;
}

.note {
  margin: 0.85rem 0 0;
  font-size: 0.85rem;
  color: var(--cocoa);
  text-align: center;
}

/* The signed-in admin: header, tab bar, content. */
.admin-header {
  width: 100%;
  max-width: 34rem;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 0;
}

.admin-kicker {
  margin: 0;
  font-size: 0.85rem;
  color: var(--cocoa);
}

.admin-header h1 {
  margin: 0;
  font-size: 1.3rem;
  overflow-wrap: anywhere;
}

.admin-tabs {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  max-width: 34rem;
  margin: 0 auto;
  padding: 0.85rem 1.25rem 0;
  overflow-x: auto;
}

.admin-tabs[hidden] {
  display: none;
}

.admin-tabs a {
  flex: none;
  min-height: 2.75rem;
  padding: 0.4rem 1rem;
  border: 1px solid var(--stone);
  border-radius: 999px;
  background: #fffdf9;
  text-decoration: none;
  font-weight: 600;
}

.admin-tabs a[aria-current="page"] {
  background: var(--cocoa);
  border-color: var(--cocoa);
  color: #fffdf9;
}

.admin-main {
  padding-top: 1rem;
}

/* A calm, centred message: «قيد التجهيز» and the not-found page. */
.calm {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* ---- Ticket 03: the header and menu of every public page (src/site-header.js) ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.5rem 1rem;
  padding-top: calc(0.5rem + env(safe-area-inset-top, 0px));
  background: var(--ivory); /* solid: text scrolling under it must not show through (ticket 14) */
  border-bottom: 1px solid var(--stone);
}

.site-brand {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--cocoa);
  text-decoration: none;
}

.site-logo {
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  object-fit: contain;
  border-radius: 0.5rem;
}

/* The school name wraps (two lines for most names) and is never cut off. */
.site-name {
  min-width: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.site-menu-button {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  padding: 0.3rem 0.85rem;
  border: 1.5px solid var(--cocoa);
  border-radius: 999px;
  background: #fffdf9;
  color: var(--cocoa);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  user-select: none;
  -webkit-user-select: none;
}

.site-menu-button::-webkit-details-marker {
  display: none;
}

.site-menu-button:focus-visible {
  outline: 3px solid var(--sand);
  outline-offset: 2px;
}

.site-menu-box[open] .site-menu-button {
  background: var(--cocoa);
  color: #fffdf9;
}

.site-menu {
  position: absolute;
  top: 100%;
  inset-inline: 0;
  display: grid;
  gap: 0.4rem;
  padding: 0.75rem 1rem 1rem;
  background: var(--ivory);
  border-bottom: 1px solid var(--stone);
  box-shadow: 0 0.75rem 1.5rem rgba(42, 35, 33, 0.12);
}

.site-menu a {
  display: flex;
  align-items: center;
  min-height: 3rem;
  padding: 0.4rem 1rem;
  border: 1px solid var(--stone);
  border-radius: 0.85rem;
  background: #fffdf9;
  font-weight: 600;
  text-decoration: none;
}
/* ---- end of ticket 03 ---- */

.calm-mark {
  width: 6.5rem;
  height: 6.5rem;
  margin-bottom: 1.25rem;
}

.calm-card {
  width: 100%;
  padding: 1.75rem 1.25rem;
  background: #fffdf9;
  border: 1px solid var(--stone);
  border-radius: 1.25rem;
}

/* Ticket 08: with four tabs or more the bar wraps onto a second line, so no tab is cut off on a phone. */
.admin-tabs {
  flex-wrap: wrap;
}

/* ---- Owner change: the store link and the store card (store-card.js) ---- */
/* Ticket 28: the credit looks like a link: a small pill with a shop bag and an arrow */
.footer-credit {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  padding: 0.35rem 1rem;
  border: 1px solid rgba(106, 76, 70, 0.35);
  border-radius: 999px;
  background: #fffdf9;
  color: var(--cocoa);
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(42, 35, 33, 0.08);
}
.footer-credit > span:not(.footer-credit-arrow) {
  text-decoration: underline;
  text-decoration-color: rgba(106, 76, 70, 0.45);
  text-underline-offset: 0.3em;
}
.footer-credit:hover,
.footer-credit:focus-visible {
  background: #f3e8da;
}
.footer-credit-arrow {
  font-size: 1.05em;
  line-height: 1;
}
.site-footer {
  align-items: center;
}
.store-card {
  margin: 1.25rem auto 0;
  max-width: 26rem;
  padding: 0.75rem 1rem;
  border: 1px solid #CEC3B7;
  border-radius: 0.75rem;
  background: #fffdf9;
  text-align: center;
  font-size: 0.9rem;
  color: #2A2321;
}
.store-card p {
  margin: 0 0 0.25rem;
}
.store-card a {
  color: #6A4C46;
  font-weight: 700;
  text-underline-offset: 0.25em;
}
.store-card[hidden] {
  display: none;
}

/* Ticket 28: the store ad at the bottom of every public page, just above the footer */
.store-ad {
  width: calc(100% - 2.5rem);
  max-width: 31.5rem;
  margin: 0.75rem auto 0.5rem;
  padding: 0.6rem 1.25rem 1.4rem;
  border: 1px solid rgba(185, 139, 94, 0.45);
  border-radius: 1.75rem;
  background:
    radial-gradient(120% 70% at 50% 0%, #fde9ec 0%, rgba(253, 233, 236, 0) 60%),
    linear-gradient(170deg, #fffdf9 0%, #f4ebdf 100%);
  box-shadow:
    0 10px 24px rgba(106, 76, 70, 0.14),
    inset 0 2px 0 rgba(255, 255, 255, 0.9),
    inset 0 -4px 10px rgba(185, 139, 94, 0.12);
  text-align: center;
  color: var(--espresso);
}
.store-ad-art {
  display: block;
  width: 9.5rem;
  height: auto;
  margin: 0 auto -0.2rem;
  filter: drop-shadow(0 4px 4px rgba(106, 76, 70, 0.15));
}
.store-ad-kicker {
  display: inline-block;
  margin: 0 0 0.4rem;
  padding: 0.05rem 0.75rem;
  border-radius: 999px;
  background: #e3efe5;
  color: #3f5c46;
  font-size: 0.78rem;
  font-weight: 700;
}
.store-ad-title {
  margin: 0;
  color: var(--cocoa);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.55;
  text-wrap: balance;
}
.store-ad-body {
  margin: 0.35rem auto 1rem;
  max-width: 22rem;
  font-size: 0.95rem;
  line-height: 1.75;
}
.store-ad-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 3.25rem;
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  background: linear-gradient(180deg, #7a5a52 0%, var(--cocoa) 100%);
  box-shadow: 0 6px 14px rgba(106, 76, 70, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  color: #fffdf9;
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
}
.store-ad-button span {
  font-size: 1.15em;
  line-height: 1;
}
.store-ad-button:hover,
.store-ad-button:focus-visible {
  background: #563b36;
}
.store-ad-button:active {
  transform: translateY(1px);
  box-shadow: 0 3px 8px rgba(106, 76, 70, 0.3);
}

/* ---- end of the store link and card ---- */

/* ---- Ticket 21: the offline demo's quiet bar (ADR 0003) ---- */
.demo-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.25rem 0.6rem;
  padding: 0.45rem 1rem;
  background: #EFE6DA;
  border-bottom: 1px solid #CEC3B7;
  color: #2A2321;
  font-size: 0.85rem;
  line-height: 1.6;
  text-align: center;
}
.demo-bar-label {
  padding: 0 0.6rem;
  border: 1px solid #6A4C46;
  border-radius: 999px;
  color: #6A4C46;
  font-weight: 700;
}
.demo-reset[hidden] {
  display: none;
}
.demo-reset {
  width: auto;
  min-height: 0;
  margin: 0;
  padding: 0.1rem 0.7rem;
  border: 1px solid #6A4C46;
  border-radius: 999px;
  background: transparent;
  color: #6A4C46;
  font: inherit;
  cursor: pointer;
}
