/* MIT App Inventor login server: page frame and login form, styled to match
   appinventor.mit.edu (header, title band, footer). Used by site_base.html. */

:root {
  --ai2-orange: #f88d34;
  --ai2-orange-dark: #e2761d;
  --ai2-orange-light: #ffa65c;
  --ai2-ink: #212529;
  --ai2-ink-strong: #12181f;
  --ai2-nav-text: #495661;
  --ai2-button-text: #33404d;
  --ai2-line: #d5d9de;
  --ai2-line-soft: #f0f1f3;
  --ai2-header-line: #e3e6e9;
  --ai2-link: #0d6efd;
  --ai2-band: #58585a;
  --ai2-magenta: #92267c;
  --ai2-footer-bg: #4a4a4c;
  --ai2-footer-text: #e9e9ea;
  --ai2-footer-muted: #c4c4c6;
  --ai2-pill: 999px;
  --ai2-radius: 8px;
  --ai2-content: 1280px;
  --ai2-column: 720px;
  --ai2-font: 'Poppins', sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--ai2-header-h, 4.5rem) + 1rem);
}

body.ai2-site {
  margin: 0;
  font-family: var(--ai2-font);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--ai2-ink);
  background: #ffffff;
  overflow-x: hidden;
}

.ai2-site h1, .ai2-site h2, .ai2-site h3 {
  margin: 0 0 0.5rem;
  font-weight: 500;
  line-height: 1.2;
}
.ai2-site h1 { font-size: calc(1.375rem + 1.5vw); }
.ai2-site h2 { font-size: calc(1.325rem + 0.9vw); }
@media (min-width: 1200px) {
  .ai2-site h1 { font-size: 2.5rem; }
  .ai2-site h2 { font-size: 2rem; }
}
.ai2-site p { margin: 0 0 1rem; }
.ai2-site a { color: var(--ai2-link); }
.ai2-site img { vertical-align: middle; }
.ai2-site button, .ai2-site input, .ai2-site select { font-family: inherit; }

/* ---- Header -------------------------------------------------------------- */
.ai2-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: #ffffff;
  border-bottom: 1px solid var(--ai2-header-line);
}
.ai2-header ul { list-style: none; margin: 0; padding: 0; }
.ai2-header a { text-decoration: none; }

.ai2-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  width: 100%;
  max-width: var(--ai2-content);
  margin: 0 auto;
  padding: 0.625rem clamp(1rem, 3vw, 2rem);
  gap: clamp(0.5rem, 1.5vw, 1.25rem);
}

.ai2-brand { flex: 0 0 auto; display: block; }
.ai2-brand img { display: block; height: 48px; width: auto; }

.ai2-list {
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  width: 100%;
  gap: clamp(0.25rem, 2vw, 2rem);
}

.ai2-link {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0.5rem 0.25rem;
  color: var(--ai2-nav-text);
  font-size: clamp(0.95rem, 0.85rem + 0.25vw, 1.0625rem);
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}
.ai2-header .ai2-link { color: var(--ai2-nav-text); }
.ai2-header .ai2-link:hover,
.ai2-header .ai2-link:focus { color: var(--ai2-ink-strong); }
/* Orange underline that grows in on hover. */
.ai2-link::after {
  content: "";
  position: absolute;
  left: 0.25rem;
  right: 0.25rem;
  bottom: 0.125rem;
  height: 3px;
  border-radius: 2px;
  background: var(--ai2-orange);
  transform: scaleX(0);
  transition: transform 0.18s ease;
}
.ai2-link:hover::after,
.ai2-link:focus::after,
.ai2-link[aria-current="page"]::after { transform: scaleX(1); }

.ai2-signin,
.ai2-cta {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  font-size: clamp(0.9rem, 0.82rem + 0.2vw, 1rem);
  line-height: 1;
  white-space: nowrap;
  border-radius: var(--ai2-pill);
}
.ai2-header .ai2-signin {
  padding: 0 1.125rem;
  background: #ffffff;
  color: var(--ai2-button-text);
  font-weight: 500;
  border: 2px solid var(--ai2-line);
  transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}
