/* ==========================================================================
   Innovation Hub — pages.css
   Styles that belong to one page type only: sign-in, template gallery,
   component documentation. Everything reusable lives in components.css.
   ========================================================================== */

/* ---------- Sign-in ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-block-size: 100vh; }
.auth-brand {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
  padding: var(--ih-space-10) var(--ih-space-12); color: #fff;
  background: radial-gradient(120% 90% at 0% 100%, rgba(244, 200, 39, 0.16), transparent 55%), var(--ih-sidebar-brand-bg, var(--ih-deep));
}
.auth-brand::after { /* the logo's frame, drawn large and faint */
  content: ""; position: absolute; inset-inline-end: -12%; inset-block-end: -10%; inline-size: 62%; aspect-ratio: 204 / 351;
  border: 22px solid transparent; border-image: var(--ih-gradient) 1; opacity: 0.14; pointer-events: none;
}
.auth-brand .brand-logo img { block-size: 44px; }
.auth-brand .brand-copy { position: relative; z-index: 1; max-inline-size: 460px; }
.auth-brand h1 { color: #fff; font-size: 40px; line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; }
html[lang="ar"] .auth-brand h1 { font-size: 34px; line-height: 1.5; letter-spacing: 0; }
.auth-brand .brand-copy p { margin-block-start: var(--ih-space-4); color: rgba(255, 255, 255, 0.78); font-size: var(--ih-text-md); line-height: 1.6; }
.auth-points { list-style: none; display: grid; gap: var(--ih-space-3); margin-block-start: var(--ih-space-8); }
.auth-points li { display: flex; align-items: center; gap: var(--ih-space-3); color: rgba(255, 255, 255, 0.88); font-weight: 500; }
.auth-points .icon { color: var(--ih-yellow-400); }
.auth-foot { position: relative; z-index: 1; font-size: var(--ih-text-xs); color: rgba(255, 255, 255, 0.55); }

.auth-panel { display: flex; flex-direction: column; background: var(--ih-surface); }
.auth-top { display: flex; justify-content: flex-end; gap: var(--ih-space-1); padding: var(--ih-space-5) var(--ih-space-6); }
.auth-form-wrap { flex: 1; display: grid; place-items: center; padding: var(--ih-space-6); }
.auth-form { inline-size: 100%; max-inline-size: 400px; }
.auth-org { display: flex; align-items: center; gap: var(--ih-space-3); margin-block-end: var(--ih-space-8); }
.auth-org img { block-size: 40px; }
.auth-form h2 { font-size: var(--ih-text-2xl); font-weight: 800; letter-spacing: -0.01em; }
.auth-form .lead { color: var(--ih-text-muted); margin-block: 6px var(--ih-space-6); }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: var(--ih-space-3); margin-block: var(--ih-space-4) var(--ih-space-5); }
.auth-alt { margin-block: var(--ih-space-5); }
.auth-legal { margin-block-start: var(--ih-space-8); font-size: var(--ih-text-xs); color: var(--ih-text-subtle); text-align: center; }
.auth-mobile-logo { display: none; }

@media (max-width: 1023px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-brand { display: none; }
  .auth-mobile-logo { display: block; margin-block-end: var(--ih-space-6); }
  .auth-mobile-logo img { block-size: 36px; }
}

