/* Shared styles for the Nabat Riwaq site: design tokens, base rules, the page
   shell (utility bar, navigation, page banner, feedback bar,
   footer) and the components every page reuses. Sizes are in px and follow the
   1440px design; pages add their own stylesheet for page-specific layout. */

@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/ibm-plex-sans-arabic-400-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-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: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/ibm-plex-sans-arabic-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/ibm-plex-sans-arabic-500-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-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: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/ibm-plex-sans-arabic-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/ibm-plex-sans-arabic-600-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-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: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/ibm-plex-sans-arabic-600-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/ibm-plex-sans-arabic-700-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-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: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/ibm-plex-sans-arabic-700-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Green scale */
  --green-50: #f3fcf6;
  --green-100: #dff6e7;
  --green-200: #b8eacb;
  --green-300: #88d8ad;
  --green-400: #54c08a;
  --green-600: #1b8354;
  --green-700: #166a45;
  --green-900: #104631;
  --green-footer: #074d31;
  /* Neutrals */
  --text-default: #161616;
  --text-paragraph: #384250;
  --text-secondary: #6c737f;
  --border: #d2d6db;
  --bg-white: #ffffff;
  --bg-neutral: #f3f4f6;
  --bg-pressed: #e5e7eb;
  /* Accent roles */
  --accent-surface-subtle: var(--green-50);
  --accent-surface-soft: var(--green-100);
  --accent-border: var(--green-200);
  --accent-focus: var(--green-400);
  --accent-scientific: var(--green-600);
  --success-bg: #ecfdf3;
  --success-text: #067647;
  /* Shape */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --page-gutter: 80px;
  --shell-gutter: 32px;
  --font: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  color-scheme: light;
}

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

html {
  /* Kept at 18px because the staff and games stylesheets size in rem. */
  font-size: 18px;
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 16px;
  line-height: 24px;
  color: var(--text-default);
  background: var(--bg-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  flex: 1 0 auto;
}

img {
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
figure,
dl,
dd {
  margin: 0;
}

ul[class],
ol[class] {
  padding: 0;
  list-style: none;
}

[hidden] {
  display: none !important;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  inset-inline-start: 16px;
  top: -100px;
  z-index: 100;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--green-600);
  color: #fff;
  font-weight: 500;
  text-decoration: none;
}

.skip-link:focus {
  top: 8px;
}

/* The skip link moves focus to the main content; the region itself shows no ring. */
main[tabindex='-1']:focus {
  outline: 0;
}

/* ---------- Icons ----------
   Icon files keep the size they have in the design; `.ico` is the square slot
   they are centred in. */
.ico {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  inline-size: 24px;
  block-size: 24px;
}

.ico--20 {
  inline-size: 20px;
  block-size: 20px;
}

.ico--16 {
  inline-size: 16px;
  block-size: 16px;
}

.ico > img,
.ico > svg {
  display: block;
  flex: none;
  max-width: none;
}

.ico--flip > img {
  transform: scaleX(-1);
}

.petal {
  display: inline-block;
  flex: none;
  inline-size: 12px;
  block-size: 12px;
  background: url('../img/ui/petal-mark.svg') center / 100% 100% no-repeat;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--green-600);
  color: #fff;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn:hover {
  background: var(--green-700);
}

.btn:active {
  background: var(--green-900);
}

.btn[disabled],
.btn[aria-disabled='true'] {
  background: var(--bg-pressed);
  color: #9da4ae;
  cursor: not-allowed;
}

.btn--md {
  height: 32px;
  padding: 0 12px;
  font-size: 14px;
  line-height: 20px;
}

.btn--outline {
  /* The stroke sits inside the 16px padding in the design. */
  padding: 0 15px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-default);
}

.btn--outline:hover {
  background: var(--bg-neutral);
}

.btn--outline:active {
  background: var(--bg-pressed);
}

.btn--outline.btn--md {
  padding: 0 11px;
}

/* ---------- Utility bar ---------- */
.util-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 40px;
  padding: 0 var(--shell-gutter);
  border-block: 1px solid var(--border);
  background: var(--bg-neutral);
}

.util-bar__info {
  display: flex;
  flex: 1 0 0;
  align-items: center;
  gap: 16px;
  min-width: 0;
  color: var(--text-paragraph);
}

.util-bar__item {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.util-bar__actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.util-bar__btn {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  cursor: pointer;
}

.util-bar__btn:hover {
  background: var(--bg-pressed);
}

.util-bar__btn[aria-disabled='true'] {
  opacity: 0.4;
  cursor: not-allowed;
}

.util-bar__btn[aria-pressed='true'] {
  background: var(--border);
}

/* ---------- Navigation header ---------- */
.site-header {
  position: relative;
  z-index: 20;
  padding: 0 var(--shell-gutter);
  border-bottom: 1px solid var(--border);
  background: var(--bg-white);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 16px;
  /* 72px bar; the divider is drawn over its last pixel in the design. */
  min-height: 72px;
  margin-bottom: -1px;
}

/* The logo gives way before the bar wraps (a phone with the text enlarged and the staff bell). */
.site-header__logo {
  display: block;
  flex: 0 1 162px;
  min-width: 0;
  max-width: 162px;
}

.site-header__logo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 162 / 40;
  object-fit: cover;
}

