@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url(/fonts/inter-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url(/fonts/inter-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 700; font-display: swap; src: url(/fonts/inter-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Roboto'; font-weight: 500; font-display: swap; src: url(/fonts/roboto-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Open Sans'; font-weight: 400; font-display: swap; src: url(/fonts/open-sans-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Open Sans'; font-weight: 400; font-style: italic; font-display: swap; src: url(/fonts/open-sans-latin-400-italic.woff2) format('woff2'); }
@font-face { font-family: 'Open Sans'; font-weight: 600; font-display: swap; src: url(/fonts/open-sans-latin-600-normal.woff2) format('woff2'); }

/* IMETA design tokens, as given in imeta-design-system.html (taken from imetaweb.it). */
:root {
  --imeta-bordeaux: #7F2D2E;
  --imeta-bordeaux-light: #A44A4B;
  --imeta-red: #E23125;
  --imeta-blush: #F9E0E2;
  --imeta-navy: #1F2D3D;

  --text-heading: #333333;
  --text-body: #4A4A4A;
  --text-slate: #69727D;
  --text-on-dark: #FFFFFF;
  --text-on-dark-muted: #DFE2E6;

  --surface: #FFFFFF;
  --surface-alt: #F3F3F3;
  --surface-warm: #FAF7F7;
  --overlay-gray: #787E84;

  --font-display: 'Inter', system-ui, sans-serif;
  --font-ui: 'Roboto', system-ui, sans-serif;
  --font-body: 'Open Sans', system-ui, sans-serif;

  --radius-sm: 3px;
  --radius-lg: 12px;
  --radius-pill: 50px;

  --shadow-brand-sm: 0 10px 26px rgba(127, 45, 46, 0.4);
  --shadow-card: 0 24px 50px rgba(31, 45, 61, 0.16);

  /* What the app's parts use. The grey band, as in imetaweb.it's header, holds the logo, which is white. */
  --band: var(--overlay-gray);
  --page: var(--surface-warm);
  --panel: var(--surface);
  --panel-line: #ECE6E6;
  --field: var(--surface);
  --heading: var(--text-heading);
  --body: var(--text-body);
  --muted: var(--text-slate);
  --accent: var(--imeta-bordeaux);
  --accent-hover: var(--imeta-bordeaux-light);
  --mark: var(--imeta-blush);
  --target: #FDF2F3;
  --chip: var(--surface-alt);
  --focus: var(--imeta-bordeaux-light);
  /* The IMETA site has no dark theme, so the page stays light whatever the computer is set to. */
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--page); }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--body);
  font: 400 16px/1.8 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

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

.wrap { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 24px; }

/* The page splits into the search column and a narrow column for the archive's status. */
.columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16rem;
  gap: 0 48px;
}
.columns > :first-child { min-width: 0; }

.logo { display: block; height: 34px; width: auto; }

/* Buttons, as in the design system: Roboto 500, 3px corners, bordeaux. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--imeta-bordeaux);
  color: #fff;
  font: 500 15px/1 var(--font-ui);
  padding: 16px 22px;
  border-radius: var(--radius-sm);
  border: 0;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}
.btn:hover { background: var(--imeta-bordeaux-light); box-shadow: var(--shadow-brand-sm); }
.btn:disabled { opacity: 0.6; cursor: progress; box-shadow: none; }
.btn--sm { font-size: 12px; padding: 10px 20px; text-transform: uppercase; letter-spacing: 0.04em; }
/* The design system's ghost button is bordeaux; on the grey band it has to be light. */
.btn--on-dark { background: transparent; color: var(--text-on-dark); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4); }
.btn--on-dark:hover { background: rgba(255, 255, 255, 0.08); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7); }
.btn--on-dark:focus-visible { outline-color: var(--text-on-dark); }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  font: 600 14px/1.6 var(--font-display);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--heading);
}
.eyebrow::before { content: ''; flex: none; width: 40px; height: 1px; background: var(--imeta-red); }

/* The grey band: logo, question, and the search field resting on its lower edge. */
.hero { background: var(--band); color: var(--text-on-dark); }
.hero .eyebrow { color: var(--text-on-dark); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.hero-body { padding: 56px 0 0; }

.hero h1 {
  margin: 16px 0 32px;
  font: 700 clamp(30px, 4.2vw, 38px)/1.05 var(--font-display);
  letter-spacing: -0.01em;
  color: var(--text-on-dark);
}

.ask {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: -36px;
  padding: 8px 8px 8px 22px;
  background: var(--field);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s;
}
.ask:focus-within { box-shadow: var(--shadow-card), 0 0 0 2px var(--focus); }

/* No border on the box itself: it grows with its scrollHeight, and a border would make it jump. */
.ask textarea {
  flex: 1;
  min-height: 56px;
  max-height: 12rem;
  resize: none;
  border: 0;
  padding: 14px 0;
  background: transparent;
  color: var(--heading);
  font: 400 18px/1.55 var(--font-body);
  outline: none;
}
.ask textarea::placeholder { color: var(--muted); opacity: 1; }
.ask .btn { flex: none; min-width: 7.5rem; }

main.wrap { padding-top: 68px; padding-bottom: 64px; }

.hint { margin: 0; color: var(--muted); font-size: 14px; }

.state { margin: 32px 0 0; color: var(--body); }

/* Answer and results sit on white panels, with the design system's H3 as their heading. */
.panel {
  margin: 32px 0 0;
  padding: 24px 32px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-lg);
}
.panel h2 {
  margin: 0 0 8px;
  font: 600 18px/1.4 var(--font-display);
  color: var(--accent);
}

