/*#region Layers */

@layer imports, site, blazor;

/* The site's own styles are in a later layer, so they override the components' defaults, which are themed by the
   --pixata-blazor-* variables set in the Components region below */
@import url('/_content/Pixata.Blazor/pixata.css') layer(imports.pixata);

/*#endregion */

@layer site {
  /*#region Theme */

  :root {
    --title-font: 'Roboto Slab', serif;
    --body-font: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --hebrew-font: 'David Libre', 'David', serif;
    --highlight-colour: #f39d00;
    --highlight-dark-colour: #b87500;
    --text-colour: #3d3d3d;
    --muted-colour: #6c6c6c;
    --background-colour: #ffffff;
    --alt-background-colour: #fdf6ea;
    --border-colour: #eadfcd;
    --header-height: 64px;
  }

  /*#endregion */

  /*#region Basics */

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

  html, body {
    margin: 0;
    font-family: var(--body-font);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-colour);
    background-color: var(--background-colour);
  }

  h1, h2, h3 {
    font-family: var(--title-font);
    color: var(--highlight-dark-colour);
    line-height: 1.3;
    margin: 0 0 .6em 0;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.5rem;
    margin-top: 1.2em;
  }

  h3 {
    font-size: 1.15rem;
  }

  a {
    color: var(--highlight-dark-colour);
  }

  .hebrew {
    font-family: var(--hebrew-font);
    direction: rtl;
    unicode-bidi: isolate;
  }

  .text-center {
    text-align: center;
  }

  .hint {
    color: var(--muted-colour);
    font-size: .9rem;
    margin-top: .25rem;
  }

  .highlight {
    color: var(--highlight-colour);
  }

  /*#endregion */

  /*#region WASM loading indicator */

  #app-loading {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    background-color: var(--alt-background-colour);
  }

  /* The layout has appeared, so the app is running */
  body:has(.page) #app-loading {
    display: none;
  }

  .app-loading-title {
    font-family: var(--title-font);
    font-size: 2rem;
    color: var(--highlight-dark-colour);
  }

  .app-loading-bar {
    width: min(20rem, 80vw);
    height: .5rem;
    border-radius: .25rem;
    background-color: var(--border-colour);
    overflow: hidden;
  }

  .app-loading-bar span {
    display: block;
    height: 100%;
    width: var(--blazor-load-percentage, 0%);
    background-color: var(--highlight-colour);
    transition: width .2s;
  }

  /*#endregion */

  /*#region Layout */

  .page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
  }

  .site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: var(--highlight-colour);
    box-shadow: 0 2px 6px rgb(0 0 0 / .15);
  }

  .site-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    min-height: var(--header-height);
    padding: 0 1rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
  }

  .site-name {
    font-family: var(--title-font);
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    margin-right: auto;
  }

  .site-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .25rem;
  }

  .site-nav a, .nav-button {
    color: white;
    text-decoration: none;
    padding: .4rem .7rem;
    border-radius: .3rem;
    font-weight: 600;
    font-size: .95rem;
  }

  .site-nav a:hover, .site-nav a.active, .nav-button:hover {
    background-color: rgb(255 255 255 / .2);
  }

  .nav-button {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
  }

  .logout-form {
    margin: 0;
  }

  .nav-toggle, .nav-toggle-label {
    display: none;
  }

  @media (max-width: 900px) {
    .nav-toggle-label {
      display: block;
      color: white;
      font-size: 1.5rem;
      cursor: pointer;
      padding: .5rem;
    }

    .site-nav {
      display: none;
      width: 100%;
      flex-direction: column;
      align-items: stretch;
      padding-bottom: .75rem;
    }

    .nav-toggle:checked ~ .site-nav {
      display: flex;
    }
  }

  .site-main {
    flex: 1 0 auto;
  }

  .site-footer {
    background-color: #3d3d3d;
    color: #ddd;
    text-align: center;
    padding: 1.25rem 1rem;
    font-size: .9rem;
  }

  .site-footer .hebrew {
    font-size: 1.2rem;
    margin-bottom: .25rem;
  }

  .site-footer a {
    color: var(--highlight-colour);
  }

  .section {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1rem;
  }

  .section.narrow {
    max-width: 760px;
  }

  .section.wide {
    max-width: 1400px;
  }

  .two-columns {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    gap: 2rem;
    align-items: start;
  }

  @media (max-width: 800px) {
    .two-columns {
      grid-template-columns: minmax(0, 1fr);
    }
  }

  /*#endregion */

  /*#region Home page */

  .hero {
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    /* Darkened, as on the old site, so the white text stands out against the bright sky */
    background: linear-gradient(rgb(0 0 0 / .53), rgb(0 0 0 / .53)), url(/images/hero.jpg) center / cover no-repeat;
  }

  .hero-text {
    max-width: 760px;
    text-align: center;
    padding: 2rem;
  }

  .hero h1 {
    font-size: clamp(1.6rem, 4vw, 2.6rem);
    color: white;
  }

  .hero-dedication {
    font-size: 1.4rem;
    color: #dbdbdb;
  }

  .big-link {
    display: inline-block;
    background-color: var(--highlight-colour);
    color: white;
    font-weight: 700;
    text-decoration: none;
    padding: .7rem 1.5rem;
    border-radius: 2rem;
    margin: .25rem;
  }

  .big-link:hover {
    background-color: var(--highlight-dark-colour);
  }

  .big-link.secondary {
    background-color: var(--text-colour);
  }

  /* A wrapping row rather than a grid, so that tiles which go onto another line are centred under the rest */
  .request-tiles {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
  }

  .request-tile {
    flex: 0 0 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .3rem;
    padding: 1.25rem .5rem;
    border: 1px solid var(--border-colour);
    border-radius: .75rem;
    background-color: var(--alt-background-colour);
    text-decoration: none;
    color: var(--text-colour);
    transition: transform .15s, box-shadow .15s;
  }

  .request-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgb(0 0 0 / .1);
  }

  .request-tile-icon {
    font-size: 2rem;
    color: var(--highlight-colour);
  }

  .request-tile-name {
    font-weight: 700;
  }

  .request-tile-hebrew {
    font-size: 1.3rem;
  }

  .poster img {
    width: 100%;
    border-radius: .5rem;
    box-shadow: 0 4px 12px rgb(0 0 0 / .15);
  }

  .source {
    font-size: 1.3rem;
    text-align: right;
  }

  .lead {
    font-size: 1.15rem;
    font-weight: 600;
  }

  .videos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr));
    gap: 2rem;
  }

  .video video {
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: black;
    border-radius: .5rem;
  }

  .note {
    font-style: italic;
  }

  .faq h3 {
    margin-bottom: .2em;
  }

  .testimonials {
    columns: 2 360px;
    column-gap: 2rem;
  }

  blockquote {
    break-inside: avoid;
    margin: 0 0 1.25rem 0;
    padding: 1rem 1.25rem;
    border-left: 4px solid var(--highlight-colour);
    background-color: var(--alt-background-colour);
    border-radius: 0 .5rem .5rem 0;
  }

  .donate-panel {
    margin-top: 1.5rem;
    padding: 1.25rem;
    border: 1px solid var(--border-colour);
    border-radius: .75rem;
    background-color: var(--alt-background-colour);
    text-align: center;
  }

  .donate-link {
    display: inline-block;
    background-color: #0070ba;
    color: white;
    font-weight: 700;
    text-decoration: none;
    padding: .6rem 1.4rem;
    border-radius: 2rem;
  }

  /*#endregion */

  /*#region Forms and messages */

  .rules {
    background-color: var(--alt-background-colour);
    border-radius: .5rem;
    padding: .75rem 1.25rem;
    margin-bottom: 1rem;
  }

  .form-buttons {
    display: flex;
    gap: .5rem;
    justify-content: flex-end;
    margin: 1rem 0;
  }

  .sticky-buttons {
    position: sticky;
    bottom: 0;
    background-color: var(--background-colour);
    padding: .5rem 0;
  }

  .honeypot {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
  }

  .numbers th {
    text-align: left;
    padding-right: 1.5rem;
    font-weight: 600;
  }

  .numbers a {
    font-weight: 700;
    text-decoration: none;
  }

  .alert {
    padding: .75rem 1.25rem;
    border-radius: .5rem;
    margin: 1rem 0;
    border: 1px solid transparent;
  }

  .alert p:last-child {
    margin-bottom: 0;
  }

  .alert-success {
    background-color: #e8f5e9;
    border-color: #a5d6a7;
  }

  .alert-danger {
    background-color: #fdecea;
    border-color: #f5c2c0;
  }

  .alert-info {
    background-color: var(--alt-background-colour);
    border-color: var(--border-colour);
  }

  .validation-message, .text-danger {
    color: #c62828;
    font-size: .9rem;
  }

  /* The Identity pages' forms */
  .row {
    display: flex;
    flex-wrap: wrap;
  }

  .col-md-6 {
    width: min(100%, 480px);
  }

  .mb-3 {
    margin-bottom: 1rem;
  }

  .form-label {
    display: block;
    font-weight: 600;
    margin-bottom: .25rem;
  }

  .w-100 {
    width: 100%;
  }

  .site-main > h1, .site-main > header, .site-main > .row, .site-main > p, .site-main > h2, .site-main > hr, .site-main > h3 {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .site-main > h1 {
    padding-top: 2rem;
  }

  /*#endregion */

  /*#region Admin */

  .toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
  }

  .stat span {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--highlight-dark-colour);
  }

  .charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
    gap: 1.5rem;
  }

  .chart {
    margin-bottom: 1.5rem;
  }

  .grid-container {
    overflow-x: auto;
  }

  .job-status {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border-colour);
    border-radius: .75rem;
    background-color: var(--alt-background-colour);
  }

  .progress {
    height: .75rem;
    border-radius: .4rem;
    background-color: var(--border-colour);
    overflow: hidden;
  }

  .progress span {
    display: block;
    height: 100%;
    background-color: var(--highlight-colour);
    transition: width .3s;
  }

  .report {
    margin: .5rem 0 0 0;
    padding-left: 1.25rem;
    font-size: .95rem;
  }

  .run {
    border-bottom: 1px solid var(--border-colour);
    padding: .5rem 0;
  }

  .run summary {
    cursor: pointer;
  }

  .announcements {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 1.5rem;
  }

  .announcement {
    padding: 1rem 1.25rem;
    border: 1px solid var(--border-colour);
    border-radius: .75rem;
  }

  .announcement h2 {
    margin-top: 0;
  }

  /* The placeholder picker and test button under each template */
  .template-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    margin-top: .4rem;
  }

  .send-test {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
  }

  .test-contact, .custom-announcement {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border-colour);
    border-radius: .75rem;
    background-color: var(--alt-background-colour);
  }

  .custom-announcement h2 {
    margin-top: 0;
  }

  .content-item {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    align-items: start;
    border-bottom: 1px solid var(--border-colour);
    padding: .75rem 0;
  }

  .content-item-buttons {
    display: flex;
    gap: .25rem;
    flex-shrink: 0;
  }

  .poster-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
  }

  .poster-item {
    text-align: center;
  }

  .poster-item img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    background-color: var(--alt-background-colour);
    border-radius: .5rem;
  }

  /*#endregion */

  /*#region Components

     The Pixata.Blazor components are themed by these variables, set from the site's colours */

  :root {
    --pixata-blazor-font-family: var(--body-font);
    --pixata-blazor-font-size: 1rem;
    --pixata-blazor-text-color: var(--text-colour);
    --pixata-blazor-border-radius: .4rem;
    --pixata-blazor-primary: var(--highlight-colour);
    --pixata-blazor-primary-hover: color-mix(in srgb, var(--highlight-colour) 88%, black);
    --pixata-blazor-primary-active: color-mix(in srgb, var(--highlight-colour) 78%, black);
    --pixata-blazor-primary-color: white;
    --pixata-blazor-primary-subtle: color-mix(in srgb, var(--highlight-colour) 15%, white);
    --pixata-blazor-input-focus-border-color: color-mix(in srgb, var(--highlight-colour) 60%, white);
    --pixata-blazor-input-focus-shadow: 0 0 0 .25rem color-mix(in srgb, var(--highlight-colour) 25%, transparent);
    --pixata-blazor-focus-shadow: 0 0 0 .25rem color-mix(in srgb, var(--highlight-colour) 25%, transparent);
    --pixata-grid-font-size: .95rem;
    --pixata-grid-color: var(--text-colour);
    --pixata-grid-primary: var(--highlight-colour);
    --pixata-grid-primary-hover: color-mix(in srgb, var(--highlight-colour) 88%, black);
  }

  /*#endregion */
}

@layer blazor {
  /*#region Blazor error UI */

  #blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
  }

  #blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
  }

  /*#endregion */
}