.site-nav {
  display: flex;
  flex: 1 0 0;
  min-width: 0;
}

.site-nav__list {
  display: flex;
  flex: 1 0 0;
  /* Items go to a second row instead of leaving the page when the text-size tool
     zooms a window that is only just wide enough for the bar. */
  flex-wrap: wrap;
  align-items: center;
  min-width: 0;
  margin: 0;
}

.site-nav__link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 72px;
  padding: 8px 16px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-default);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}

.site-nav__link:hover {
  background: var(--bg-neutral);
}

.site-nav__link[aria-current='page'] {
  background: var(--bg-pressed);
}

.site-nav__link[aria-current='page']::after {
  content: '';
  position: absolute;
  inset-inline: 8px;
  top: 66px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--green-600);
}

/* Staff tools: only shown to signed-in team members (staff-nav.js). */
.nav-staff {
  position: relative;
  margin-inline-start: auto;
}

.nav-staff__toggle .icon {
  width: 16px;
  height: 16px;
}

.nav-staff__menu {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 4px);
  display: none;
  min-width: 260px;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-white);
  box-shadow: 0 12px 24px rgba(16, 24, 40, 0.12);
  list-style: none;
}

.nav-staff__toggle[aria-expanded='true'] + .nav-staff__menu {
  display: block;
}

.nav-staff__menu .site-nav__link {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  height: auto;
  padding: 8px 12px;
}

.nav-staff__menu .site-nav__link[aria-current='page']::after {
  display: none;
}

.nav-staff__menu small {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 400;
  line-height: 18px;
}

.burger {
  display: none;
  flex: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  margin-inline-start: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: none;
  cursor: pointer;
}

.burger span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--text-default);
}

/* ---------- Page banner ---------- */
.page-header {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  height: 232px;
  padding: 0 var(--page-gutter);
  overflow: hidden;
  color: #fff;
  background: var(--green-900);
}

.page-header::before,
.page-header::after {
  content: '';
  position: absolute;
  inset: 0;
}

.page-header::before {
  /* Pages may swap the photo and its crop: set these on .page-header. */
  top: var(--page-header-top, -18.94%);
  height: var(--page-header-height, 206.9%);
  background: var(--page-header-image, url('../img/page-header-bg.jpg')) center / 100% 100% no-repeat;
}

.page-header::after {
  background: var(
    --page-header-veil,
    linear-gradient(
      90deg,
      rgba(16, 70, 49, 0.15) 0%,
      rgba(16, 70, 49, 0.35) 40%,
      rgba(16, 70, 49, 0.85) 62%,
      rgba(16, 70, 49, 0.95) 100%
    )
  );
}

.page-header > * {
  position: relative;
  z-index: 1;
}

.page-header :focus-visible {
  outline-color: #fff;
}

.page-header__title {
  font-size: 40px;
  font-weight: 700;
  line-height: 52px;
}

.page-header__lead {
  color: rgba(255, 255, 255, 0.85);
  font-size: 18px;
  line-height: 28px;
}

/* ---------- Page body ---------- */
.page-main {
  padding: 56px var(--page-gutter);
}

/* ---------- Plant card ---------- */
.plant-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-white);
}

.plant-card__media {
  position: relative;
  flex: none;
  height: 240px;
  background: var(--bg-neutral);
}

.plant-card__media img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.plant-card__body {
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 20px 24px 24px;
}

.plant-card__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-scientific);
  font-size: 13px;
  font-weight: 500;
  line-height: 20px;
}

.plant-card__title {
  font-size: 22px;
  font-weight: 700;
  line-height: 32px;
}

.plant-card__title a {
  text-decoration: none;
}

.plant-card__scientific {
  color: var(--accent-scientific);
  font-size: 14px;
  line-height: 20px;
  direction: ltr;
}

.plant-card__description {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 24px;
}

.plant-card__action {
  margin-top: 16px;
}

/* ---------- Feedback bar ---------- */
.page-feedback__modified {
  padding: 16px var(--page-gutter);
  font-size: 14px;
  line-height: 20px;
}

.page-feedback__bar {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 88px;
  padding: 22px var(--page-gutter) 24px;
  border-top: 2px solid var(--green-600);
}

.page-feedback__ask {
  display: flex;
  flex: 1 0 0;
  align-items: center;
  gap: 24px;
  min-width: 0;
}

