/*
 * energieausweis.immo – look adapted from the static verification template
 * (Guilloche hero, certificate card, serif headings). Light scheme only.
 */

:root {
  color-scheme: light;

  --brand: #005376;
  --brand-2: #95c11f;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "Source Serif Pro", Georgia, serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;

  --bg: oklch(0.978 0.006 85);
  --surface: oklch(0.996 0.002 85);
  --text: oklch(0.22 0.02 260);
  --muted: oklch(0.47 0.015 260);
  --border: oklch(0.895 0.008 80);
  --border-strong: oklch(0.74 0.012 80);

  --accent: var(--brand);
  --accent-hover: color-mix(in oklch, var(--brand) 80%, black);
  --on-accent: #fff;
  --accent-soft: color-mix(in oklch, var(--brand) 9%, white);
  --focus: color-mix(in oklch, var(--brand) 85%, #2563eb);

  --hero-bg: color-mix(in oklch, var(--brand) 6%, oklch(0.988 0.005 85));
  --hero-pattern: color-mix(in oklch, var(--brand) 10%, transparent);
  --hero-rosette: color-mix(in oklch, var(--brand) 7%, transparent);
  --hero-glow: rgb(255 255 255 / 0.7);

  --footer-bg: oklch(0.955 0.008 85);

  --ok: oklch(0.49 0.12 155);
  --ok-soft: oklch(0.96 0.035 155);
  --bad: oklch(0.52 0.19 27);
  --bad-soft: oklch(0.965 0.025 27);
  --warn: oklch(0.52 0.12 62);
  --warn-soft: oklch(0.965 0.04 85);

  --radius-lg: 14px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 1px rgb(20 24 40 / 0.04), 0 2px 6px -2px rgb(20 24 40 / 0.06), 0 32px 64px -40px rgb(20 24 40 / 0.35);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

h1, h2, h3 { line-height: 1.2; margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { color: var(--accent-hover); }
img, svg { display: block; }
button, input { font: inherit; }

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

[hidden] { display: none !important; }

.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
}

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

.container {
  width: min(100% - 2rem, 70rem);
  margin-inline: auto;
}

.container.narrow { width: min(100% - 2rem, 42rem); }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  font-weight: 600;
}

.skip-link:focus { top: 1rem; }

/* ---------- Header & hero ---------- */
.site-header {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(60rem 26rem at 80% -20%, var(--hero-glow), transparent 60%),
    var(--hero-bg);
  border-bottom: 1px solid var(--border);
  padding-bottom: 7rem;
}

/* Guilloche like on certificate paper – as a mask so it takes the theme colour. */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--hero-pattern);
  -webkit-mask: url("../Images/guilloche.svg") center / 100% 100% no-repeat;
  mask: url("../Images/guilloche.svg") center / 100% 100% no-repeat;
}

.site-header::after {
  content: "";
  position: absolute;
  right: -5rem;
  bottom: -9rem;
  z-index: -1;
  width: 26rem;
  aspect-ratio: 1;
  background: var(--hero-rosette);
  -webkit-mask: url("../Images/rosette.svg") center / contain no-repeat;
  mask: url("../Images/rosette.svg") center / contain no-repeat;
}

.site-header--compact { padding-bottom: 6rem; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
  font-size: 1.0625rem;
  letter-spacing: -0.005em;
}

.brand:hover { color: var(--text); }
.brand-logo { width: 40px; height: 40px; }
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-name span { color: color-mix(in oklch, var(--brand-2) 75%, black); }

.icon-button {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  background: color-mix(in oklch, var(--brand) 5%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--brand) 20%, transparent);
  color: var(--text);
}

.icon-button:hover { background: color-mix(in oklch, var(--brand) 11%, transparent); color: var(--text); }