.ai2-header .ai2-signin:hover,
.ai2-header .ai2-signin:focus {
  background: #fff7f0;
  border-color: var(--ai2-orange);
  color: var(--ai2-ink-strong);
}
.ai2-header .ai2-cta,
.ai2-login__submit {
  padding: 0 1.375rem;
  background: var(--ai2-orange);
  color: #ffffff;
  font-weight: 700;
  border: 2px solid var(--ai2-orange);
  box-shadow: 0 1px 2px rgba(31, 41, 51, 0.18);
  transition: background-color 0.18s ease, border-color 0.18s ease,
    box-shadow 0.18s ease, transform 0.18s ease;
}
.ai2-header .ai2-cta:hover,
.ai2-header .ai2-cta:focus,
.ai2-login__submit:hover,
.ai2-login__submit:focus {
  background: var(--ai2-orange-dark);
  border-color: var(--ai2-orange-dark);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(31, 41, 51, 0.2);
}
.ai2-cta:active,
.ai2-login__submit:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(31, 41, 51, 0.18);
}

.ai2-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 0.75rem;
  background: var(--ai2-orange);
  color: #ffffff;
  border: 0;
  border-radius: 0.75rem;
  cursor: pointer;
}
.ai2-toggle svg { display: block; width: 24px; height: 24px; }

.ai2-header a:focus-visible,
.ai2-header button:focus-visible {
  outline: 3px solid #0b57d0;
  outline-offset: 3px;
  border-radius: 0.5rem;
}

.ai2-skip {
  position: absolute;
  left: 1rem;
  top: 0.5rem;
  z-index: 1;
  padding: 0.5rem 1rem;
  background: var(--ai2-ink-strong);
  color: #ffffff;
  font-weight: 500;
  border-radius: 0.5rem;
  transform: translateY(-200%);
  transition: transform 0.15s ease;
}
.ai2-header .ai2-skip { color: #ffffff; }
.ai2-skip:focus { transform: translateY(0); }

.ai2-signin-item { display: none; }
.ai2-wide { display: none !important; }

/* Menu open/close (phones and tablets). */
.ai2-menu:not(.is-open) { display: none; }
.ai2-menu.is-moving {
  display: block;
  height: 0;
  overflow: hidden;
  transition: height 0.35s ease;
}
@media (prefers-reduced-motion: reduce) {
  .ai2-menu.is-moving { transition: none; }
}

/* Desktop: logo | links | Open App Inventor | New? Start Here */
@media (min-width: 1200px) {
  .ai2-header .ai2-menu { display: flex !important; flex: 1 1 auto; height: auto !important; }
  .ai2-toggle,
  .ai2-compact { display: none !important; }
  .ai2-header .ai2-wide { display: inline-flex !important; }
}

/* Below 1200px the links fold into the menu button and stack. */
@media (max-width: 1199.98px) {
  .ai2-menu { flex-basis: 100%; }
  .ai2-toggle { margin-left: auto; }
  .ai2-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem 0 0.75rem;
  }
  .ai2-link { min-height: 48px; border-bottom: 1px solid var(--ai2-line-soft); }
  .ai2-link::after { display: none; }
}

@media (max-width: 639.98px) {
  .ai2-signin { display: none; }
  .ai2-signin-item { display: block; }
}

@media (max-width: 575.98px) {
  .ai2-brand img { height: 40px; }
  .ai2-header .ai2-cta { min-height: 42px; padding: 0 0.875rem; }
}

@media (max-width: 400px) {
  .ai2-nav { padding-left: 0.75rem; padding-right: 0.75rem; gap: 0.5rem; }
  .ai2-brand img { height: 34px; }
  .ai2-header .ai2-cta { padding: 0 0.75rem; font-size: 0.875rem; }
}

