/* --------------------------------------------------
   Global Reset & Base Styles (inspired by modern-normalize)
   -------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0 solid transparent;
  -webkit-tap-highlight-color: transparent; /* Removes tap highlight on mobile */
}

html {
  /* Fluid typography ? scales between ~14-16px on most viewports */
  font-size: clamp(0.875rem, 0.9rem + 0.25vw, 1rem);
  -webkit-text-size-adjust: 100%;
}

:root {
  /* Design tokens */
  --color-bg: #f5f5f5;
  --color-primary: #4285f4;
  --color-primary-hover: #3367d6;
  --color-primary-active: #2a56c6;
  --color-success: #0f9d58;
  --color-error: #d93025;

  --radius-s: 0.25rem;
  --radius-m: 0.5rem;

  --shadow-s: 0 2px 4px rgba(0, 0, 0, 0.08);
  --shadow-m: 0 4px 15px rgba(0, 0, 0, 0.1);

  --avatar-size: 4.5rem; /* 72px ? easy to tweak */
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--color-bg);
  display: flex;
  justify-content: center;
  align-items: center; /* Center vertically as well for better focus */
  min-height: 100svh; /* Use small-viewport height to avoid mobile URL bar jump */
  padding-inline: 1rem;
  margin-block: 0;
}

/* --------------------------------------------------
   Layout Helpers
   -------------------------------------------------- */
.container {
  position: relative; /* Needed for avatar pseudo-element */
  background-color: #fff;
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-m);
  padding: calc(clamp(1.5rem, 2vw + 1rem, 2.5rem) + (var(--avatar-size) / 2)); /* extra top space below avatar */
  padding-block-end: clamp(1.5rem, 2vw + 1rem, 2.5rem);
  width: 100%;
  max-width: 32rem; /* 512px */
}

/* Avatar badge sitting half-overlapping the container */
.container::before {
  content: "";
  position: absolute;
  top: calc((var(--avatar-size) / -2));
  left: 50%;
  translate: -50%; /* Center horizontally */
  width: var(--avatar-size);
  height: var(--avatar-size);
  background: url("FraunhoferAvatarIcon.png") center/contain no-repeat;
  border-radius: 50%;
  background-color: #fff; /* Provide fallback if PNG is transparent */
  box-shadow: var(--shadow-s);
}

.screen {
  display: none;
}

/* Support both the legacy `.active` class and new `.is-active` class  */
.screen.is-active,
.screen.active {
  display: block;
}

/* --------------------------------------------------
   Typography
   -------------------------------------------------- */
h2 {
  color: #333;
  margin-block-end: 1.5rem;
  text-align: center;
  overflow-wrap: anywhere;
}

/* --------------------------------------------------
   Forms & Controls
   -------------------------------------------------- */
.form-group {
  margin-block-end: 1rem;
}

input,
textarea,
button {
  font: inherit;
  -webkit-appearance: none;
  appearance: none;
}

input,
textarea {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid #ddd;
  border-radius: var(--radius-s);
  font-size: 1rem;
}

textarea {
  min-block-size: 9.375rem; /* 150px */
  resize: vertical;
}

button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  inline-size: 100%;
  min-block-size: 44px; /* WCAG touch target */
  padding: 0.8rem 1.5rem;
  color: #fff;
  background-color: var(--color-primary);
  border-radius: var(--radius-s);
  cursor: pointer;
  transition: background-color 0.25s, transform 0.1s;
  user-select: none;
}

button:hover {
  background-color: var(--color-primary-hover);
}

button:active {
  background-color: var(--color-primary-active);
  transform: scale(0.97);
}

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

/* --------------------------------------------------
   Validation & Messages
   -------------------------------------------------- */
.error {
  color: var(--color-error);
  font-size: 0.9rem;
  margin-block-start: 0.5rem;
}

#formMessage {
  margin-block-start: 1rem;
  text-align: center;
  font-size: 0.9rem;
}

#formMessage.success {
  color: var(--color-success);
}
#formMessage.error {
  color: var(--color-error);
}

/* --------------------------------------------------
   Motion Preferences
   -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* --------------------------------------------------
   Responsive Tweaks
   -------------------------------------------------- */
@media (max-width: 480px) {
  :root {
    --avatar-size: 3.5rem;
  }

  .container {
    padding-block-start: calc(clamp(1rem, 4vw, 1.5rem) + (var(--avatar-size) / 2));
    padding-inline: clamp(1rem, 4vw, 1.5rem);
    border-radius: 0; /* Edge-to-edge card */
    box-shadow: none; /* Full-width cards feel better without shadows */
    min-height: 70vh;
  }

  textarea {
    min-block-size: 7.5rem; /* 120px */
  }
}

@media (max-width: 320px) {
  .container {
    min-height: 80vh;
  }

  input,
  textarea,
  button {
    padding: 0.7rem;
    margin-block-end: 0.8rem;
  }
}