.hero {
  padding-top: clamp(2rem, 6vw, 4.5rem);
  text-align: center;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.875rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.hero-eyebrow::before,
.hero-eyebrow::after {
  content: "";
  width: 2rem;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

.hero-title {
  margin-top: 1.25rem;
  font-family: var(--serif);
  font-size: clamp(2.125rem, 6vw, 3.625rem);
  font-weight: 500;
  letter-spacing: -0.012em;
  line-height: 1.1;
}

.hero-lead {
  max-width: 38rem;
  margin: 1rem auto 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.2vw, 1.125rem);
  text-wrap: pretty;
}

/* ---------- Main ---------- */
main {
  flex: 1;
  outline: none;
  padding-bottom: clamp(3rem, 8vw, 5rem);
}

.card {
  position: relative;
  margin-top: -5rem;
  padding: clamp(1.5rem, 5vw, 2.75rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.card-title {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.005em;
}

/* Text content (Impressum, Datenschutz, Kontakt) from fluid_styled_content */
.prose { display: grid; gap: 1rem; }
.prose .frame { display: grid; gap: 1rem; }
.prose h2 { margin-top: 1rem; font-family: var(--serif); font-size: 1.375rem; font-weight: 500; }
.prose h3 { margin-top: 0.5rem; font-size: 1.0625rem; }
.prose ul, .prose ol { margin: 0; padding-left: 1.25rem; }
.prose li + li { margin-top: 0.375rem; }
.prose figure { margin: 0; }
.prose img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.prose figcaption { margin-top: 0.5rem; color: var(--muted); font-size: 0.875rem; }
.prose .ce-gallery { margin-top: 1rem; }

/* ---------- Form ---------- */
.verify-form { display: grid; gap: 1.5rem; }

.field { display: grid; gap: 0.375rem; }

.field-label {
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.code-input {
  width: 100%;
  min-height: 3.25rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: 500 clamp(1.0625rem, 3.8vw, 1.25rem) / 1.2 var(--mono);
  font-variant-numeric: tabular-nums slashed-zero;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.code-input::placeholder { color: var(--muted); opacity: 0.45; }
.code-input:hover { border-color: var(--muted); }

.code-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 16%, transparent);
}

.code-input[aria-invalid="true"] {
  border-color: var(--bad);
  background: var(--bad-soft);
}

.field-hint { color: var(--muted); font-size: 0.875rem; }

/* ---------- Buttons ---------- */
.form-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0 1.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

.button:active { transform: translateY(1px); }

.button-primary { flex: 1 1 12rem; background: var(--accent); color: var(--on-accent); }
.button-primary:hover { background: var(--accent-hover); color: var(--on-accent); }

.button-ghost { background: transparent; color: var(--accent); padding-inline: 0.75rem; }
.button-ghost:hover { background: var(--accent-soft); color: var(--accent); }

/* ---------- "Where do I find …" ---------- */
.where {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.where summary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2rem;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.where summary::-webkit-details-marker { display: none; }

.where summary::after {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  margin-left: 0.25rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.2s;
}

.where[open] summary::after { transform: translateY(2px) rotate(-135deg); }

.where-body {
  display: grid;
  gap: 1rem;
  padding-top: 0.75rem;
  color: var(--muted);
}

.where-figure { margin: 0; }
.where-figure img { width: 100%; max-width: 28rem; height: auto; }

/* ---------- Alert (not found) ---------- */
[data-status="valid"] { --status: var(--ok); --status-soft: var(--ok-soft); }
[data-status="invalid"] { --status: var(--bad); --status-soft: var(--bad-soft); }
[data-status="expired"] { --status: var(--warn); --status-soft: var(--warn-soft); }

.alert {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.875rem;
  margin-bottom: 1.5rem;
  padding: 1.125rem 1.25rem;
  border: 1px solid color-mix(in oklch, var(--status) 35%, transparent);
  border-left-width: 5px;
  border-left-color: var(--status);
  border-radius: var(--radius);
  background: var(--status-soft);
  animation: rise 0.35s var(--ease);
}

.alert-icon { width: 1.75rem; height: 1.75rem; color: var(--status); }
.alert-body { display: grid; gap: 0.5rem; min-width: 0; }
.alert-title { font-size: 1.0625rem; font-weight: 700; }
.alert-list { margin: 0; padding-left: 1.125rem; }
.alert-list li + li { margin-top: 0.125rem; }

.code {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums slashed-zero;
  letter-spacing: 0.06em;
}

/* ---------- Result: certificate ---------- */
.certificate {
  position: relative;
  overflow: hidden;
  margin-top: -5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  animation: rise 0.45s var(--ease);
}

.certificate::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--status);
}

.certificate-band {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: clamp(1rem, 4vw, 1.75rem);
  padding: clamp(1.75rem, 5vw, 2.5rem) clamp(1.5rem, 5vw, 2.75rem);
  background: color-mix(in oklch, var(--status-soft) 55%, var(--surface));
  border-bottom: 1px solid color-mix(in oklch, var(--status) 16%, transparent);
}

.certificate-band::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--status);
  opacity: 0.05;
  -webkit-mask: url("../Images/guilloche.svg") center / 220% 160% no-repeat;
  mask: url("../Images/guilloche.svg") center / 220% 160% no-repeat;
}