/* ---------- Template gallery (index.html) ---------- */
.gallery-top { position: sticky; inset-block-start: 0; z-index: 10; display: flex; align-items: center; gap: var(--ih-space-4); block-size: var(--ih-topbar); padding-inline: var(--ih-space-8); background: color-mix(in srgb, var(--ih-surface) 92%, transparent); backdrop-filter: blur(10px); border-block-end: 1px solid var(--ih-border); }
.gallery-top::before { content: ""; position: absolute; inset-inline: 0; inset-block-start: 0; block-size: 3px; background: var(--ih-gradient); }
.gallery-top img { block-size: 32px; }
.gallery-top .topbar-actions { margin-inline-start: auto; }
.gallery { max-inline-size: 1180px; margin-inline: auto; padding: var(--ih-space-12) var(--ih-space-8) var(--ih-space-20); }
.gallery-hero { max-inline-size: 720px; margin-block-end: var(--ih-space-10); }
.gallery-hero .eyebrow, .eyebrow { font-size: var(--ih-text-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ih-primary); margin-block-end: var(--ih-space-2); }
html[data-theme="dark"] .eyebrow { color: var(--ih-link); }
html[lang="ar"] .eyebrow { letter-spacing: 0; text-transform: none; font-size: 13px; }
.gallery-hero h1 { font-size: 40px; line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; }
html[lang="ar"] .gallery-hero h1 { line-height: 1.5; letter-spacing: 0; }
.gallery-hero p { margin-block-start: var(--ih-space-3); font-size: var(--ih-text-md); line-height: 1.6; color: var(--ih-text-muted); }
.stage { margin-block-start: var(--ih-space-10); }
.stage-head { display: flex; align-items: baseline; gap: var(--ih-space-3); flex-wrap: wrap; margin-block-end: var(--ih-space-4); }
.stage-head h2 { font-size: var(--ih-text-xl); }
.page-card { display: flex; flex-direction: column; gap: var(--ih-space-2); padding: var(--ih-space-5); color: var(--ih-text); }
.page-card:hover { text-decoration: none; }
.page-card .page-card-icon { inline-size: 40px; block-size: 40px; border-radius: var(--ih-radius-md); display: grid; place-items: center; background: var(--ih-primary-soft); color: var(--ih-primary); margin-block-end: var(--ih-space-2); }
html[data-theme="dark"] .page-card .page-card-icon { color: var(--ih-link); }
.page-card h3 { font-size: var(--ih-text-md); }
.page-card p { color: var(--ih-text-muted); font-size: var(--ih-text-sm); }
.page-card.is-later { opacity: 0.6; pointer-events: none; box-shadow: none; background: transparent; border-style: dashed; }
.page-card.is-later .page-card-icon { background: var(--ih-surface-sunken); color: var(--ih-text-subtle); }

/* ---------- Component documentation (components.html) ---------- */
.doc-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--ih-space-8); align-items: start; }
.doc-toc { position: sticky; inset-block-start: calc(var(--ih-topbar) + 24px); display: grid; gap: 2px; font-size: var(--ih-text-sm); }
.doc-toc a { padding: 6px 12px; border-radius: var(--ih-radius-sm); color: var(--ih-text-muted); font-weight: 600; border-inline-start: 2px solid transparent; }
.doc-toc a:hover { background: var(--ih-surface-sunken); color: var(--ih-text); text-decoration: none; }
.doc-toc a.is-active { color: var(--ih-primary); border-inline-start-color: var(--ih-primary); border-start-start-radius: 0; border-end-start-radius: 0; }
html[data-theme="dark"] .doc-toc a.is-active { color: var(--ih-link); border-inline-start-color: var(--ih-link); }
.doc-section { scroll-margin-block-start: calc(var(--ih-topbar) + 24px); }
.doc-section > h2 { font-size: var(--ih-text-xl); margin-block-end: 4px; }
.doc-section > .doc-intro { color: var(--ih-text-muted); margin-block-end: var(--ih-space-4); max-inline-size: 720px; }
.doc-demo { padding: var(--ih-space-6); }
.doc-demo + .doc-demo { border-block-start: 1px solid var(--ih-border); }
.doc-demo-title { font-size: var(--ih-text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ih-text-subtle); margin-block-end: var(--ih-space-4); }
html[lang="ar"] .doc-demo-title { text-transform: none; letter-spacing: 0; font-size: 13px; }
.doc-code { display: block; padding: var(--ih-space-3) var(--ih-space-6); border-block-start: 1px solid var(--ih-border); background: var(--ih-neutral-25); color: var(--ih-text-muted); font-size: 12px; direction: ltr; text-align: start; white-space: pre-wrap; word-break: break-word; border-end-start-radius: var(--ih-radius-lg); border-end-end-radius: var(--ih-radius-lg); }
html[data-theme="dark"] .doc-code { background: var(--ih-surface-sunken); }
.doc-code code { background: none; padding: 0; }

@media (max-width: 1279px) {
  .doc-layout { grid-template-columns: minmax(0, 1fr); }
  .doc-toc { position: static; display: flex; overflow-x: auto; gap: 4px; scrollbar-width: none; padding-block-end: 4px; }
  .doc-toc a { white-space: nowrap; border-inline-start: 0; border-block-end: 2px solid transparent; border-radius: var(--ih-radius-sm) var(--ih-radius-sm) 0 0; }
  .doc-toc a.is-active { border-block-end-color: currentColor; }
}
@media (max-width: 767px) {
  .gallery-top { padding-inline: var(--ih-space-4); gap: var(--ih-space-2); }
  .gallery-top img { block-size: 26px; }
  .gallery-top [data-lang-label], .gallery-top [data-drawer-open] span { display: none; }
  .gallery-top [data-drawer-open] { inline-size: 40px; padding: 0; }
  .gallery { padding: var(--ih-space-8) var(--ih-space-4) var(--ih-space-16); }
  .gallery-hero h1 { font-size: 30px; }
  .doc-demo { padding: var(--ih-space-4); }
  .doc-code { padding-inline: var(--ih-space-4); }
}

