@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&display=swap');

:root {
  --color-background: #050505;
  --color-surface: #0b0b0b;
  --color-surface-alt: #101010;
  --color-highlight: #f5f2e5;
  --color-text-primary: #f5f2e5;
  --color-text-secondary: #b9b5a7;
  --color-accent: #f5f2e5;
  --color-border: rgba(245, 242, 229, 0.2);
  --color-border-strong: rgba(245, 242, 229, 0.35);
  --color-border-hover: rgba(245, 242, 229, 0.5);
  --color-border-subtle: rgba(245, 242, 229, 0.12);
  --color-outline: rgba(245, 242, 229, 0.6);
  --color-outline-strong: rgba(245, 242, 229, 0.7);
  --color-fill-soft: rgba(245, 242, 229, 0.05);
  --color-fill-hover: rgba(245, 242, 229, 0.08);
  --color-button-text: #050505;
  --border-radius-lg: 22px;
  --border-radius-md: 18px;
  --border-radius-sm: 12px;
  --transition-base: 0.28s ease;
  --max-width: 820px;
}

:root[data-theme="light"] {
  --color-background: #f7f5f1;
  --color-surface: #f7f5f1;
  --color-surface-alt: #efe9dc;
  --color-highlight: #1c1a16;
  --color-text-primary: #1c1a16;
  --color-text-secondary: #585248;
  --color-accent: #1c1a16;
  --color-border: rgba(28, 26, 22, 0.22);
  --color-border-strong: rgba(28, 26, 22, 0.42);
  --color-border-hover: rgba(28, 26, 22, 0.5);
  --color-border-subtle: rgba(28, 26, 22, 0.14);
  --color-outline: rgba(28, 26, 22, 0.4);
  --color-outline-strong: rgba(28, 26, 22, 0.5);
  --color-fill-soft: rgba(28, 26, 22, 0.06);
  --color-fill-hover: rgba(28, 26, 22, 0.1);
  --color-button-text: #f7f5f1;
}

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

html, body {
  padding: 0;
  margin: 0;
  min-height: 100%;
  background: var(--color-background);
  color: var(--color-text-primary);
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-base);
}

a:hover,
a:focus-visible {
  color: var(--color-text-primary);
}

main {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 72px 24px 120px;
}

.page-shell {
  width: 100%;
  max-width: var(--max-width);
  display: grid;
  gap: 32px;
}

.tool-stack {
  display: grid;
  gap: 32px;
  width: 100%;
}

.page-header {
  display: grid;
  gap: 16px;
}

.page-header h1 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 2.8rem);
  letter-spacing: -0.02em;
}

.page-subtitle {
  margin: 0;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.hero-title-with-back {
  justify-items: start;
}

.hero-back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--color-border-hover);
  background: var(--color-surface);
  color: var(--color-text-primary);
  text-decoration: none;
  flex-shrink: 0;
  line-height: 0;
  transition: border var(--transition-base), transform var(--transition-base), box-shadow var(--transition-base), background var(--transition-base);
}

.hero-back-link span {
  display: inline-block;
  transform: translateX(-1px);
}

.hero-back-link:hover,
.hero-back-link:focus-visible {
  transform: translateX(-3px);
  border-color: var(--color-border-strong);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.55);
  background: var(--color-surface-alt);
  outline: 2px solid var(--color-outline);
  outline-offset: 2px;
}

.board-group {
  margin: 72px 0;
}

.board-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 28px;
}

.board-heading-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.board-heading h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: -0.02em;
  text-transform: lowercase;
}

.board-heading-text h2 {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.board-heading-anchor {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 0.85rem;
  text-decoration: none;
  opacity: 0;
  transition: opacity var(--transition-base), border var(--transition-base), color var(--transition-base), transform var(--transition-base);
}

.board-heading:hover .board-heading-anchor,
.board-heading:focus-within .board-heading-anchor {
  opacity: 1;
}

.board-heading-anchor:hover,
.board-heading-anchor:focus-visible {
  opacity: 1;
  color: var(--color-text-primary);
  border-color: var(--color-border-strong);
  transform: translateY(-2px);
  outline: none;
}

.board-heading-text p {
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-weight: 600;
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.contact-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 40px;
  align-items: start;
}

.contact-intro {
  display: grid;
  gap: 18px;
}

.contact-title {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.8rem);
  color: var(--color-text-primary);
  letter-spacing: -0.015em;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.contact-title:hover .board-heading-anchor,
.contact-title:focus-within .board-heading-anchor {
  opacity: 1;
}

.contact-subtitle {
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-weight: 600;
  margin: 0;
  color: var(--color-text-secondary);
  line-height: 1.7;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
}

.contact-link {
  border: 2px solid var(--color-border);
  padding: 10px 16px;
  border-radius: var(--border-radius-sm);
  color: var(--color-text-primary);
  font-weight: 600;
  transition: border var(--transition-base), transform var(--transition-base);
}

.contact-link:hover,
.contact-link:focus-visible {
  transform: translateY(-2px);
  border-color: var(--color-border-strong);
}

.contact-form {
  display: grid;
  gap: 18px;
}

.checkbox-label span {
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 0.92rem;
  color: var(--color-text-secondary);
  letter-spacing: 0.02em;
}

.hero-back-link span {
  display: inline-block;
  transform: translateX(-1px);
}

.hero-back-link:hover,
.hero-back-link:focus-visible {
  transform: translateX(-3px);
  border-color: var(--color-border-strong);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.55);
  background: var(--color-surface-alt);
  outline: 2px solid var(--color-outline);
  outline-offset: 2px;
}

