/* Rosenbergs Gård HVB – landningssida för utlottning */

:root {
  /* Brand colours (from rosenbergsgard.se, deepened where text needs contrast) */
  --teal-400: #719898;      /* site brand teal – accents only */
  --teal-600: #4d7272;      /* top of form area – cream text 4.8:1 */
  --teal-700: #456a6a;      /* form area – cream text 5.4:1 */
  --teal-800: #365555;
  --sage: #c8d4cc;
  --cream: #f6f3ec;
  --cream-soft: #e6ede8;
  --paper: #fbfaf6;
  --ink: #2b2a27;
  --ink-muted: #5a5750;
  --error-on-dark: #ffe3da;  /* 4.9:1 on --teal-700 */
  --error-border: #f2a893;

  --font-display: "Cinzel", "Trajan Pro", Georgia, serif;
  --font-serif: "Cormorant Garamond", Garamond, Georgia, serif;
  --font-sans: "Jost", "Segoe UI", system-ui, -apple-system, sans-serif;

  --radius: 12px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  --wave-h: clamp(52px, 10vw, 150px);

  color-scheme: light;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--teal-700);
  color: var(--cream);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }

/* Components set their own display; the hidden attribute must still win */
[hidden] { display: none !important; }

a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--cream);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------- Hero ---------- */

/* Mobile: the photo sits under the brand at a width that keeps the whole
   house in view, and its top fades into the cream behind the text. */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--cream);
  isolation: isolate;
}

.hero__photo {
  order: 2;
  position: relative;
  z-index: 0;
  width: 172vw;
  max-width: none;
  height: auto;
  margin: -20px 0 0 -33vw;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 30%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 30%);
}

.brand {
  order: 1;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: max(28px, env(safe-area-inset-top)) 16px 0;
  color: var(--ink);
}

.brand__tree {
  width: clamp(76px, 22vw, 116px);
  height: auto;
  margin-bottom: 10px;
}

.brand__name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2rem, 9.4vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.brand__name span { display: block; }

.brand__tagline {
  display: flex;
  align-items: center;
  gap: 0.6em;
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgb(43 42 39 / 0.35);
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(0.8rem, 3.2vw, 1.05rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}

.brand__tagline::before,
.brand__tagline::after {
  content: "";
  width: 0.9em;
  height: 1px;
  background: currentColor;
}

.hero__wave {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: -1px;
  width: 100%;
  height: var(--wave-h);
}

.hero__wave-fill { fill: var(--teal-600); }

/* Cream line traced exactly along the top edge of the teal */
.hero__wave-line {
  fill: none;
  stroke: var(--cream);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

/* ---------- Signup ---------- */

.signup {
  background: linear-gradient(to bottom, var(--teal-600) 0, var(--teal-700) 420px);
  padding: 8px 16px 0;
}

.signup__inner {
  max-width: 520px;
  margin: 0 auto;
  padding-bottom: 48px;
}

.signup__title {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(2rem, 8vw, 2.75rem);
  line-height: 1.1;
  text-align: center;
  text-wrap: balance;
}

.signup__lead {
  margin: 10px auto 28px;
  max-width: 34ch;
  font-size: 1.0625rem;
  text-align: center;
  color: var(--cream-soft);
  text-wrap: balance;
}

/* ---------- Form ---------- */

.form { display: grid; gap: 20px; }

.field { display: grid; gap: 6px; }

.field__label {
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.35;
}

.field__hint {
  margin: -2px 0 2px;
  font-size: 0.9rem;
  color: var(--cream-soft);
}

.field__input {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 1.0625rem; /* ≥16px stops iOS zoom on focus */
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08);
  transition: border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}

.field__input:hover { border-color: var(--sage); }

.field__input:focus-visible {
  outline: none;
  border-color: var(--teal-800);
  box-shadow: 0 0 0 3px var(--cream);
}

.field__input[aria-invalid="true"] {
  border-color: var(--error-border);
  box-shadow: 0 0 0 1px var(--error-border);
}

.field__error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 2px 0 0;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--error-on-dark);
}

