:root {
  --background: #e7e7e7;
  --ink: #050505;
  --muted: #4f4f4f;
  --field: #f3f3f3;
  --field-border: rgba(5, 5, 5, 0.2);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font-family: "Space Grotesk", sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

.page-shell {
  min-height: 100vh;
  padding: clamp(24px, 4vw, 48px);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
  grid-template-rows: minmax(0, 1fr) auto auto;
  align-items: stretch;
  gap: clamp(20px, 4vw, 56px);
  overflow: hidden;
}

.copy-column {
  max-width: min(58vw, 820px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: clamp(4px, 1vh, 18px);
  grid-column: 1;
  grid-row: 1;
}

.location-form {
  margin: 0 0 clamp(28px, 4vh, 48px);
}

.location-label {
  display: block;
  margin-bottom: 14px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.location-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.location-input {
  width: min(100%, 420px);
  min-width: 260px;
  padding: 15px 18px;
  border: 1px solid var(--field-border);
  border-radius: 16px;
  background: var(--field);
  color: var(--ink);
}

.location-input::placeholder {
  color: #8d8d8d;
}

.submit-button {
  padding: 15px 22px;
  border: 1px solid var(--ink);
  border-radius: 16px;
  background: var(--ink);
  color: var(--background);
  cursor: pointer;
  transition:
    transform 140ms ease,
    opacity 140ms ease;
}

.submit-button:hover,
.submit-button:focus-visible {
  transform: translateY(-1px);
  opacity: 0.92;
}

.submit-button:focus-visible,
.location-input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.forecast-copy {
  display: flex;
  flex-direction: column;
  gap: clamp(22px, 3.8vh, 42px);
}

.status-line {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.92rem;
  color: var(--muted);
  grid-column: 1 / -1;
  grid-row: 3;
  align-self: end;
}

.forecast-line {
  margin: 0;
  max-width: min(13ch, 100%);
  font-size: clamp(2rem, 4.4vw, 4.35rem);
  line-height: 0.98;
  font-weight: 700;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.location-note {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.95rem;
  color: var(--muted);
  grid-column: 1 / -1;
  grid-row: 2;
  align-self: end;
}

.character-frame {
  margin: 0;
  align-self: end;
  justify-self: end;
  width: min(100%, clamp(260px, 34vw, 470px));
  min-width: 0;
  display: flex;
  align-items: end;
  justify-content: end;
  grid-column: 2;
  grid-row: 1 / span 2;
}

.character-art {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(78vh, 980px);
  object-fit: contain;
}

@media (max-width: 980px) {
  .page-shell {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 28px 22px 0;
    gap: 28px;
  }

  .copy-column {
    max-width: none;
    order: 1;
  }

  .forecast-line {
    max-width: min(13ch, 100%);
    font-size: clamp(2rem, 8vw, 3.8rem);
  }

  .character-frame {
    order: 2;
    justify-self: end;
    align-self: start;
    width: min(56vw, 380px);
  }

  .location-note {
    order: 3;
    align-self: start;
  }

  .status-line {
    order: 4;
    align-self: start;
    padding-bottom: 22px;
  }
}

@media (max-width: 640px) {
  .location-controls {
    align-items: stretch;
  }

  .location-input,
  .submit-button {
    width: 100%;
    min-width: 0;
  }

  .forecast-copy {
    gap: 28px;
  }

  .forecast-line {
    max-width: none;
  }

  .character-frame {
    width: min(78vw, 330px);
  }
}
