/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

.placeholder {
  min-height: 100vh;
  min-height: 100svh; /* phones: the height with the browser bars showing, so the page doesn't scroll */
  display: grid;
  place-content: center;
  background: #ffd84d;
}
.placeholder h1 { margin: 0; }
.placeholder__mascot { display: block; width: auto; height: clamp(110px, 16vw, 170px); transform: rotate(-6deg); }

/* Accounts and dashboard: plain, readable defaults until the real design lands. */
body {
  margin: 0;
  font-family: var(--font-sans);
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
}

.flash {
  position: relative;
  margin: 0;
  /* Room on both sides for the close button, so the message stays centred. */
  padding: 0.75rem 3rem;
  text-align: center;
}

.flash__close {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  padding: 0.25rem 0.5rem;
  border: 0;
  background: none;
  color: inherit;
  line-height: 1;
}

.flash__close::before { content: "\00d7"; font-size: 1.5rem; }
.flash__close:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

.flash--notice { background: #e8f5e9; color: #1b5e20; }
.flash--alert { background: #fdecea; color: #8a1c1c; }

.auth,
.dashboard {
  max-width: 28rem;
  margin: 3rem auto;
  padding: 0 1rem;
}

.dashboard { max-width: 48rem; }

.auth form {
  display: grid;
  /* Without this the column grows to fit its widest content, and the inputs spill out of the page. */
  grid-template-columns: minmax(0, 1fr);
  gap: 0.5rem;
}

.auth label { font-weight: 600; margin-top: 0.5rem; }

.auth input[type="text"],
.auth input[type="email"],
.auth input[type="password"] {
  padding: 0.6rem;
  font: inherit;
  border: 1px solid #999;
  border-radius: 6px;
}

.auth input[type="submit"] { margin-top: 1rem; }

input[type="submit"],
button {
  padding: 0.6rem 1rem;
  font: inherit;
  cursor: pointer;
}

/* A secondary action, such as Unpublish. */
.button--small { padding: 0.3rem 0.6rem; font-size: 0.875rem; }

.provider-buttons { display: grid; gap: 0.5rem; }
.provider-buttons button { width: 100%; }
.divider { text-align: center; color: #555; }

.hint { margin: 0; font-size: 0.875rem; color: #555; }

/* Rails wraps a field with an error in this div. Without this, the input stops filling its column
   and falls back to its size attribute, which can be far wider than the page. */
.field_with_errors { display: contents; }

.form-errors {
  padding: 0.5rem 1rem;
  background: #fdecea;
  color: #8a1c1c;
  border-radius: 6px;
}

.dashboard__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.notice {
  padding: 1rem;
  background: #fff8e1;
  border-radius: 6px;
}

.notice h2 { margin-top: 0; font-size: 1.125rem; }

.button {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border: 1px solid #555;
  border-radius: 6px;
  cursor: pointer;
}

.button:focus-within { outline: 2px solid #1a56db; outline-offset: 2px; }

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

.field-error { color: #8a1c1c; font-size: 0.875rem; }

/* Pop-up notes at the bottom of the screen */
.toasts {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  gap: 0.5rem;
  justify-items: center;
  z-index: 10;
}

.toast {
  padding: 0.6rem 1rem;
  background: #1f2937;
  color: #fff;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.2);
}

/* Something the server failed on (failures.js): it stays until closed with its ×. */
.toast--mascot { display: flex; align-items: center; gap: 0.75rem; }
.toast__mascot { flex: none; width: auto; height: 2rem; transform: rotate(-6deg); }
.toast--failure {
  position: relative;
  max-width: min(32rem, calc(100vw - 2rem));
  padding-right: 2.5rem;
}
.toast--failure a { color: inherit; }
.toast__close {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  padding: 0.1rem 0.4rem;
  border: 0;
  background: none;
  color: inherit;
  line-height: 1;
}
.toast__close::before { content: "\00d7"; font-size: 1.25rem; }
.toast__close:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

/* The admin area: wide tables of records. A table wider than the screen scrolls on its own. */
.dashboard.admin { max-width: 72rem; }
.admin-search { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 1rem 0; }
.admin-table-wrap { overflow-x: auto; }
.admin-table { border-collapse: collapse; font-size: 0.875rem; }
.admin-table th,
.admin-table td { padding: 0.3rem 0.6rem; border-bottom: 1px solid #ddd; text-align: left; vertical-align: top; }
.admin-table th { white-space: nowrap; }
.admin-fields { width: 100%; }
.admin-fields th { width: 12rem; }
.admin-json { max-height: 24rem; margin: 0; overflow: auto; font-size: 0.8125rem; white-space: pre-wrap; }
.admin-related { margin-top: 2rem; }
.admin-actions { margin: 1rem 0 2rem; }
.admin-actions__buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.admin-actions form + form { margin-top: 0.5rem; }
.admin-warning { color: #b00020; font-weight: 600; }
.admin-form { display: grid; gap: 0.4rem; max-width: 28rem; }
.admin-form label { font-weight: 600; }
.admin-form .admin-form__check { font-weight: normal; }
.admin-form input[type="submit"] { justify-self: start; margin-top: 0.5rem; }
