/*
 * Plain CSS, no framework. Propshaft serves every file in this folder (alphabetically):
 *   application.css – design tokens, base elements, page chrome, buttons and forms
 *   components.css  – reusable pieces (cards, avatars, quick links, news cards…)
 *   pages.css       – page-specific layouts (directory, org chart, calendar…)
 *   quizzes.css     – the Quizzes app (each app inside the intranet gets its own file)
 *
 * The Content Security Policy blocks inline styles, so never use style="" – add a class.
 */

:root {
  /* SerpApi brand colours (serpapi.com/media): blue #377FEA and purple #6937EA */
  --bg: #f2f4f8;
  --surface: #ffffff;
  --surface-muted: #f7f8fb;
  --border: #e2e6ef;
  --border-strong: #cbd2e0;
  --text: #272c3b;
  --muted: #636c82;
  --subtle: #8a92a6;
  --accent: #377fea;
  --accent-strong: #2563d6;
  --accent-soft: #eaf1fe;
  --accent-light: #9ec0f7;
  --purple: #6937ea;
  --navy: #141a3d;
  --navy-2: #252d63;
  --danger: #c0392b;
  --danger-soft: #fcecea;
  /* From the Top Results newsletter: the media kit gradient, and its soft tint and ink */
  --grad: linear-gradient(47deg, var(--purple) 0%, var(--accent) 100%);
  --soft: #eceefd;
  --accent-ink: #3b44c4;

  --radius: 4px;
  --shadow: 0 1px 2px rgb(20 26 61 / 0.05);
  --shadow-hover: 0 6px 18px rgb(20 26 61 / 0.09);
  --shadow-pop: 0 14px 36px rgb(20 26 61 / 0.18);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --container: 1200px;
  --container-wide: 1440px;
  --gutter: clamp(1rem, 3vw, 2rem);
  --topbar-height: 60px;
}

/* ---------------------------------------------------------------- Base */

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

[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-height) + 1rem);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--navy); }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
code, kbd, pre { font-family: var(--font-mono); font-size: 0.9em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.icon {
  display: inline-block;
  flex: none;
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.22em;
  stroke-width: 1.75;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius);
}
.skip-link:focus { top: 0.5rem; }

.muted { color: var(--muted); }
.subtle { color: var(--subtle); }
.small { font-size: 0.85rem; }
.nowrap { white-space: nowrap; }

/* ---------------------------------------------------------------- Layout */

.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.container--wide { max-width: calc(var(--container-wide) + 2 * var(--gutter)); }
.container--narrow { max-width: calc(760px + 2 * var(--gutter)); }

.page { flex: 1; padding: 2rem 0 1.5rem; } /* The footer cat adds the rest of the gap */

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.page-header__title { font-size: 1.65rem; font-weight: 700; letter-spacing: -0.01em; }
.page-header__subtitle { margin: 0.3rem 0 0; color: var(--muted); }
.page-header__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.eyebrow {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--subtle);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 1rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.layout-sidebar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 1.75rem;
  align-items: start;
}
.stack { display: grid; gap: 1.75rem; align-content: start; }
.stack > .section { margin-top: 0; }

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

/* ---------------------------------------------------------------- Top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  display: flex;
  align-items: stretch;
  gap: 1.5rem;
  height: var(--topbar-height);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: none;
  color: var(--navy);
  font-size: 1rem;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.logo { display: block; width: auto; height: 24px; flex: none; }
.logo-mark { display: block; width: 26px; height: 26px; flex: none; }
.brand__logo { display: none; }
.brand__name {
  padding-left: 0.75rem;
  border-left: 1px solid var(--border-strong);
  color: var(--muted);
  font-weight: 600;
  line-height: 1.4;
}

.nav {
  display: flex;
  align-items: stretch;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav__link {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0 0.7rem;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 550;
  white-space: nowrap;
}
.nav__link .icon { color: var(--subtle); }
.nav__link:hover { color: var(--navy); text-decoration: none; }
.nav__link:hover .icon { color: var(--accent); }
.nav__link--active { color: var(--navy); border-bottom-color: var(--accent); }
.nav__link--active .icon { color: var(--accent); }

/* A nav link with a menu of related pages, opened by hovering or with its chevron
   (nav_menu_controller.js). */