.page-feedback__actions {
  display: flex;
  gap: 16px;
}

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  min-height: 504px;
  /* The last 52px hold the copyright line. */
  padding: 40px var(--shell-gutter) 76px;
  background: var(--green-footer);
  color: #fff;
}

.site-footer :focus-visible {
  outline-color: #fff;
}

.site-footer__inner {
  max-width: 1280px;
  margin: 0 auto;
}

.site-footer__groups {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 24px;
  padding: 16px 0 40px;
}

.footer-group {
  display: flex;
  flex: 1 0 0;
  flex-direction: column;
  gap: 8px;
  min-width: 180px;
}

.footer-group__label {
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
}

.footer-group__links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  font-size: 14px;
  line-height: 20px;
}

.footer-group__links a {
  text-decoration: none;
}

.footer-group__links a:hover,
.footer-group__links--external a {
  text-decoration: underline;
  text-underline-position: from-font;
}

.footer-social {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.footer-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-sm);
}

.footer-social a:hover {
  background: rgba(255, 255, 255, 0.12);
}

.site-footer__logos {
  position: absolute;
  left: 66px;
  top: 382.3px;
  display: flex;
  align-items: flex-start;
  gap: 9.7px;
  direction: ltr;
}

.site-footer__logos img {
  display: block;
  min-width: 0;
  object-fit: contain;
}

.site-footer__logo-nabat {
  width: 149px;
  height: 37px;
  margin-top: 3.6px;
}

.site-footer__logo-ksaa {
  width: 148.2px;
  height: 40.7px;
}

.site-footer__copyright {
  position: absolute;
  inset-inline: var(--shell-gutter);
  bottom: 20px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  font-size: 14px;
  line-height: 20px;
  text-align: center;
}

/* ---------- Narrow screens ----------
   The design only covers 1440px; below it the shell collapses conservatively. */
html.is-narrow {
  --page-gutter: 32px;
}

:where(html.is-narrow) .site-header__inner {
  flex-wrap: wrap;
}

/* Wrapping happens before shrinking, so here the logo starts from nothing and grows to
   its size: the bell and the burger keep the first row on the narrowest screens. */
:where(html.is-narrow) .site-header__logo {
  flex: 1 1 0;
}

:where(html.is-narrow) .burger {
  display: flex;
}

:where(html.is-narrow) .site-nav {
  display: none;
  flex: 1 0 100%;
  padding-bottom: 12px;
}

:where(html.is-narrow) .site-nav.is-open {
  display: flex;
}

:where(html.is-narrow) .site-nav__list {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
}

:where(html.is-narrow) .site-nav__link {
  justify-content: flex-start;
  height: 48px;
}

:where(html.is-narrow) .site-nav__link[aria-current='page']::after {
  inset-inline: auto 0;
  top: 8px;
  bottom: 8px;
  width: 4px;
  height: auto;
}

:where(html.is-narrow) .nav-staff {
  margin-inline-start: 0;
}

:where(html.is-narrow) .nav-staff__menu {
  position: static;
  box-shadow: none;
}

:where(html.is-narrow) .util-bar__info .util-bar__item:nth-child(n + 3) {
  display: none;
}

html.is-compact {
  --page-gutter: 16px;
  --shell-gutter: 16px;
}

:where(html.is-compact) .util-bar__info {
  overflow: hidden;
}

:where(html.is-compact) .util-bar__info .util-bar__item:nth-child(n + 2) {
  display: none;
}

:where(html.is-compact) .page-header {
  --page-header-veil: rgba(16, 70, 49, 0.78);
  height: auto;
  min-height: 160px;
  padding-block: 24px;
}

:where(html.is-compact) .util-bar__item {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

:where(html.is-compact) .page-header__title {
  font-size: 30px;
  line-height: 40px;
}

:where(html.is-compact) .page-main {
  padding-block: 32px;
}

:where(html.is-compact) .page-feedback__bar,
:where(html.is-compact) .page-feedback__ask {
  flex-wrap: wrap;
}

:where(html.is-compact) .site-footer__logos {
  position: static;
  margin-top: 16px;
  justify-content: flex-end;
}

:where(html.is-compact) .site-footer {
  padding-bottom: 24px;
}

:where(html.is-compact) .site-footer__copyright {
  position: static;
  margin-top: 24px;
}

/* ---------- Accessibility tools (utility bar) ---------- */
html[data-contrast='high'] {
  --text-paragraph: #161616;
  --text-secondary: #161616;
  --border: #161616;
  --accent-border: #161616;
  --accent-scientific: var(--green-900);
  filter: grayscale(1) contrast(1.25);
}

/* `--border` is near black in this mode, which would hide the pressed tool's icon. */
html[data-contrast='high'] .util-bar__btn[aria-pressed='true'] {
  background: var(--bg-white);
  box-shadow: inset 0 0 0 2px #161616;
}

html[data-contrast='high'] a:not(.btn) {
  text-decoration: underline;
}