.seal {
  position: relative;
  width: clamp(5rem, 18vw, 6.5rem);
  aspect-ratio: 1;
  flex: none;
}

.seal-rosette {
  position: absolute;
  inset: 0;
  background: var(--status);
  -webkit-mask: url("../Images/rosette.svg") center / contain no-repeat;
  mask: url("../Images/rosette.svg") center / contain no-repeat;
}

.seal-core {
  position: absolute;
  inset: 25%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--status);
  color: var(--surface);
  box-shadow: 0 0 0 4px var(--status-soft);
}

.seal-icon { width: 58%; height: 58%; }

[data-status="valid"] .seal-icon { stroke-dasharray: 26; }
[data-status="valid"] .seal-rosette { animation: seal-in 0.9s var(--ease) both; }
[data-status="valid"] .seal-core { animation: pop 0.5s 0.15s var(--ease) both; }
[data-status="valid"] .seal-icon { animation: draw 0.45s 0.45s ease-out both; }

@keyframes seal-in {
  from { opacity: 0; transform: rotate(-40deg) scale(0.6); }
  to { opacity: 1; transform: none; }
}

@keyframes pop {
  from { transform: scale(0.4); opacity: 0; }
  70% { transform: scale(1.08); opacity: 1; }
  to { transform: none; }
}

@keyframes draw { from { stroke-dashoffset: 26; } to { stroke-dashoffset: 0; } }

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

.certificate-heading { display: grid; gap: 0.375rem; min-width: 0; }

