/*
 * Aussehen der ganzen Website. Handgeschrieben, keine fremden Ressourcen, keine Webfonts.
 * Die Regeln stehen in der Reihenfolge der Seite von oben nach unten, die Eigenschaften alphabetisch.
 *
 * Gerüst einer Seite:
 *
 *   <body>                                   (Rechtstexte: <body class="legal">)
 *     <header>
 *       <div class="header-inner">
 *         <a class="brand" href="/"><strong>SCORBAN</strong> <span>Unterzeile</span></a>
 *         <nav><a href="/#leistungen">Leistungen</a> <a href="/#kontakt">Kontakt</a></nav>
 *       </div>
 *     </header>
 *     <main>
 *       <section class="hero"><h1>Titel</h1></section>      (weißes Band über die ganze Breite)
 *       <section class="band"><div class="column">...</div></section>      (Textspalte auf grauem Band)
 *     </main>
 *     <footer><a href="/impressum">Impressum</a> - <a href="/datenschutz">Datenschutz</a></footer>
 *   </body>
 */

/* Die Farben und Maße der Website. Die Bänder sind abgestuft: background, band, surface. */
:root {
  color-scheme: light dark;
  --background: #ffffff;
  --band: #f9fafb;
  --border: #e5e7eb;
  --button-hover: #1f2937;
  --field-border: #e5e7eb;
  --heading: #111827;
  --hover: #f3f4f6;
  --invalid: #ff0000;
  --muted: #6b7280;
  --notice-background: #fff6d9;
  --notice-border: #e0b84a;
  --placeholder: #9ca3af;
  --subtitle: #4b5563;
  --surface: #f3f4f6;
  --text: #374151;
  --width-form: 42rem;
  --width-column: 56rem;
  --width-page: 72rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #121212;
    --band: #181818;
    --border: #333333;
    --button-hover: #d4d4d4;
    --field-border: #666666;
    --heading: #f5f5f5;
    --hover: #262626;
    --invalid: #f87171;
    --muted: #a3a3a3;
    --notice-background: #3a3115;
    --notice-border: #8f752a;
    --placeholder: #8a8a8a;
    --subtitle: #bdbdbd;
    --surface: #1e1e1e;
    --text: #d4d4d4;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  line-height: 1.5;
  text-size-adjust: 100%;
}