.nav__item { position: relative; display: flex; align-items: stretch; }
.nav__item > .nav__link { padding-right: 0.3rem; }
.nav__toggle {
  display: flex;
  align-items: center;
  padding: 0 0.6rem 0 0.1rem;
  background: none;
  border: 0;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  color: var(--subtle);
  cursor: pointer;
}
.nav__toggle .icon { width: 0.95em; height: 0.95em; transition: rotate 0.15s ease; }
.nav__toggle:hover { color: var(--accent); }
.nav__link--active + .nav__toggle { border-bottom-color: var(--accent); }
.nav__toggle[aria-expanded="true"] .icon { rotate: 180deg; }
.nav__menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 40;
  min-width: 200px;
  padding: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow-pop);
  visibility: hidden;
  opacity: 0;
  translate: 0 -4px;
  transition: opacity 0.15s ease 0.1s, translate 0.15s ease 0.1s, visibility 0s linear 0.25s;
}
.nav__toggle[aria-expanded="true"] + .nav__menu { visibility: visible; opacity: 1; translate: none; transition-delay: 0s; }
.nav__menu .dropdown__item[aria-current="page"] { color: var(--navy); font-weight: 600; }
.nav__menu .dropdown__item[aria-current="page"] .icon { color: var(--accent); }

@media (hover: hover) {
  .nav__item:hover:not(.nav__item--dismissed) > .nav__menu { visibility: visible; opacity: 1; translate: none; transition-delay: 0.08s; }
  .nav__item:hover:not(.nav__item--dismissed) .nav__toggle .icon { rotate: 180deg; }
}

/* Room for the menus to hang below the bar (it only scrolls once it's icons only). */
@media (min-width: 901px) {
  .nav { overflow: visible; }
}

.topbar__actions { display: flex; align-items: center; gap: 0.75rem; flex: none; }

.topbar-search { position: relative; display: flex; align-items: center; }
.topbar-search > .icon { position: absolute; left: 0.65rem; color: var(--subtle); pointer-events: none; }
.topbar-search__input {
  width: 210px;
  padding: 0.45rem 0.75rem 0.45rem 2.1rem;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  transition: width 0.15s ease, border-color 0.15s ease;
}
.topbar-search__input:focus { width: 260px; background: #fff; border-color: var(--accent); outline: none; }
.topbar__actions .topbar-search-link { display: none; }

/* Text-only nav links until there's room for the icons too. */
@media (min-width: 901px) and (max-width: 1420px) {
  .nav__link > .icon { display: none; }
}

@media (max-width: 1240px) {
  .topbar-search { display: none; }
  .topbar__actions .topbar-search-link { display: inline-flex; }
}

@media (max-width: 1060px) {
  .brand__name { display: none; }
}

@media (max-width: 900px) {
  .nav__link, .nav__item > .nav__link { padding: 0 0.6rem; }
  .nav__toggle, .nav__menu { display: none; }
  .nav__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .nav__link .icon { width: 1.3em; height: 1.3em; }
}

@media (max-width: 560px) {
  .topbar__inner { flex-wrap: wrap; height: auto; gap: 0 1rem; }
  .brand { height: 52px; }
  .brand__logo { display: block; }
  .brand__mark { display: none; }
  .brand__name { display: inline; }
  .topbar__actions { margin-left: auto; }
  .nav { order: 3; flex-basis: 100%; height: 46px; justify-content: space-between; border-top: 1px solid var(--border); }
}

/* Account dropdown (a <details> element) */
.dropdown { position: relative; }
.dropdown__toggle {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem;
  border-radius: 999px;
  color: var(--subtle);
  cursor: pointer;
  list-style: none;
}
.dropdown__toggle::-webkit-details-marker { display: none; }
.dropdown__toggle:hover { color: var(--navy); }
.dropdown__menu {
  position: absolute;
  top: calc(100% + 0.6rem);
  right: 0;
  z-index: 40;
  width: 250px;
  padding: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
}
.dropdown__header { display: grid; padding: 0.5rem 0.6rem 0.6rem; line-height: 1.35; }
.dropdown__header span { color: var(--muted); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; }
.dropdown__item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.5rem 0.6rem;
  background: none;
  border: 0;
  border-radius: 3px;
  color: var(--text);
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}
.dropdown__item .icon { color: var(--subtle); }
.dropdown__item:hover { background: var(--surface-muted); color: var(--navy); text-decoration: none; }
.dropdown__divider { margin: 0.35rem 0; border-top: 1px solid var(--border); }
.dropdown__form { margin: 0; }
.dropdown__toggle { position: relative; }
.dropdown__dot {
  position: absolute;
  top: 0.1rem;
  left: 1.75rem;
  width: 0.7rem;
  height: 0.7rem;
  background: var(--accent);
  border: 2px solid var(--surface);
  border-radius: 50%;
}
.dropdown__count {
  margin-left: auto;
  padding: 0 0.45rem;
  background: var(--accent-soft);
  border-radius: 999px;
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.5;
}