form {
  display: grid;
  gap: 18px;
  background: var(--color-surface);
  padding: 32px;
  border-radius: var(--border-radius-lg);
  border: 2px solid var(--color-border-subtle);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
}

label {
  display: grid;
  gap: 8px;
  font-weight: 500;
  color: var(--color-text-primary);
}

input,
textarea {
  padding: 14px 16px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--color-border-subtle);
  background: var(--color-surface-alt);
  color: var(--color-text-primary);
  font-size: 1rem;
  transition: border var(--transition-base), box-shadow var(--transition-base);
}

input:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--color-border-strong);
  box-shadow: 0 0 0 3px rgba(245, 242, 229, 0.18);
}

textarea {
  min-height: 220px;
  resize: vertical;
  line-height: 1.6;
}

fieldset {
  margin: 0;
  padding: 0;
  border: none;
  display: grid;
  gap: 14px;
}

legend {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--color-text-primary);
}

.checkbox-group {
  display: grid;
  gap: 12px;
}

.checkbox-option {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--color-surface-alt);
  padding: 12px 16px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--color-border-subtle);
}

.checkbox-option input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-highlight);
}

.form-submit {
  justify-self: flex-start;
  padding: 14px 28px;
  border-radius: var(--border-radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600;
  background: var(--color-text-primary);
  color: var(--color-button-text);
  transition: transform var(--transition-base), box-shadow var(--transition-base), border var(--transition-base);
}

.form-submit:hover,
.form-submit:focus-visible {
  transform: translateY(-2px);
  border-color: var(--color-border-strong);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
}

.status {
  margin-top: 28px;
  padding: 18px 22px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--color-border-subtle);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.status.success {
  border-color: rgba(76, 175, 80, 0.3);
  color: #b8f5c0;
}

.status.error {
  border-color: rgba(255, 99, 71, 0.35);
  color: #ffadad;
}

.result-card {
  margin-top: 48px;
  background: var(--color-surface);
  padding: 32px;
  border-radius: var(--border-radius-lg);
  border: 2px solid var(--color-border-subtle);
  display: grid;
  gap: 32px;
}

.result-card h2 {
  margin: 0;
}

.download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.download-button {
  padding: 12px 20px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  color: var(--color-text-primary);
  font-weight: 500;
  cursor: pointer;
  transition: transform var(--transition-base), border var(--transition-base);
}

.download-button:hover,
.download-button:focus-visible {
  transform: translateY(-2px);
  border-color: var(--color-border-strong);
}

.preview {
  padding: 24px;
  border-radius: var(--border-radius-md);
  background: rgba(16, 16, 16, 0.8);
  border: 1px solid var(--color-border-subtle);
  max-height: 540px;
  overflow: auto;
}

.preview .paragraph-block {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-border-subtle);
}

.preview .paragraph-block:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.preview h3 {
  margin-top: 0;
}

.preview hr {
  border: none;
  border-top: 1px solid var(--color-border-subtle);
  margin: 24px 0;
}

.paragraph-section {
  display: grid;
  gap: 16px;
}

.paragraph-section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.paragraph-section-title {
  display: grid;
  gap: 6px;
}

.paragraph-heading {
  font-weight: 600;
  color: var(--color-text-primary);
}

.field-help {
  display: block;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.add-paragraph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  font-weight: 600;
  transition: border var(--transition-base), transform var(--transition-base), background var(--transition-base);
}

.add-paragraph:hover,
.add-paragraph:focus-visible {
  transform: translateY(-2px);
  border-color: var(--color-border-strong);
  background: var(--color-fill-soft);
  color: var(--color-text-primary);
}

.paragraph-container {
  display: grid;
  gap: 16px;
}

.paragraph-card {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--border-radius-sm);
  padding: 18px;
  display: grid;
  gap: 10px;
}

.paragraph-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.paragraph-card-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.paragraph-card textarea {
  min-height: 160px;
  resize: vertical;
  line-height: 1.6;
}

.remove-paragraph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: border var(--transition-base), transform var(--transition-base), background var(--transition-base);
}

.remove-paragraph:hover,
.remove-paragraph:focus-visible {
  transform: rotate(6deg);
  border-color: var(--color-border-strong);
  background: var(--color-fill-soft);
  color: var(--color-text-primary);
}

.footer {
  margin: 0 auto 64px;
  padding: 18px 24px;
  background: var(--color-surface);
  border-radius: var(--border-radius-md);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  max-width: var(--max-width);
  width: calc(100% - 48px);
  text-align: center;
  line-height: 1.6;
}

@media (max-width: 720px) {
  main {
    padding: 56px 16px 80px;
  }

  form {
    padding: 24px;
  }

  .result-card {
    padding: 24px;
  }

  .download-actions {
    flex-direction: column;
  }

  .paragraph-card {
    padding: 16px;
  }

  .paragraph-card textarea {
    min-height: 140px;
  }
}


.result-card[hidden] {
  display: none !important;
}