.certificate-kicker {
  color: var(--status);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.certificate-title {
  font-family: var(--serif);
  font-size: clamp(1.625rem, 5vw, 2.125rem);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.certificate-body {
  display: grid;
  gap: 1.75rem;
  padding: clamp(1.5rem, 5vw, 2.75rem);
}

.meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 1rem 0;
  margin: 0;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.meta > div { padding: 0 1.25rem; border-left: 1px solid var(--border); }
.meta > div:first-child { padding-left: 0; border-left: 0; }

@media (max-width: 30rem) {
  .meta > div { padding-left: 0; border-left: 0; }
}

.meta dt {
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.meta dd { margin: 0.25rem 0 0; font-weight: 550; overflow-wrap: anywhere; }

.details-title {
  margin-bottom: 0.5rem;
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.fields { margin: 0; }

.fields > div {
  display: grid;
  gap: 0.125rem;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--border);
}

.fields > div:last-child { border-bottom: 0; }
.fields dt { color: var(--muted); font-size: 0.9375rem; }
.fields dd { margin: 0; font-weight: 550; font-size: 1.0625rem; overflow-wrap: anywhere; }

@media (min-width: 36rem) {
  .fields > div { grid-template-columns: minmax(9rem, 38%) 1fr; gap: 1rem; align-items: baseline; }
}

.callout {
  display: flex;
  gap: 0.75rem;
  padding: 0.25rem 0 0.25rem 1rem;
  border-left: 2px solid var(--accent);
  color: var(--muted);
  font-size: 0.9375rem;
}

.callout .icon { color: var(--accent); margin-top: 0.1rem; }

.checked-at { color: var(--muted); font-size: 0.875rem; }

.certificate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem clamp(1.25rem, 5vw, 2.25rem) clamp(1.25rem, 5vw, 2rem);
  border-top: 1px solid var(--border);
}

/* ---------- How it works & contact ---------- */
.steps, .contact { margin-top: clamp(2.5rem, 7vw, 4rem); }

.section-title {
  font-family: var(--serif);
  font-size: 1.625rem;
  font-weight: 500;
  letter-spacing: -0.005em;
}

.steps-list {
  display: grid;
  gap: 1rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

@media (min-width: 40rem) {
  .steps-list { grid-template-columns: repeat(3, 1fr); gap: 2rem; }
}

.step {
  display: grid;
  gap: 0.375rem;
  align-content: start;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-strong);
  counter-increment: step;
}

.step::before {
  content: counter(step, upper-roman) ".";
  margin-bottom: 0.25rem;
  color: var(--accent);
  font: italic 500 1.375rem/1 var(--serif);
}

.step h3 { font-size: 1rem; font-weight: 600; }
.step p { color: var(--muted); font-size: 0.9375rem; }
.step-link { justify-self: start; margin-top: 0.25rem; font-size: 0.9375rem; font-weight: 600; }

.contact {
  display: grid;
  gap: 0.75rem;
  padding-top: clamp(2rem, 5vw, 2.5rem);
  border-top: 1px solid var(--border);
}

.contact > p { color: var(--muted); max-width: 40rem; }

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 0.25rem 0 0;
  padding: 0;
  list-style: none;
}

.contact-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  font-weight: 600;
}

.faq-teaser {
  display: grid;
  margin: 0.25rem 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border);
}

.faq-teaser li { border-bottom: 1px solid var(--border); }

.faq-teaser a {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 0;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.faq-teaser a::after { content: "→"; color: var(--accent); }
.faq-teaser a:hover { color: var(--accent); }
.faq-all { font-weight: 600; }

/* ---------- FAQ (fluid_styled_content, frame_class = faq) ---------- */
.frame-faq + .frame-faq .faq { border-top: 0; }

.faq {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 1rem;
}

.faq summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 1rem 0;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: "";
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.2s;
}

.faq[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.faq:target summary { color: var(--accent); }
/* Linked question (/faq#…): show the answer without JavaScript */
.faq:target::details-content { content-visibility: visible; display: block; }
.faq:target summary::after { transform: translateY(2px) rotate(-135deg); }
.faq-answer { display: grid; gap: 0.75rem; padding-bottom: 1.25rem; color: var(--muted); }
.prose .frame-type-header h2 { margin-top: 1.5rem; }
.prose .frame-faq { gap: 0; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--footer-bg);
  border-top: 1px solid var(--border);
  color: var(--muted);
  padding-block: 2.5rem;
  font-size: 0.9375rem;
}

.site-footer a { color: var(--text); }
.site-footer a:hover { color: var(--accent); }

.footer-grid { display: grid; gap: 1.5rem; }

@media (min-width: 48rem) {
  .footer-grid { grid-template-columns: 1fr auto; align-items: start; }
  .footer-note { grid-column: 1 / -1; }
}

.footer-address { font-style: normal; }
.footer-address span { display: block; }
.footer-address span:first-child { color: var(--text); font-weight: 650; }

.footer-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-nav a { display: inline-flex; align-items: center; min-height: 2.75rem; }
.footer-nav a[aria-current="page"] { color: var(--accent); }

.footer-note {
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
}

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

  [data-status="valid"] .seal-icon { stroke-dasharray: none; }
}