.field__error::before {
  content: "";
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 3px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1zm-.75 3.5h1.5v5h-1.5zm0 6.25h1.5v1.5h-1.5z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1zm-.75 3.5h1.5v5h-1.5zm0 6.25h1.5v1.5h-1.5z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Consent */

.consent {
  display: grid;
  gap: 14px;
  margin: 4px 0 0;
  padding: 18px 0 0;
  border: 0;
  border-top: 1px solid rgb(200 212 204 / 0.35);
}

.check {
  display: grid;
  grid-template-columns: 24px 1fr;
  column-gap: 12px;
  align-items: start;
}

.check .field__error { grid-column: 2; }

.check__input {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin: 1px 0 0;
  border: 2px solid var(--cream);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-content: center;
  transition: background-color 140ms var(--ease-out);
}

.check__input::before {
  content: "";
  width: 12px;
  height: 12px;
  background: var(--teal-800);
  clip-path: polygon(14% 52%, 0 66%, 38% 100%, 100% 22%, 86% 8%, 37% 70%);
  transform: scale(0);
  transition: transform 140ms var(--ease-out);
}

.check__input:checked { background: var(--cream); }
.check__input:checked::before { transform: scale(1); }
.check__input[aria-invalid="true"] { border-color: var(--error-on-dark); box-shadow: 0 0 0 2px var(--error-border); }

/* Bigger tap target: the whole label toggles the checkbox */
.check__label {
  font-size: 0.9375rem;
  line-height: 1.5;
  cursor: pointer;
  padding-bottom: 2px;
}

.check__optional { color: var(--cream-soft); }

/* Button */

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  margin-top: 6px;
  padding: 14px 24px;
  border: 0;
  border-radius: 999px;
  background: var(--cream);
  color: var(--teal-800);
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 6px 18px -8px rgb(0 0 0 / 0.45);
  transition: background-color 180ms var(--ease-out), transform 120ms var(--ease-out), box-shadow 180ms var(--ease-out);
}

.button:hover { background: #fffdf8; box-shadow: 0 10px 24px -10px rgb(0 0 0 / 0.5); }
.button:active { transform: translateY(1px) scale(0.99); }

.button[aria-busy="true"] { cursor: progress; opacity: 0.9; }

.button__spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.button[aria-busy="true"] .button__spinner { display: block; }

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

/* Error summary */

.error-summary {
  margin: 0 0 24px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  border-left: 6px solid #b4412a;
}

.error-summary:focus-visible { outline-color: var(--cream); }

.error-summary__title {
  margin: 0 0 6px;
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  font-weight: 600;
}

.error-summary__list { margin: 0; padding-left: 1.1em; }
.error-summary__list li + li { margin-top: 2px; }
.error-summary__list a { color: #8e2f1c; font-weight: 500; }

/* Success */

.success {
  text-align: center;
  padding: 24px 8px 8px;
}

.success:focus { outline: none; }

.success__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  color: var(--cream);
}

.success__title {
  margin: 0 0 8px;
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.15;
}

.success__text {
  margin: 0 auto 20px;
  max-width: 34ch;
  color: var(--cream-soft);
  font-size: 1.0625rem;
}

.success__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 500;
}

/* Footer */

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px 20px;
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 0 max(24px, env(safe-area-inset-bottom));
  border-top: 1px solid rgb(200 212 204 / 0.25);
  font-size: 0.875rem;
  color: var(--cream-soft);
}

.footer p { margin: 0; }
.footer a { display: inline-block; padding: 6px 0; }

/* ---------- Integritetspolicy ---------- */

body.legal {
  background: var(--cream);
  color: var(--ink);
}

.legal :focus-visible { outline-color: var(--teal-700); }

.legal__header {
  background: var(--teal-700);
  padding: 12px 16px;
}

.legal__brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  color: var(--cream);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.legal__brand img {
  width: 40px;
  height: auto;
  filter: invert(96%) sepia(6%) saturate(250%) hue-rotate(5deg); /* cream tree on teal */
}

.legal__main {
  max-width: 68ch;
  margin: 0 auto;
  padding: 32px 16px max(48px, env(safe-area-inset-bottom));
}

.legal__main h1 {
  margin: 0 0 4px;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(2.2rem, 8vw, 3rem);
  line-height: 1.1;
}

.legal__main h2 {
  margin: 32px 0 8px;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.6rem;
  line-height: 1.2;
}

.legal__main p,
.legal__main li { color: #3a3934; }

.legal__main a { color: var(--teal-800); font-weight: 500; }

.legal__meta { color: var(--ink-muted) !important; font-size: 0.95rem; }

.legal__back { margin-top: 40px; }
.legal__back a { display: inline-flex; align-items: center; min-height: 44px; }

/* ---------- Entrance motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  .brand > * {
    animation: rise 700ms var(--ease-out) both;
  }
  .brand > :nth-child(2) { animation-delay: 80ms; }
  .brand > :nth-child(3) { animation-delay: 160ms; }

  .success:not([hidden]) { animation: rise 500ms var(--ease-out) both; }

  @keyframes rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ---------- Larger screens ---------- */

/* Wider screens: same stacking as mobile, full-width photo cropped to a band */
@media (min-width: 768px) {
  .hero__photo {
    width: 100%;
    height: clamp(420px, 66vh, 760px);
    margin: -28px 0 0;
    object-fit: cover;
    object-position: 50% 45%;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 24%);
            mask-image: linear-gradient(to bottom, transparent 0, #000 24%);
  }

  .brand { padding-top: 40px; }
  .brand__tree { margin-bottom: 14px; }
  .brand__tagline { margin-top: 16px; padding-top: 14px; }

  .signup { padding-top: 16px; }
  .signup__lead { margin-bottom: 36px; }
}
