/*
 * 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;
  display: grid;
  place-content: center;
  text-align: center;
  font-family: system-ui, sans-serif;
}

/* Accounts and dashboard: plain, readable defaults until the real design lands. */
body {
  margin: 0;
  font-family: system-ui, sans-serif;
  line-height: 1.5;
}

.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,
.domain-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,
.domain-form label { font-weight: 600; margin-top: 0.5rem; }

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

.auth input[type="submit"],
.domain-form 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; }

.dashboard__nav { margin: 1rem 0; }

/* Asset library */
.library {
  max-width: 72rem;
  margin: 3rem auto;
  padding: 0 1rem;
}

.dropzone {
  padding: 1rem 1.5rem;
  border: 2px dashed #999;
  border-radius: 8px;
}

.dropzone h2 { margin-top: 0; font-size: 1.125rem; }
.dropzone--active { border-color: #1a56db; background: #eef3ff; }
.upload-note p { margin: 0.25rem 0; }

.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;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

.tiles:has(> li) + .tiles__empty { display: none; }

.upload-progress { margin-top: 1.5rem; }
.upload-progress p { margin: 0 0 0.25rem; }
.upload-progress progress,
.tile__progress { width: 100%; }

/* Which note shows depends on the tiles: uploading ones take priority over resizing ones. */
.library__note { display: none; margin: 1rem 0 0; }
.library:has(.tile--uploading) .library__note--uploading { display: block; }
.library:has(.tile--processing):not(:has(.tile--uploading)) .library__note--resizing { display: block; }

.tile {
  display: grid;
  align-content: start;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 8px;
}

.tile p { margin: 0; }
.tile__name { font-weight: 600; overflow-wrap: anywhere; }
.tile__nudge { margin: 0; font-size: 0.875rem; color: #8a5a00; }
.tile--failed .tile__status { color: #8a1c1c; }

.tile__image {
  width: 100%;
  height: 12rem;
  object-fit: contain;
  background: #f4f4f4;
  border-radius: 4px;
}

.tile__form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.25rem;
}

.tile__form label { font-weight: 600; margin-top: 0.25rem; }

.tile__form input[type="text"],
.tile__form textarea {
  padding: 0.4rem;
  font: inherit;
  border: 1px solid #999;
  border-radius: 6px;
}

.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);
}
.tile__sizes ul { margin: 0.25rem 0 0; padding-left: 1.25rem; font-size: 0.875rem; }

/* The DNS records to add for a custom domain. Long values wrap rather than widen the page. */
.dns-records { width: 100%; border-collapse: collapse; margin: 0.5rem 0 1rem; }
.dns-records th,
.dns-records td { padding: 0.4rem 0.5rem; border: 1px solid #ccc; text-align: left; overflow-wrap: anywhere; }
/* The record type (CNAME, TXT) stays whole. */
.dns-records td:first-child { overflow-wrap: normal; }

/* A value to type into a DNS provider's form, and its Copy button. */
.copyable { white-space: nowrap; }
.copyable code { white-space: normal; overflow-wrap: anywhere; }
.copy-button { margin-left: 0.35rem; padding: 0.1rem 0.45rem; font-size: 0.8125rem; }

.dns-guide { margin-top: 1.5rem; }
.dns-guide h3 { margin-bottom: 0.5rem; font-size: 1rem; }
.dns-guide h4 { margin: 1rem 0 0.25rem; font-size: 0.9375rem; }
.dns-guide li { margin-bottom: 0.5rem; }
.dns-guide__picker { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.35rem; max-width: 24rem; margin-bottom: 0.75rem; }
.dns-guide__picker label { font-weight: 600; }
.dns-guide__picker select { padding: 0.5rem; font: inherit; }

/* Optional steps for forwarding the bare domain to www. */
.bare-domain { margin: 1rem 0; }
.bare-domain summary { cursor: pointer; font-weight: 600; }
.bare-domain li { margin-bottom: 0.5rem; }