@media (max-width: 359.98px) {
  .ai2-nav { gap: 0.375rem; }
  .ai2-brand img { height: 30px; }
  .ai2-header .ai2-cta { padding: 0 0.625rem; font-size: 0.8125rem; }
  .ai2-toggle { width: 44px; min-width: 44px; padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ai2-link::after, .ai2-cta, .ai2-signin, .ai2-skip, .ai2-login__submit { transition: none; }
  .ai2-cta:hover, .ai2-cta:focus, .ai2-login__submit:hover { transform: none; }
}

/* ---- Fundraising banner ------------------------------------------------- */
.ai2-banner[hidden] { display: none; }
.ai2-banner { background: var(--ai2-magenta); color: #ffffff; }
.ai2-banner__inner {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 1rem;
  max-width: var(--ai2-content);
  margin: 0 auto;
  padding: 0.6rem 3rem 0.6rem 1rem;
}
.ai2-site .ai2-banner__text { margin: 0; font-size: 1rem; line-height: 1.4; text-align: center; }
.ai2-banner a.ai2-banner__btn {
  display: inline-block;
  padding: 0.3rem 1.1rem;
  border-radius: var(--ai2-pill);
  background: #ffffff;
  color: var(--ai2-magenta);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.ai2-banner a.ai2-banner__btn:hover,
.ai2-banner a.ai2-banner__btn:focus-visible { background: var(--ai2-orange); color: var(--ai2-ink-strong); }
.ai2-banner__close {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #ffffff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.ai2-banner__close:hover { background: rgba(255, 255, 255, 0.15); }
.ai2-banner a:focus-visible,
.ai2-banner__close:focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; }
@media (max-width: 575.98px) {
  .ai2-banner__inner {
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 2.75rem 0.5rem 1rem;
  }
  .ai2-site .ai2-banner__text { font-size: 0.9rem; text-align: left; }
  .ai2-banner__more { display: none; }
}

/* ---- Title band and main column ----------------------------------------- */
.ai2-band {
  margin-bottom: 3rem;
  padding: 2rem;
  background: var(--ai2-band);
}
.ai2-site .ai2-band__title {
  color: #ffffff;
  font-weight: 700;
  text-align: center;
}
@media (min-width: 1200px) {
  .ai2-site .ai2-band__title { width: 66.66666667%; margin-left: 16.66666667%; }
}

.ai2-main {
  position: relative;
  width: 85%;
  margin: 2rem auto;
  padding: 0 15px;
}
@media (max-width: 575.98px) {
  .ai2-main { width: 100%; }
}

ul.messagelist { max-width: var(--ai2-column); margin: 0 auto 1.5rem; }
ul.messagelist li { border-radius: var(--ai2-radius); }

/* ---- Login form ----------------------------------------------------------- */
.ai2-login {
  max-width: var(--ai2-column);
  margin: 1.5rem auto 2rem;
  text-align: center;
}
.ai2-site .ai2-login__title { margin-bottom: 0.75rem; }
.ai2-site .ai2-login__intro { margin: 0 auto 2rem; font-size: 1.05rem; }

.ai2-login__form {
  max-width: 480px;
  margin: 0 auto;
  text-align: left;
}
.ai2-field { margin-bottom: 1.25rem; }
.ai2-field label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--ai2-button-text);
  font-weight: 500;
}
.ai2-field input,
.ai2-field select {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 0.5rem 1rem;
  border: 2px solid var(--ai2-line);
  border-radius: var(--ai2-radius);
  background-color: #ffffff;
  color: var(--ai2-ink);
  font-size: 1rem;
  line-height: 1.5;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.ai2-field select {
  appearance: none;
  padding-right: 2.75rem;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23495661' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 16px 12px;
}
.ai2-field input:focus,
.ai2-field select:focus {
  outline: none;
  border-color: var(--ai2-orange);
  box-shadow: 0 0 0 0.25rem rgba(248, 141, 52, 0.25);
}
.ai2-field .errorlist,
.errornote .errorlist {
  margin: 0.4rem 0 0;
  padding: 0;
  list-style: none;
  color: #ba2121;
  font-size: 0.9rem;
}
.ai2-field:has(.errorlist) input { border-color: #ba2121; }

.ai2-login__submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  margin-top: 0.5rem;
  border-radius: var(--ai2-pill);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.ai2-login__links {
  margin: 2rem auto 0;
  padding: 1.25rem 0 0;
  max-width: 480px;
  border-top: 1px solid var(--ai2-header-line);
  list-style: none;
}
.ai2-login__links li + li { margin-top: 0.5rem; }

/* ---- Other pages: text column, forms and buttons ------------------------ */
.ai2-content {
  max-width: var(--ai2-column);
  margin: 1.5rem auto 2rem;
}
.ai2-content--center { text-align: center; }
.ai2-site .ai2-content h2 { margin-bottom: 1rem; }
.ai2-site .ai2-content__big { margin-top: 2rem; font-size: 1.25rem; font-weight: 600; }
.ai2-content hr { margin: 1.5rem 0; border: 0; border-top: 1px solid var(--ai2-header-line); }
.ai2-status { min-height: 1.5em; font-weight: 500; color: var(--ai2-nav-text); }

.ai2-form { max-width: 480px; margin: 1.5rem auto 0; text-align: left; }
.ai2-form--center { text-align: center; }
/* Under left-aligned text, the form lines up with the text's left edge. */
.ai2-content:not(.ai2-content--center) .ai2-form { margin-left: 0; }
/* Django's form.as_table: one label and field per row, stacked. */
.ai2-form table,
.ai2-form tbody,
.ai2-form tr,
.ai2-form th,
.ai2-form td { display: block; width: 100%; padding: 0; border: 0; text-align: left; }
.ai2-form tr { margin-bottom: 1.25rem; }
.ai2-form th label,
.ai2-field label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--ai2-button-text);
  font-weight: 500;
}
/* A tick box row reads "[x] Send me a code instead of a link". */
.ai2-form tr:has(input[type="checkbox"]) {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
}
.ai2-form tr:has(input[type="checkbox"]) th,
.ai2-form tr:has(input[type="checkbox"]) td { width: auto; }
.ai2-form tr:has(input[type="checkbox"]) label { margin: 0; }
.ai2-form .helptext { display: block; margin-top: 0.25rem; color: var(--ai2-nav-text); font-size: 0.875rem; }

.ai2-form input[type="text"],
.ai2-form input[type="email"],
.ai2-form input[type="password"],
.ai2-form input:not([type]),
.ai2-form select,
.ai2-field input,
.ai2-field select {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 0.5rem 1rem;
  border: 2px solid var(--ai2-line);
  border-radius: var(--ai2-radius);
  background-color: #ffffff;
  color: var(--ai2-ink);
  font-size: 1rem;
  line-height: 1.5;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.ai2-form input:focus,
.ai2-form select:focus {
  outline: none;
  border-color: var(--ai2-orange);
  box-shadow: 0 0 0 0.25rem rgba(248, 141, 52, 0.25);
}
.ai2-form input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  accent-color: var(--ai2-orange);
}
.ai2-form .errorlist {
  margin: 0 0 0.4rem;
  padding: 0;
  list-style: none;
  color: #ba2121;
  font-size: 0.9rem;
}

.ai2-form input[type="submit"],
.ai2-site .ai2-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 1.375rem;
  background: var(--ai2-orange);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  border: 2px solid var(--ai2-orange);
  border-radius: var(--ai2-pill);
  box-shadow: 0 1px 2px rgba(31, 41, 51, 0.18);
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease,
    box-shadow 0.18s ease, transform 0.18s ease;
}
.ai2-form input[type="submit"]:hover,
.ai2-form input[type="submit"]:focus,
.ai2-site .ai2-button:hover,
.ai2-site .ai2-button:focus {
  background: var(--ai2-orange-dark);
  border-color: var(--ai2-orange-dark);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(31, 41, 51, 0.2);
}
.ai2-form input.ai2-button--large { min-height: 54px; padding: 0 2rem; font-size: 1.15rem; }

