/* The site's own chrome is always dark, regardless of OS/browser
   preference — a deliberate choice, not a fallback. Card templates
   (light/dark/colorLight/colorDark) are independently themed and
   unaffected by this. */
:root {
  --color-bg: #16181c;
  --color-text: #f0f0f0;
  --color-muted: #a5a5a5;
  --color-accent: #6fa8dc;
  --color-accent-contrast: #0b2f52;
  --color-border: #3a3d42;
  --color-error: #b3261e;
  --color-logo-accent: #c81e45;
  --radius: 10px;
  --max-width: 480px;
  --mobile-breakpoint: 700px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.4;
}

.site-header {
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 20px 20px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "logo nav";
  align-items: start;
  column-gap: 12px;
}

.logo {
  grid-area: logo;
  display: inline-block;
  font-family: "Courier New", Courier, ui-monospace, monospace;
  font-weight: 700;
  text-decoration: none;
}

.logo-desktop {
  display: inline-block;
  font-size: 63px;
  line-height: 0.85;
  letter-spacing: 0.19em;
}

.logo-mobile {
  display: none;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: 0.01em;
}

.logo-strong {
  color: var(--color-text);
}

.logo-accent {
  color: var(--color-logo-accent);
}

@media (max-width: 700px) {
  .logo-desktop {
    display: none;
  }
  .logo-mobile {
    display: inline-block;
  }
}

.header-nav {
  grid-area: nav;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.read-more-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-accent);
  text-decoration: none;
}

@media (min-width: 701px) {
  /* The logo is centered independently via absolute positioning. Language
     select stays far left, "Read more" far right — .header-nav spans the
     full width and centers them against each other vertically, while the
     row as a whole still bottom-aligns with the logo. */
  .header-inner {
    display: flex;
    align-items: flex-end;
    position: relative;
    min-height: 266px; /* logo height (214) + top/bottom padding (32+20) */
  }
  .header-nav {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  .logo {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
  }
  .desktop-explain {
    margin-top: -10px;
    color: var(--color-muted);
  }
}

.lang-select {
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  width: 112px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.tagline {
  color: var(--color-muted);
  margin-top: 0;
}

.panel h1 {
  font-size: 1.3rem;
  margin-bottom: 8px;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel[hidden] {
  display: none;
}

label {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: -8px;
}

input[type="text"],
input[type="tel"],
input[type="email"],
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

fieldset {
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

fieldset[hidden] {
  display: none;
}

.field-heading {
  font-weight: 600;
  margin: 6px 0 -4px;
}

.field-with-toggle {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-border);
}

.field-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#moreFields > .field-main {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-border);
}

.show-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--color-muted);
  margin-bottom: 0;
  cursor: pointer;
}

.show-toggle input {
  margin: 0;
}

.repeat-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.repeat-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.repeat-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}

.repeat-row .repeat-value {
  flex: 1 1 100%;
}

.remove-row-btn {
  background: none;
  border: none;
  color: var(--color-error);
  text-decoration: underline;
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0;
}

.add-row-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: center;
  margin-left: auto;
  font-size: 0.85rem;
  text-decoration: none;
}

.add-row-btn:hover {
  text-decoration: underline;
}

.icon-plus {
  flex-shrink: 0;
}

#toggleMoreFields {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--color-accent);
  text-decoration: underline;
  padding: 0;
  font-size: 0.95rem;
  cursor: pointer;
  align-self: flex-start;
}

.primary-btn,
.secondary-btn {
  display: inline-block;
  text-align: center;
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.primary-btn {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  border: none;
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.secondary-btn {
  background: none;
  border: 1px solid var(--color-accent);
  color: var(--color-accent);
}

.template-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.template-swatch {
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}

.template-swatch input {
  display: block;
  margin: 0 auto 8px;
}

.template-swatch--light { background: #ffffff; color: #111111; }
.template-swatch--dark { background: #111111; color: #ffffff; }
.template-swatch--colorLight { background: #eaf2fb; color: #0b2f52; }
.template-swatch--colorDark { background: #0b2f52; color: #ffffff; }

.template-swatch:has(input:checked) {
  border-color: var(--color-accent);
}

.error {
  color: var(--color-error);
  font-size: 0.9rem;
}

.muted {
  color: var(--color-muted);
  font-size: 0.9rem;
}

.card-preview {
  width: 100%;
  max-width: 320px;
  display: block;
  margin: 0 auto;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

.site-qr {
  display: block;
  margin: 0 auto;
  width: 200px;
  height: 200px;
}

.site-footer {
  text-align: center;
  color: var(--color-muted);
  font-size: 0.8rem;
  padding: 20px;
}

.site-footer p {
  margin: 0 0 8px;
}

.footer-links a {
  color: var(--color-muted);
  text-decoration: underline;
  margin: 0 6px;
}

.content-page h1 {
  font-size: 1.5rem;
  margin: 0 0 16px;
}

.content-page .intro {
  font-size: 1.05rem;
  line-height: 1.6;
  margin: 0 0 24px;
}

.content-page h2 {
  font-size: 1.05rem;
  margin: 28px 0 8px;
}

.content-page p {
  line-height: 1.6;
  margin: 0 0 12px;
}

.content-page ul {
  margin: 0 0 12px;
  padding-left: 20px;
  line-height: 1.6;
}

.content-page li {
  margin-bottom: 6px;
}

.content-page .closing {
  margin-top: 28px;
  color: var(--color-muted);
}

.form-status {
  font-size: 1.1rem;
  margin-top: 20px;
}

.form-status--success {
  color: #4ade80;
}