.answer #answer-text { max-width: 68ch; color: var(--body); }
.answer p { margin: 0 0 12px; }
.answer p:last-child, .answer ul:last-child { margin-bottom: 0; }
.answer ul { margin: 0 0 12px; padding-left: 20px; }
.answer strong { color: var(--heading); font-weight: 600; }
/* Same bordeaux number as the cited source in the list below. */
.answer .cite {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  margin: 0 2px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--imeta-bordeaux);
  color: #fff;
  font: 500 11px/1 var(--font-ui);
  vertical-align: 0.1em;
  text-decoration: none;
}
.answer .cite:hover { background: var(--imeta-bordeaux-light); }
.answer .notice { color: var(--muted); }

.results { padding-bottom: 8px; }
.results ol { list-style: none; margin: 8px 0 0; padding: 0; }

.doc {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  gap: 0 12px;
  margin: 0 -32px;
  padding: 18px 32px;
  border-top: 1px solid var(--panel-line);
}
.doc { scroll-margin-top: 24px; }
.doc:target { background: var(--target); box-shadow: inset 3px 0 0 var(--imeta-bordeaux); }

/* Sources the answer cites carry a bordeaux number; the rest a grey one.
   A file that holds several sources gets one number per source, stacked. */
.doc .refs { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.doc .ref {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.85rem;
  height: 1.85rem;
  margin-top: 1px;
  padding: 0 7px;
  border-radius: var(--radius-pill);
  background: var(--chip);
  color: var(--muted);
  font: 500 12px/1 var(--font-ui);
  white-space: nowrap;
}
.doc.cited .ref { background: var(--imeta-bordeaux); color: #fff; }

.doc a.name {
  color: var(--heading);
  font: 600 16px/1.45 var(--font-display);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.doc a.name:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

.doc .path {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.doc .snippet {
  margin: 8px 0 0;
  color: var(--body);
  font-size: 15px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

mark { background: var(--mark); color: var(--heading); border-radius: 2px; padding: 0 2px; }

/* The archive's status, beside the results on wide screens and under them on narrow ones. */
.status {
  align-self: start;
  position: sticky;
  top: 24px;
  margin: 0;
  padding: 4px 0 0;
}
.status > div { padding: 12px 0; border-bottom: 1px solid var(--panel-line); }
.status > div:first-child { padding-top: 0; }
.status dt { color: var(--muted); font: 500 12px/1.4 var(--font-ui); }
.status dd { margin: 2px 0 0; color: var(--heading); font: 600 15px/1.4 var(--font-display); overflow-wrap: anywhere; }
.status .title dd { font-size: 18px; }

/* Login: the same grey header with the logo, and the form on a white card below it. */
.login { display: flex; flex-direction: column; }
.login .topbar { border-bottom: 0; }
.login-wrap {
  flex: 1;
  width: 100%;
  max-width: 28rem;
  margin: 0 auto;
  padding: 56px 24px 96px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}
.login-card {
  display: grid;
  gap: 8px;
  padding: 32px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.login-card h1 {
  margin: 0 0 16px;
  font: 700 30px/1.05 var(--font-display);
  letter-spacing: -0.01em;
  color: var(--heading);
}
.login-card label { color: var(--muted); font: 500 13px/1.4 var(--font-ui); }
.login-card input {
  width: 100%;
  padding: 13px 14px;
  background: var(--field);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-sm);
  color: var(--heading);
  font: 400 17px/1.4 var(--font-body);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.login-card input:focus { border-color: var(--focus); box-shadow: 0 0 0 3px var(--target); }
.login-card .btn { width: 100%; margin-top: 8px; }
.error { margin: 0; min-height: 1.6em; color: var(--accent); font-size: 14px; line-height: 1.6; }

@media (max-width: 900px) {
  .columns { grid-template-columns: minmax(0, 1fr); }
  .status { position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--panel-line); }
  .status .title { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .logo { height: 28px; }
  .topbar { padding: 16px 0; }
  .hero-body { padding-top: 36px; }
  .hero h1 { margin-bottom: 24px; }
  .ask { flex-wrap: wrap; padding: 6px; margin-bottom: -56px; }
  /* Two lines tall, so the example question fits without a scrollbar. 16px keeps iPhones from zooming in. */
  .ask textarea { flex-basis: 100%; min-height: 72px; padding: 10px 12px; font-size: 16px; }
  .ask .btn { width: 100%; }
  main.wrap { padding-top: 84px; }
  .panel { padding: 20px 16px; }
  .doc { grid-template-columns: 2.25rem minmax(0, 1fr); margin: 0 -16px; padding: 16px; }
  .login-wrap { padding: 40px 16px 64px; }
  .login-card { padding: 24px 20px; }
}

@media (prefers-reduced-motion: no-preference) {
  .answer, .results { animation: rise 280ms ease-out both; }
  @keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) {
  .btn, .ask, .login-card input { transition: none; }
}