.ai2-panel {
  margin: 2.5rem auto 0;
  padding: 1.5rem;
  max-width: 560px;
  border: 2px solid var(--ai2-line);
  border-radius: 15px;
}
.ai2-panel .ai2-form { margin-top: 0; max-width: none; }
.ai2-panel__label { display: block; margin-bottom: 0.75rem; color: var(--ai2-button-text); font-weight: 500; }
.ai2-code-inputs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
}
.ai2-form .ai2-code-inputs input {
  width: 5.5em;
  min-width: 0;
  flex: 0 1 5.5em;
  padding: 0.5rem 0.4rem;
  text-align: center;
}

/* ---- Footer ----------------------------------------------------------- */
.ai2-footer {
  margin-top: 2rem;
  padding: 2.75rem clamp(1rem, 4vw, 3rem) 1.5rem;
  background: var(--ai2-footer-bg);
  color: var(--ai2-footer-text);
  font-size: 0.95rem;
  line-height: 1.5;
}
.ai2-footer a { color: #ffffff; text-decoration: none; }
.ai2-footer a:hover,
.ai2-footer a:focus-visible { color: #ffffff; text-decoration: underline; text-underline-offset: 3px; }
.ai2-footer a:focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; border-radius: 2px; }

.ai2-footer__inner {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) 3.4fr;
  gap: 2.5rem;
  max-width: var(--ai2-content);
  margin: 0 auto;
}
.ai2-site .ai2-footer__brand h2 {
  margin: 0 0 0.9rem;
  color: #ffffff;
  font-size: 1.35rem;
  font-weight: 600;
}
.ai2-footer__logos { display: flex; flex-direction: column; align-items: flex-start; gap: 1rem; }
.ai2-footer__raise { filter: brightness(0) invert(1); opacity: 0.9; }
.ai2-footer__social { display: flex; gap: 0.6rem; margin-top: 1.25rem; }
.ai2-footer__social img { width: 28px; height: 28px; object-fit: contain; }
.ai2-footer a.ai2-footer__donate,
.ai2-footer a.ai2-footer__ask {
  display: inline-block;
  background: var(--ai2-orange);
  border-radius: var(--ai2-pill);
  color: var(--ai2-ink-strong);
  font-weight: 700;
  text-decoration: none;
}
.ai2-footer a.ai2-footer__donate { margin-top: 1.25rem; padding: 0.45rem 1.25rem; }
.ai2-footer a.ai2-footer__ask { padding: 0.45rem 0.9rem; }
.ai2-footer a.ai2-footer__donate:hover,
.ai2-footer a.ai2-footer__donate:focus-visible,
.ai2-footer a.ai2-footer__ask:hover,
.ai2-footer a.ai2-footer__ask:focus-visible { background: var(--ai2-orange-light); color: var(--ai2-ink-strong); text-decoration: none; }