/* ---------- Error pages (404, 403, 500) ---------- */
.error-page { min-block-size: 100vh; display: grid; grid-template-rows: auto 1fr auto; background: var(--ih-bg); }
.error-top { display: flex; align-items: center; justify-content: space-between; padding: var(--ih-space-5) var(--ih-space-8); }
.error-top img { block-size: 32px; }
.error-main { display: grid; place-items: center; padding: var(--ih-space-8) var(--ih-space-5); }
.error-box { display: grid; justify-items: center; text-align: center; gap: var(--ih-space-3); max-inline-size: 520px; }
.error-code { position: relative; display: grid; place-items: center; inline-size: 132px; block-size: 132px; margin-block-end: var(--ih-space-4); font-size: 40px; font-weight: 800; letter-spacing: -0.02em; color: var(--ih-primary); }
html[data-theme="dark"] .error-code { color: var(--ih-link); }
.error-code::before { /* the logo's frame, open on one side */
  content: ""; position: absolute; inset: 0; border: 8px solid transparent; border-image: var(--ih-gradient) 1; border-inline-end-width: 0; }
.error-box h1 { font-size: var(--ih-text-3xl); line-height: 1.25; }
.error-box p { color: var(--ih-text-muted); font-size: var(--ih-text-md); line-height: 1.6; }
.error-box .cluster { justify-content: center; margin-block-start: var(--ih-space-4); }
.error-ref { margin-block-start: var(--ih-space-3); font-size: var(--ih-text-xs); color: var(--ih-text-subtle); }
.error-foot { padding: var(--ih-space-5); text-align: center; font-size: var(--ih-text-xs); color: var(--ih-text-subtle); }
@media (max-width: 767px) {
  .error-top { padding: var(--ih-space-4); }
  .error-box h1 { font-size: var(--ih-text-2xl); }
}

/* ---------- Public portal (html[data-area="portal"]) ----------
   The organisation's public innovation site for outside visitors: citizens, startups, SMEs.
   Its own header and footer (no app frame); the organisation's logo and accent colour; content wider and airier. */
.portal-header { position: sticky; inset-block-start: 0; z-index: 30; background: color-mix(in srgb, var(--ih-surface) 92%, transparent); backdrop-filter: blur(10px); border-block-end: 1px solid var(--ih-border); }
.portal-bar { max-inline-size: 1200px; margin-inline: auto; padding-inline: var(--ih-space-6); block-size: 72px; display: flex; align-items: center; gap: var(--ih-space-6); }
.portal-logo img { block-size: 40px; inline-size: auto; }
.portal-nav { display: flex; gap: 4px; flex: 1; }
.portal-nav a { padding: 8px 12px; border-radius: var(--ih-radius-md); color: var(--ih-text-muted); font-weight: 600; font-size: var(--ih-text-sm); }
.portal-nav a:hover, .portal-nav a[aria-current="page"] { background: var(--ih-surface-sunken); color: var(--ih-text); text-decoration: none; }
.portal-actions { display: flex; align-items: center; gap: 4px; margin-inline-start: auto; }
.portal-menu-btn { display: none; }
.portal-nav .show-sm { display: none; }