/* ---------------------------------------------------------------- Flash messages */

.flashes {
  position: fixed;
  top: calc(var(--topbar-height) + 0.75rem);
  right: 1rem;
  z-index: 50;
  display: grid;
  gap: 0.5rem;
  width: min(420px, calc(100vw - 2rem));
}

.flash {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem 0.75rem 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  font-size: 0.9rem;
  animation: flash-in 0.2s ease-out;
}
.flash > .icon { margin-top: 0.1rem; color: var(--accent); }
.flash--alert { border-left-color: var(--danger); }
.flash--alert > .icon { color: var(--danger); }
.flash__message { flex: 1; }
.flash__close { padding: 0.1rem; background: none; border: 0; color: var(--subtle); cursor: pointer; }
.flash__close:hover { color: var(--text); }

@keyframes flash-in {
  from { opacity: 0; transform: translateY(-6px); }
}

/* ---------------------------------------------------------------- Hero (home page) */

/* The masthead from the Top Results newsletter: the brand gradient, with the cat
   peering over its bottom edge (beside the search on wide screens, under it otherwise). */
.hero {
  position: relative;
  overflow: hidden;
  background: var(--grad);
  color: #fff;
}

.hero__inner {
  position: relative;
  max-width: 680px;
  margin: 0 auto;
  padding: 3rem var(--gutter) 3.5rem;
  text-align: center;
}

.hero__date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.9;
}

