/* =========================================================
   Quarry — sign-up form
   Odin Project, Intermediate HTML and CSS (Forms)

   The brief's split layout: an image sidebar with the
   wordmark on a dark scrim, and the form beside it.

   The brief says not to worry about mobile. This does.
   ========================================================= */

:root {
  --stone: #2f3230;
  --stone-lo: #1d201e;
  --ink: #1f2421;
  --body-text: #4a524d;
  --muted: #78827c;

  --page: #f6f5f2;
  --panel: #ffffff;

  /* the brief's own values */
  --border: #e5e7eb;
  --brand: #596d48;
  --brand-lo: #45563a;
  --focus: #2f6fd0;
  --invalid: #b0413e;
  --valid: #4b7a45;

  --display: "Anton", "Arial Narrow", sans-serif;
  --ui: "Karla", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--body-text);
  font-family: var(--ui);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
}

@media (min-width: 60rem) {
  .layout {
    grid-template-columns: minmax(0, 27rem) minmax(0, 1fr);
  }
}

/* ---------------------------------------------------------
   image sidebar
   --------------------------------------------------------- */

.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: clamp(2.5rem, 8vw, 4rem) 1.5rem clamp(1rem, 4vw, 2rem);
  min-height: clamp(15rem, 34vh, 22rem);
  background-color: var(--stone);
  background-image: url("https://upload.wikimedia.org/wikipedia/commons/thumb/b/b2/Granite_cliff_with_feldspar_crystals_in_Loddebo_2.jpg/1280px-Granite_cliff_with_feldspar_crystals_in_Loddebo_2.jpg");
  background-size: cover;
  background-position: center 38%;
}

@media (min-width: 60rem) {
  .sidebar {
    min-height: 100vh;
  }
}

/* the scrim behind the wordmark, so the type stays readable
   against a busy photograph */
.wordmark {
  width: 100%;
  padding: 1.1rem 1rem 1.25rem;
  text-align: center;
  background: rgba(20, 23, 21, 0.62);
  backdrop-filter: blur(1px);
}

.logo {
  font-family: var(--display);
  font-size: clamp(2.8rem, 9vw, 4.2rem);
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1;
  color: #f4f3ef;
  margin: 0;
  text-transform: uppercase;
}

.strapline {
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #d8d6cd;
  margin: 0.35rem 0 0;
}

.credit {
  position: absolute;
  bottom: 0.6rem;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.66rem;
  color: rgba(255, 255, 255, 0.72);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  margin: 0;
  padding-inline: 1rem;
}

.credit a {
  color: inherit;
}

/* ---------------------------------------------------------
   form side
   --------------------------------------------------------- */

.content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(1.5rem, 4vw, 2.25rem);
  padding: clamp(1.75rem, 5vw, 3.5rem) clamp(1.25rem, 5vw, 3.5rem);
  max-width: 46rem;
}

.pitch h1 {
  font-family: var(--display);
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: 0.01em;
  color: var(--ink);
  margin: 0 0 0.6rem;
  text-transform: uppercase;
}

.pitch p {
  max-width: 46ch;
  margin: 0;
}

.pitch-note {
  margin-top: 0.5rem !important;
  font-size: 0.88rem;
  color: var(--muted);
}

.signup {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: clamp(1.25rem, 4vw, 1.9rem);
  box-shadow: 0 1px 2px rgba(31, 36, 33, 0.06), 0 8px 24px rgba(31, 36, 33, 0.05);
}

.signup h2 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
  margin: 0 0 1.25rem;
}

.fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem 1.5rem;
}

@media (min-width: 34rem) {
  .fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink);
}

.optional {
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--muted);
}

input {
  font-family: var(--ui);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem 0.65rem;
  width: 100%;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

/* the brief's two variations: a blue focus ring, and a red border on an
   input the user has actually finished with — :user-invalid rather than
   :invalid, so an empty field is not scolded before it is touched */
input:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 1px 6px rgba(47, 111, 208, 0.35);
}

input:user-invalid,
input.is-invalid {
  border-color: var(--invalid);
}

input:user-invalid:focus,
input.is-invalid:focus {
  box-shadow: 0 1px 6px rgba(176, 65, 62, 0.3);
}

input.is-valid {
  border-color: var(--valid);
}

@media (prefers-reduced-motion: reduce) {
  input {
    transition: none;
  }
}

/* ---------------------------------------------------------
   password extras
   --------------------------------------------------------- */

.secret {
  position: relative;
  display: flex;
}

.secret input {
  padding-right: 3.6rem;
}

.reveal {
  position: absolute;
  top: 50%;
  right: 0.35rem;
  translate: 0 -50%;
  appearance: none;
  cursor: pointer;
  font-family: var(--ui);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 3px;
  padding: 0.25rem 0.4rem;
}

.reveal:hover {
  color: var(--ink);
}

/* an explicit display beats the hidden attribute, so it needs saying again */
.strength[hidden] {
  display: none;
}

.strength {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.15rem;
}

.meter {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
}

.meter-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: var(--invalid);
  transition: width 160ms ease, background-color 160ms ease;
}

@media (prefers-reduced-motion: reduce) {
  .meter-fill {
    transition: none;
  }
}

.strength-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
  min-width: 5.5em;
  text-align: right;
}

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

.error {
  font-size: 0.76rem;
  line-height: 1.35;
  color: var(--invalid);
  margin: 0;
  min-height: 1.1em;
}

.error.is-ok {
  color: var(--valid);
}

.submit {
  appearance: none;
  cursor: pointer;
  font-family: var(--ui);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #f7f8f5;
  background: var(--brand);
  border: 0;
  border-radius: 5px;
  padding: 0.7rem 2.2rem;
  margin-top: 1.5rem;
  box-shadow: 0 2px 5px rgba(89, 109, 72, 0.35);
}

.submit:hover {
  background: var(--brand-lo);
}

.signin {
  font-size: 0.9rem;
  margin: 1rem 0 0;
}

.signin a,
.done a {
  color: var(--brand);
  font-weight: 700;
  text-underline-offset: 2px;
}

.done {
  margin: 1rem 0 0;
  padding: 0.6rem 0.85rem;
  border-radius: 4px;
  border: 1px solid var(--valid);
  background: #eef4ec;
  color: var(--valid);
  font-weight: 700;
  font-size: 0.9rem;
}

.colophon {
  font-size: 0.78rem;
  color: var(--muted);
}

.colophon a {
  color: var(--brand);
  text-underline-offset: 2px;
}