body {
  background: var(--background);
  color: var(--heading);
  margin: 0;
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible {
  border-radius: 0.125rem;
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* Nur für Screenreader sichtbar, etwa die Beschriftungen der Formularfelder */
.sr-only {
  border: 0;
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

/* Kopf: Band mit der Marke und der Navigation */

body > header {
  background: var(--band);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin: 0 auto;
  max-width: var(--width-page);
  padding: 1.5rem 1rem;
}

.brand {
  border-radius: 0.25rem;
  display: block;
  transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

.brand strong {
  display: block;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.75rem;
}

.brand span {
  display: block;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

nav {
  white-space: nowrap;
}

nav a {
  font-size: 0.875rem;
  line-height: 1.25rem;
  margin-left: 1.5rem;
}

nav a:hover {
  text-decoration: underline;
}

/* Titel: weißes Band über die ganze Breite */

.hero {
  background: var(--background);
  padding: 5rem 0;
  text-align: center;
}

.hero h1 {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 2.5rem;
  margin-bottom: 1rem;
  overflow-wrap: break-word;
}

.hero p {
  color: var(--subtitle);
  font-size: 1.125rem;
  line-height: 1.75rem;
}

/* Graues Band mit der Textspalte */

.band {
  background: var(--surface);
  padding: 4rem 0;
}

.column {
  margin: 0 auto;
  max-width: var(--width-column);
  padding: 0 1.5rem;
}

/* Leistungen auf der Startseite */

.services h2 {
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 2.25rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

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

.service-grid h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.75rem;
  margin-bottom: 0.5rem;
}

.service-grid p {
  color: var(--text);
}

@media (min-width: 768px) {
  .service-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Rechtstexte: Impressum und Datenschutz */

.legal .column a {
  text-decoration: underline;
}

.legal .column h2 {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 2rem;
  margin-bottom: 1rem;
}

.legal .column h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.75rem;
  margin: 1.5rem 0 0.5rem;
}

.legal .column li {
  margin-bottom: 0.25rem;
}

.legal .column p,
.legal .column ul {
  color: var(--text);
  margin-bottom: 1rem;
}

.legal .column section {
  margin-bottom: 2.5rem;
}

.legal .column strong {
  color: var(--heading);
}

.legal .column ul {
  list-style: disc;
  padding-left: 2.5rem;
}

/* Kontakt: Abschnitt mit dem Formular */

.contact-section {
  margin: 0 auto;
  max-width: var(--width-form);
  padding: 5rem 1rem;
}

.contact-section h2 {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 2rem;
  margin-bottom: 1.5rem;
}

/* Hinweis im Kasten, etwa wenn das Formular ohne JavaScript nicht geht */
.notice {
  background: var(--notice-background);
  border: 1px solid var(--notice-border);
  border-radius: 0.25rem;
  color: var(--text);
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
}

.notice a {
  text-decoration: underline;
}

.contact {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr);   /* Sonst macht die Zeile mit Widget und Button das Formular auf dem Handy zu breit */
}

.contact input,
.contact textarea {
  background: var(--background);
  border: 1px solid var(--field-border);
  border-radius: 0.25rem;
  color: inherit;
  font: inherit;
  margin: 0;
  padding: 0.5rem 1rem;
  width: 100%;
}

.contact input::placeholder,
.contact textarea::placeholder {
  color: var(--placeholder);
  opacity: 1;
}

/* Erst rot, wenn etwas eingegeben ist: Das leere Pflichtfeld ist beim Laden der Seite noch kein Fehler */
.contact input[type="email"]:not(:placeholder-shown):invalid {
  box-shadow: 0 0 0 2px var(--invalid);
}

.contact textarea {
  display: block;
  height: 8rem;
  resize: vertical;
}

.contact input:focus-visible,
.contact textarea:focus-visible,
.contact button:focus-visible {
  outline: 2px solid var(--heading);
  outline-offset: 2px;
}

.contact altcha-widget {
  --altcha-color-base: var(--background);
  --altcha-color-base-content: var(--text);
  --altcha-color-neutral: var(--field-border);
  --altcha-color-primary: var(--heading);
  --altcha-color-primary-content: var(--background);
  --altcha-checkbox-size: 20px;
  --altcha-padding: 0.625rem;   /* Nur ein Wert: Das Widget rechnet damit, sonst hat seine Fehlermeldung keinen Innenabstand */
}

/* Letzte Zeile des Formulars: das Widget und der Button, immer in einer Zeile. Beide stehen mittig in ihrer Hälfte der
   Zeile. Auf schmalen Bildschirmen schrumpft der Innenabstand des Buttons, und der Text im Widget bricht um. */
.form-actions {
  align-items: center;
  display: flex;
  flex-wrap: nowrap;
  gap: 1rem;
  justify-content: space-around;
}

.form-actions altcha-widget {
  min-width: 0;
}

.contact button {
  background: var(--heading);
  border: 0;
  border-radius: 0.25rem;
  color: var(--background);
  cursor: pointer;
  flex: none;
  font: inherit;
  height: 2.5rem;
  padding: 0 clamp(1.25rem, 10vw, 4rem);
  position: relative;
  white-space: nowrap;
}

.contact button:hover:not(:disabled) {
  background: var(--button-hover);
}

.contact button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* Spinner im Button: sichtbar, solange die Klasse "sending" am Button hängt */
.button-spinner {
  animation: spin 1s linear infinite;
  bottom: 0;
  height: 1.25rem;
  left: 0;
  margin: auto;
  position: absolute;
  right: 0;
  top: 0;
  visibility: hidden;
  width: 1.25rem;
}

.contact button.sending .button-spinner {
  visibility: visible;
}

.contact button.sending .button-text {
  visibility: hidden;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Falle für Bots im Formular (Honeypot): für Menschen unsichtbar, auch für Screenreader */
.trap {
  height: 1px;
  left: -10000px;
  overflow: hidden;
  position: absolute;
  width: 1px;
}

/* Rückmeldung nach dem Absenden, blendet aus, sobald wieder ein Feld den Fokus bekommt */
.form-status {
  color: var(--text);
  margin-top: 1rem;
  min-height: 4rem;
  padding: 1.25rem 0;
  text-align: center;
  transition: opacity 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-status.faded {
  opacity: 0;
}

/* Fuß: Links auf die Pflichtseiten */

body > footer {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.25rem;
  padding: 1.5rem 1rem;
  text-align: center;
}

body > footer a {
  text-decoration: underline;
}

body.legal > footer {
  padding: 5rem 1rem;
}

/* Handy */

@media (max-width: 40rem) {
  nav a {
    margin-left: 1rem;
  }

  .hero {
    padding: 3rem 1rem;
  }

  .hero h1 {
    font-size: 1.75rem;
    line-height: 2.25rem;
  }

  .band {
    padding: 3rem 0;
  }

  .column {
    padding: 0 1rem;
  }

  .contact-section {
    padding: 3rem 1rem;
  }

  body.legal > footer {
    padding: 3rem 1rem;
  }
}

/* Druck: nur der Inhalt, schwarz auf weiß */

@media print {
  :root {
    color-scheme: light;
    --background: #ffffff;
    --band: #ffffff;
    --border: #999999;
    --heading: #000000;
    --muted: #333333;
    --notice-background: #ffffff;
    --notice-border: #999999;
    --subtitle: #000000;
    --surface: #ffffff;
    --text: #000000;
  }

  html {
    font-size: 11pt;
  }

  body > footer,
  .contact-section,
  nav {
    display: none;
  }

  /* Die Marke bleibt, damit ein Ausdruck zeigt, von welcher Website er stammt */
  body > header {
    margin-bottom: 1.5rem;
  }

  .header-inner {
    padding: 0 0 0.5rem;
  }

  .brand span::after {
    content: " · scorban.de";
  }

  .band,
  .hero {
    padding: 0;
  }

  .column {
    max-width: none;
    padding: 0;
  }

  .hero {
    margin-bottom: 1.5rem;
    text-align: left;
  }

  .hero h1 {
    font-size: 20pt;
    line-height: 1.2;
  }

  .services h2 {
    text-align: left;
  }

  .service-grid {
    display: block;
  }

  .service-grid > div {
    break-inside: avoid;
    margin-bottom: 1rem;
  }

  h2,
  h3 {
    break-after: avoid;
  }
}