.hero__title {
  margin: 0.5rem 0 1.5rem;
  color: #fff;
  font-size: clamp(2rem, 4.5vw, 2.75rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.hero__search {
  position: relative;
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgb(40 20 120 / 0.3);
}
.hero__search > .icon { position: absolute; left: 1.1rem; width: 1.3em; height: 1.3em; color: var(--purple); pointer-events: none; }
.hero__search-input {
  flex: 1;
  min-width: 0;
  padding: 1.05rem 1rem 1.05rem 3.25rem;
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: 1.05rem;
}
.hero__search-input:focus { outline: none; }
.hero__search:focus-within { outline: 3px solid rgb(255 255 255 / 0.6); outline-offset: 2px; }
.hero__search-button { margin-right: 0.45rem; }

.hero__cat {
  position: absolute;
  right: max(var(--gutter), (100% - var(--container-wide)) / 2 + var(--gutter));
  bottom: -2px;
  width: clamp(170px, 16vw, 230px);
}

@media (max-width: 1100px) {
  .hero__inner { padding-bottom: 0.5rem; }
  .hero__cat { position: static; width: min(170px, 42vw); margin: 0 var(--gutter) -2px auto; }
}

/* ---------------------------------------------------------------- Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.btn:hover { border-color: var(--subtle); color: var(--navy); text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn .icon { width: 1.05em; height: 1.05em; }

.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }

.btn--ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn--ghost:hover { background: var(--surface-muted); border-color: transparent; }
.btn--ghost[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-strong); }

.btn--danger-ghost { background: transparent; border-color: transparent; color: var(--danger); }
.btn--danger-ghost:hover { background: var(--danger-soft); border-color: transparent; color: var(--danger); }

.btn--sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.btn--icon { padding: 0.4rem; }

.button_to { display: inline; margin: 0; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }

/* ---------------------------------------------------------------- Forms */

.form { display: grid; gap: 1.15rem; }
.form-section { display: grid; gap: 1.15rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.form-section__title { font-size: 0.95rem; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }

.field { display: grid; gap: 0.35rem; align-content: start; }
.field__label, .field > label { color: var(--navy); font-size: 0.85rem; font-weight: 650; }
.field__hint { margin: 0; color: var(--muted); font-size: 0.8rem; }
.field__more { color: var(--muted); font-size: 0.8rem; }
.field__more > summary { width: fit-content; color: var(--accent-strong); cursor: pointer; font-weight: 600; }
.field__more[open] > summary { margin-bottom: 0.5rem; }
.field__more p { margin: 0 0 0.5rem; }
.field__more pre { margin: 0; padding: 0.75rem 1rem; overflow-x: auto; background: var(--surface-muted); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-family: var(--font-mono); font-size: 0.78rem; line-height: 1.5; }
.field__optional { color: var(--subtle); font-weight: 400; }

.input,
.field :where(input:not([type="checkbox"], [type="radio"], [type="file"], [type="submit"], [type="hidden"]), select, textarea) {
  width: 100%;
  padding: 0.55rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.925rem;
  line-height: 1.4;
}
.field textarea { min-height: 7rem; resize: vertical; }
.input:not(textarea),
.field :where(input:not([type="checkbox"], [type="radio"], [type="file"], [type="submit"], [type="hidden"]), select) { height: 2.55rem; }
.field textarea.input--code { min-height: 22rem; font-family: var(--font-mono); font-size: 0.85rem; }
.input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); outline-offset: 0; }
[aria-invalid="true"] { border-color: var(--danger) !important; }

.checkbox { display: flex; align-items: flex-start; gap: 0.55rem; font-size: 0.9rem; cursor: pointer; }
.checkbox input { width: 1rem; height: 1rem; margin: 0.2rem 0 0; accent-color: var(--accent); }
.checkbox small { display: block; color: var(--muted); font-size: 0.8rem; }
.checkbox-group { display: grid; gap: 0.85rem; min-width: 0; margin: 0; padding: 0; border: 0; }
.checkbox-group > legend { margin-bottom: 0.6rem; padding: 0; }

.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; padding-top: 0.5rem; }
.form-actions__end { margin-left: auto; }

.form-errors {
  padding: 0.85rem 1rem;
  background: var(--danger-soft);
  border-left: 4px solid var(--danger);
  border-radius: var(--radius);
  color: #7d2318;
  font-size: 0.9rem;
}
.form-errors__title { margin: 0 0 0.3rem; font-weight: 650; }
.form-errors ul { margin: 0; padding-left: 1.2rem; }

/* ---------------------------------------------------------------- Footer */

/* The sleeping cat from the newsletter's footer, napping on the bar above the sign-in note. */
.footer__perch { display: flex; justify-content: flex-end; }
.footer__cat { position: relative; z-index: 1; width: 77px; margin-bottom: -4px; }
.footer__bar {
  padding: 1.25rem 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  color: var(--subtle);
  font-size: 0.8rem;
}
.footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1.5rem; }
.footer__brand { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--muted); font-weight: 600; }
.footer .logo-mark { width: 16px; height: 16px; }