.portal-hero { position: relative; overflow: hidden; color: #fff; background: radial-gradient(70% 120% at 100% 0%, rgba(244, 200, 39, 0.2), transparent 60%), var(--ih-sidebar-brand-bg, var(--ih-deep)); }
[dir="rtl"] .portal-hero { background: radial-gradient(70% 120% at 0% 0%, rgba(244, 200, 39, 0.2), transparent 60%), var(--ih-sidebar-brand-bg, var(--ih-deep)); }
.portal-hero-inner { position: relative; z-index: 1; max-inline-size: 1200px; margin-inline: auto; padding: 88px var(--ih-space-6) 96px; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: var(--ih-space-12); align-items: center; }
.portal-hero .eyebrow { color: var(--ih-yellow-300) !important; }
.portal-hero h1 { color: #fff; font-size: 48px; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; }
html[lang="ar"] .portal-hero h1 { font-size: 42px; line-height: 1.4; letter-spacing: 0; }
.portal-hero p.lead { margin-block-start: var(--ih-space-4); font-size: var(--ih-text-lg); line-height: 1.6; color: rgba(255, 255, 255, 0.8); max-inline-size: 560px; }
.portal-hero .cluster { margin-block-start: var(--ih-space-8); }
.portal-hero .btn-secondary { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.28); color: #fff; box-shadow: none; }
.portal-hero .btn-secondary:hover { background: rgba(255, 255, 255, 0.18); }
.portal-hero-facts { display: grid; grid-template-columns: 1fr 1fr; gap: var(--ih-space-4); }
.portal-hero-facts div { padding: var(--ih-space-5); border-radius: var(--ih-radius-lg); background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.12); }
.portal-hero-facts b { display: block; font-size: 32px; font-weight: 800; line-height: 1.1; }
.portal-hero-facts span { font-size: var(--ih-text-sm); color: rgba(255, 255, 255, 0.72); }

.portal-section { max-inline-size: 1200px; margin-inline: auto; padding: 80px var(--ih-space-6) 0; scroll-margin-block-start: 80px; }
.portal-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--ih-space-4); flex-wrap: wrap; margin-block-end: var(--ih-space-8); }
.portal-section-head h2 { font-size: 32px; line-height: 1.2; font-weight: 800; letter-spacing: -0.02em; }
html[lang="ar"] .portal-section-head h2 { letter-spacing: 0; line-height: 1.5; }
.portal-section-head p { margin-block-start: 6px; color: var(--ih-text-muted); font-size: var(--ih-text-md); max-inline-size: 640px; }

.offer-card { display: flex; flex-direction: column; gap: var(--ih-space-3); padding: var(--ih-space-6); color: inherit; block-size: 100%; }
.offer-card:hover { text-decoration: none; }
.offer-card h3 { font-size: var(--ih-text-lg); line-height: 1.35; }
.offer-card p { color: var(--ih-text-muted); font-size: var(--ih-text-sm); line-height: 1.6; flex: 1; }
.offer-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: var(--ih-text-xs); color: var(--ih-text-subtle); font-weight: 600; }
.offer-meta span { display: inline-flex; align-items: center; gap: 5px; }
.offer-meta .icon { inline-size: 14px; block-size: 14px; }
.offer-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--ih-space-3); padding-block-start: var(--ih-space-3); border-block-start: 1px solid var(--ih-border); }

.how { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--ih-space-5); list-style: none; counter-reset: how; }
.how li { position: relative; padding: var(--ih-space-6); border-radius: var(--ih-radius-lg); background: var(--ih-surface); border: 1px solid var(--ih-border); }
.how li::before { counter-increment: how; content: counter(how); display: grid; place-items: center; inline-size: 36px; block-size: 36px; border-radius: 50%; margin-block-end: var(--ih-space-4); background: var(--ih-primary); color: var(--ih-text-on-brand); font-weight: 800; }
.how b { display: block; font-size: var(--ih-text-md); margin-block-end: 6px; }
.how p { color: var(--ih-text-muted); font-size: var(--ih-text-sm); line-height: 1.6; }

.story { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: var(--ih-space-5); padding: var(--ih-space-6); }
.story-figure { font-size: 32px; font-weight: 800; line-height: 1.1; color: var(--ih-primary); }
html[data-theme="dark"] .story-figure { color: var(--ih-link); }
.story-figure small { display: block; font-size: var(--ih-text-xs); font-weight: 600; color: var(--ih-text-subtle); margin-block-start: 4px; }

.faq { display: grid; gap: var(--ih-space-2); }
.faq details { border: 1px solid var(--ih-border); border-radius: var(--ih-radius-md); background: var(--ih-surface); }
.faq summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: var(--ih-space-3); padding: var(--ih-space-4) var(--ih-space-5); font-weight: 600; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .icon { transition: transform var(--ih-duration-base) var(--ih-ease); color: var(--ih-text-subtle); }
.faq details[open] summary .icon { transform: rotate(180deg); }
.faq details p { padding: 0 var(--ih-space-5) var(--ih-space-4); color: var(--ih-text-muted); line-height: 1.6; }