.ai2-footer__cols {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.75rem;
}
.ai2-site .ai2-footer__cols h3 {
  margin: 0 0 0.75rem;
  padding-top: 0.6rem;
  border-top: 3px solid var(--ai2-orange);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ai2-footer__cols ul { margin: 0; padding: 0; list-style: none; }
.ai2-footer__cols li + li { margin-top: 0.4rem; }
.ai2-site .ai2-footer__note { margin: 0.2rem 0 0; color: var(--ai2-footer-muted); font-size: 0.8rem; line-height: 1.35; }
.ai2-footer__note a { text-decoration: underline; text-underline-offset: 2px; }
.ai2-footer__cols li > a + .ai2-footer__note { margin-top: 0; }
.ai2-site .ai2-footer__ask + .ai2-footer__note { margin: 0.45rem 0 0.9rem; }

.ai2-footer__legal {
  max-width: var(--ai2-content);
  margin: 2.25rem auto 0;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--ai2-footer-muted);
  font-size: 0.8rem;
  text-align: center;
}
.ai2-footer__legal img { vertical-align: middle; margin: 0 0.3rem; }
.ai2-footer__legal a { text-decoration: underline; }
.ai2-site .ai2-footer__legal p { margin: 0; }
.ai2-site .ai2-footer .ai2-footer__license {
  margin: 0 auto 0.4rem;
  color: var(--ai2-footer-text);
  font-size: 0.95rem;
  line-height: 1.6;
  text-wrap: balance;
}
.ai2-footer .ai2-footer__license a { color: #ffb27a; font-weight: 600; text-decoration: underline; }
.ai2-footer .ai2-footer__license a:hover,
.ai2-footer .ai2-footer__license a:focus-visible { color: #ffd2b0; }

@media (max-width: 1000px) {
  .ai2-footer__inner { grid-template-columns: 1fr; gap: 2rem; }
  .ai2-footer__logos { flex-direction: row; flex-wrap: wrap; align-items: center; }
}
@media (max-width: 640px) {
  .ai2-footer__cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai2-footer__cols > div:first-child { grid-column: 1 / -1; }
}
