/* === Easy Read Generator — inspired by easy-read-online.co.uk === */
:root {
  --amber: #f7a823;
  --amber-light: rgba(255, 234, 182, 0.3);
  --teal: #04a4a9;
  --teal-dark: #038a8f;
  --black: #000000;
  --white: #ffffff;
  --gray-light: #fafafa;
  --gray-border: #e0e0e0;
  --error: #b00020;
  --font: 'FS Me', Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.5;
  color: var(--black);
  background: var(--white);
}

/* === Top amber bar === */
.top-bar {
  height: 6px;
  background: var(--amber);
}

/* === Header / Nav === */
.site-header {
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--gray-border);
}
.site-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--black);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.site-logo-icon {
  width: 36px;
  height: 36px;
  background: var(--amber);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.site-nav a {
  color: var(--black);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 600;
  margin-left: 2rem;
}
.site-nav a:hover { text-decoration: underline; }

/* === Hero section === */
.hero {
  padding: 3rem 2rem;
  max-width: 900px;
  margin: 0 auto;
}
.hero h1 {
  font-size: 2.8rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1.5rem;
}

/* === Main content === */
main {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem;
}

/* === Form page === */
.input-section {
  margin-top: 1rem;
}
.input-section h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 1rem;
}
label {
  display: block;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
textarea {
  width: 100%;
  padding: 1rem;
  font: inherit;
  font-size: 1.1rem;
  border: 2px solid var(--gray-border);
  border-radius: 8px;
  resize: vertical;
  min-height: 200px;
}
textarea:focus {
  outline: 3px solid var(--amber);
  border-color: var(--amber);
}
.char-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
  font-size: 0.95rem;
  color: #666;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2rem;
  font-family: var(--font);
  font-size: 1.1rem;
  font-weight: 700;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  min-height: 52px;
  min-width: 52px;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
}
.btn:focus-visible {
  outline: 3px solid var(--black);
  outline-offset: 3px;
}
.btn-primary {
  background: var(--black);
  color: var(--white);
}
.btn-primary:hover { background: #222; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  background: var(--teal);
  color: var(--white);
}
.btn-secondary:hover { background: var(--teal-dark); }
.btn-outline {
  background: transparent;
  color: var(--black);
  border: 2px solid var(--black);
}
.btn-outline:hover { background: var(--gray-light); }

.actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.actions-secondary {
  margin-top: 0.75rem;
}

/* === Status / loading === */
.status-msg {
  margin-top: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  min-height: 1.5em;
}
.status-msg.error { color: var(--error); }

/* === Loading spinner === */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--gray-border);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 0.5rem;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Results page === */
.results-header {
  padding: 2rem 0;
  border-bottom: 4px solid var(--amber);
  margin-bottom: 2rem;
}
.results-header h1 {
  font-size: 2.2rem;
  font-weight: 700;
}

/* Summary box */
.summary-box {
  background: var(--amber-light);
  border-left: 5px solid var(--amber);
  padding: 1.5rem;
  border-radius: 0 8px 8px 0;
  margin-bottom: 2.5rem;
  font-size: 1.15rem;
  line-height: 1.6;
}
.summary-box h2 {
  font-size: 1.3rem;
  margin-bottom: 0.75rem;
}

/* === Easy Read sentence rows — image left, text right === */
.er-section {
  margin-bottom: 2.5rem;
}
.er-section-heading {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--black);
  padding-bottom: 0.5rem;
  border-bottom: 3px solid var(--amber);
  margin-bottom: 1.5rem;
}

.er-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1.5rem;
  align-items: start;
  padding: 1rem 0;
  border-bottom: 1px solid var(--gray-border);
}
.er-row:last-child { border-bottom: none; }

.er-image-cell {
  width: 140px;
  height: 140px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--gray-light);
  border: 1px solid var(--gray-border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.er-image-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.er-image-placeholder {
  padding: 0.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: #888;
  font-style: italic;
  line-height: 1.3;
}
.er-image-placeholder::before {
  content: '🖼';
  display: block;
  font-size: 1.8rem;
  margin-bottom: 0.25rem;
  font-style: normal;
}

.er-text-cell {
  font-size: 1.25rem;
  line-height: 1.6;
  padding-top: 0.25rem;
  align-self: center;
}

/* === Amber section (like "What is Easy Read?" on reference site) === */
.amber-section {
  background: var(--amber);
  padding: 3rem 2rem;
  margin: 2rem -2rem;
}
.amber-section h2 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

/* === Teal section (feedback area on reference site) === */
.teal-section {
  background: var(--teal);
  color: var(--white);
  padding: 3rem 2rem;
  text-align: center;
}

/* === Footer === */
.site-footer {
  background: var(--amber-light);
  padding: 2rem;
  text-align: center;
  font-size: 0.95rem;
  border-top: 4px solid var(--amber);
}
.site-footer a {
  color: var(--black);
  text-decoration: underline;
}
.attribution {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: #555;
}

/* === Responsive === */
@media (max-width: 700px) {
  .hero h1 { font-size: 2rem; }
  .site-header { padding: 1rem; }
  .site-nav a { margin-left: 1rem; font-size: 0.9rem; }
  main { padding: 1rem; }
  .er-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .er-image-cell {
    width: 100%;
    height: 180px;
  }
  .amber-section, .teal-section { margin: 1rem -1rem; padding: 2rem 1rem; }
}

/* === Print === */
@media print {
  .top-bar, .site-header, .site-footer, .actions, .btn { display: none; }
  
  .results-header {
    border-bottom: 2px solid #000;
    margin-bottom: 1rem;
  }
  
  .summary-box {
    background: #f5f5f5;
    border-left: 3px solid #000;
    page-break-inside: avoid;
  }
  
  .er-section {
    page-break-inside: avoid;
    margin-bottom: 2rem;
  }
  
  .er-section-heading {
    border-bottom: 2px solid #000;
  }
  
  .er-row { 
    break-inside: avoid;
    page-break-inside: avoid;
    border-bottom: 1px solid #ddd;
  }
  
  .er-image-cell { 
    border: 1px solid #ccc;
    background: white;
  }
  
  .er-image-cell img {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  
  .er-text-cell {
    font-size: 14pt;
  }
}

/* === Focus and accessibility === */
*:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}
textarea:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 0;
}

/* === Copy status === */
.copy-status {
  font-size: 1rem;
  font-weight: 600;
  min-height: 1.5em;
  margin-top: 0.5rem;
}

/* === Support Modal === */
.support-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: fadeInOverlay 0.3s ease-in;
}
.support-modal-overlay.show {
  display: flex;
}
@keyframes fadeInOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

.support-modal {
  background: var(--white);
  border: 3px solid var(--amber);
  border-radius: 16px;
  padding: 2.5rem;
  max-width: 650px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  text-align: center;
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease-out;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.support-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}
.support-modal-close:hover {
  background: var(--gray-light);
  color: var(--black);
}
.support-modal-close:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.copy-confirmation {
  background: #4caf50;
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  display: inline-block;
}

.support-modal h3 {
  font-size: 1.6rem;
  margin-bottom: 1rem;
  color: var(--black);
}
.support-modal p {
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  color: #333;
}
.support-modal .bmc-btn-container {
  display: inline-block;
  margin-top: 0.5rem;
}