.portal-cta { margin-block-start: 80px; }
.portal-cta-inner { max-inline-size: 1200px; margin-inline: auto; padding: 0 var(--ih-space-6); }
.portal-cta .welcome { padding: var(--ih-space-10) var(--ih-space-10); }
.portal-footer { margin-block-start: 80px; border-block-start: 1px solid var(--ih-border); background: var(--ih-surface); }
.portal-footer-inner { max-inline-size: 1200px; margin-inline: auto; padding: var(--ih-space-10) var(--ih-space-6); display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: var(--ih-space-8); font-size: var(--ih-text-sm); }
.portal-footer h2 { font-size: var(--ih-text-sm); margin-block-end: var(--ih-space-3); }
.portal-footer ul { list-style: none; display: grid; gap: 8px; }
.portal-footer a { color: var(--ih-text-muted); }
.portal-footer p { color: var(--ih-text-muted); line-height: 1.6; }
.portal-legal { max-inline-size: 1200px; margin-inline: auto; padding: var(--ih-space-4) var(--ih-space-6) var(--ih-space-8); display: flex; justify-content: space-between; gap: var(--ih-space-4); flex-wrap: wrap; font-size: var(--ih-text-xs); color: var(--ih-text-subtle); }
.portal-legal .powered { display: inline-flex; align-items: center; gap: 6px; }
.portal-legal .powered img { block-size: 16px; }

/* Challenge page (public) */
.challenge-hero .portal-hero-inner { grid-template-columns: minmax(0, 1fr); padding-block: 56px 64px; }
.challenge-hero .breadcrumb, .challenge-hero .breadcrumb a, .challenge-hero .breadcrumb [aria-current] { color: rgba(255, 255, 255, 0.75); }
.challenge-hero .breadcrumb li + li::before { color: rgba(255, 255, 255, 0.4); }
.challenge-hero .offer-meta { color: rgba(255, 255, 255, 0.8); font-size: var(--ih-text-sm); margin-block-start: var(--ih-space-5); }
.reward { display: grid; gap: 4px; padding: var(--ih-space-5); border-radius: var(--ih-radius-lg); background: var(--ih-accent-soft); }
.reward b { font-size: var(--ih-text-xl); color: var(--ih-text); }
.reward span { font-size: var(--ih-text-sm); color: var(--ih-accent-text); font-weight: 600; }
.prose { display: grid; gap: var(--ih-space-4); line-height: 1.7; }
.prose h2 { font-size: var(--ih-text-xl); margin-block-start: var(--ih-space-4); }
.prose ul { padding-inline-start: 20px; display: grid; gap: 6px; color: var(--ih-text-muted); }
.prose p { color: var(--ih-text-muted); }
.success-panel { display: grid; justify-items: center; text-align: center; gap: var(--ih-space-3); padding: var(--ih-space-10) var(--ih-space-6); }
.success-panel .empty-art { background: var(--ih-success-bg); color: var(--ih-success); }

@media (max-width: 1023px) {
  .portal-nav { display: none; }
  .portal-menu-btn { display: inline-flex; }
  .portal-nav.is-open { display: grid; position: absolute; inset-inline: 0; inset-block-start: 72px; padding: var(--ih-space-3); background: var(--ih-surface); border-block-end: 1px solid var(--ih-border); box-shadow: var(--ih-shadow-md); }
  .portal-hero-inner { grid-template-columns: minmax(0, 1fr); padding-block: 56px 64px; gap: var(--ih-space-8); }
  .how { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 767px) {
  .portal-bar { padding-inline: var(--ih-space-4); gap: var(--ih-space-2); }
  .portal-logo img { block-size: 32px; }
  .portal-actions [data-lang-label], .portal-actions .hide-sm { display: none; }
  .portal-nav .show-sm { display: block; }
  .portal-hero h1, html[lang="ar"] .portal-hero h1 { font-size: 32px; }
  .portal-hero p.lead { font-size: var(--ih-text-md); }
  .portal-section { padding: 56px var(--ih-space-4) 0; }
  .portal-section-head h2 { font-size: 24px; }
  .how { grid-template-columns: minmax(0, 1fr); }
  .story { grid-template-columns: minmax(0, 1fr); gap: var(--ih-space-2); }
  .portal-cta .welcome { padding: var(--ih-space-6); }
  .portal-cta-inner { padding: 0 var(--ih-space-4); }
  .portal-footer-inner { grid-template-columns: minmax(0, 1fr); padding: var(--ih-space-8) var(--ih-space-4); }
  .portal-legal { padding-inline: var(--ih-space-4); }
}
