/* ====================================================
   GrammarMama — styles.css
   Theme: warm beige + chalkboard green
   ==================================================== */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Patrick+Hand&display=swap');

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --beige:        #f0e6d3;
  --beige-dark:   #e4d4bc;
  --beige-darker: #d4bfa0;
  --chalk-bg:     #2d3a2d;
  --chalk-text:   #e8e8e0;
  --chalk-frame:  #8b7355;
  --accent:       #6b8e6b;
  --accent-dark:  #4d6b4d;
  --btn-bg:       #8b6b4a;
  --btn-hover:    #6b4f35;
  --error-red:    #c0392b;
  --error-bg:     #fdecea;
  --ok-green:     #27ae60;
  --ok-bg:        #eafaf1;
  --text-main:    #3a2e22;
  --text-muted:   #7a6a55;
  --card-bg:      #fdf8f2;
  --border:       #d4bfa0;
  --shadow:       rgba(58, 46, 34, 0.12);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background-color: var(--beige);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.3; }

/* ---------- Layout ---------- */
.site-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

/* ---------- Header / Brand ---------- */
.site-header {
  text-align: center;
  padding: 1.5rem 1.25rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.brand-name {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent-dark);
  letter-spacing: -0.5px;
}

/* ---------- Hero Section ---------- */
.hero {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  margin: 2rem 0 0;
}

/* --- Mascot sidebar --- */
.mascot-col {
  flex: 0 0 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.mascot-img {
  width: 140px;
  height: auto;
  border-radius: 8px;
}

.lang-sidebar {
  width: 100%;
}

.lang-sidebar-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-align: center;
}

.lang-pill-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.lang-pill {
  display: block;
  width: 100%;
  padding: 0.3rem 0.6rem;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.lang-pill:hover {
  background: var(--beige-dark);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.lang-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* --- Chalkboard column --- */
.chalkboard-col {
  flex: 1;
  min-width: 0;
}

.chalkboard {
  background: var(--chalk-bg);
  border: 4px solid var(--chalk-frame);
  border-radius: 8px;
  padding: 1.25rem;
  box-shadow:
    inset 0 1px 4px rgba(0,0,0,0.4),
    0 4px 16px rgba(0,0,0,0.25);
  position: relative;
}

/* chalk dust effect at top */
.chalkboard::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 10%;
  right: 10%;
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(220,215,200,0.3) 20%, rgba(220,215,200,0.5) 50%, rgba(220,215,200,0.3) 80%, transparent);
  border-radius: 2px;
}

.chalkboard textarea {
  width: 100%;
  min-height: 180px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--chalk-text);
  font-family: 'Patrick Hand', 'Comic Sans MS', cursive, sans-serif;
  font-size: 1.1rem;
  line-height: 1.65;
  resize: vertical;
  caret-color: var(--chalk-text);
}

.chalkboard textarea::placeholder {
  color: rgba(232,232,224,0.4);
}

.char-counter {
  text-align: right;
  font-size: 0.78rem;
  color: rgba(232,232,224,0.5);
  margin-top: 0.4rem;
}

.char-counter.near-limit { color: #f0c040; }
.char-counter.over-limit { color: #e05050; }

/* --- Below chalkboard: controls --- */
.check-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.lang-select-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 180px;
}

.lang-select-wrap label {
  font-size: 0.875rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.lang-select-wrap select {
  flex: 1;
  padding: 0.4rem 0.6rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text-main);
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-primary {
  padding: 0.55rem 1.5rem;
  background: var(--btn-bg);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn-primary:hover { background: var(--btn-hover); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.terms-note {
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.terms-note a { color: var(--text-muted); text-decoration: underline; }

/* ---------- Spinner ---------- */
.spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--btn-bg);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: 0.5rem;
}

.spinner.visible { display: inline-block; }

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

/* ---------- Error Banner ---------- */
.error-banner {
  display: none;
  background: var(--error-bg);
  border: 1px solid #f5c6c2;
  color: var(--error-red);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-top: 1rem;
  font-size: 0.9rem;
}
.error-banner.visible { display: block; }

/* ---------- Results Section ---------- */
.results-section {
  display: none;
  margin-top: 2rem;
}
.results-section.visible { display: block; }

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.result-box {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}

.result-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.result-box-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.btn-copy {
  padding: 0.25rem 0.7rem;
  font-size: 0.78rem;
  background: var(--beige-dark);
  border: 1.5px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-main);
  transition: background 0.15s;
}
.btn-copy:hover { background: var(--beige-darker); }

.result-text {
  font-size: 0.95rem;
  line-height: 1.65;
  word-break: break-word;
}

/* highlighted errors */
.result-text b.err {
  color: var(--error-red);
  font-weight: 700;
}

/* ---------- Issues List ---------- */
.issues-section { margin-top: 1rem; }

.issues-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.75rem;
}

.no-issues {
  background: var(--ok-bg);
  border: 1px solid #a8e6c0;
  color: var(--ok-green);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
}

.issue-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.issue-card {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  padding: 0.85rem 1rem;
}

.issue-card.type-spelling       { border-left-color: #e74c3c; }
.issue-card.type-punctuation    { border-left-color: #e67e22; }
.issue-card.type-capitalization { border-left-color: #f1c40f; }
.issue-card.type-tense,
.issue-card.type-subject_verb_agreement { border-left-color: #9b59b6; }
.issue-card.type-foreign_word,
.issue-card.type-foreign_phrase { border-left-color: #3498db; }
.issue-card.type-style,
.issue-card.type-redundancy,
.issue-card.type-wordiness,
.issue-card.type-passive_voice  { border-left-color: #95a5a6; }

.issue-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}

.issue-original {
  font-size: 0.9rem;
  color: var(--error-red);
  text-decoration: line-through;
}

.issue-arrow { color: var(--text-muted); font-size: 0.85rem; }

.issue-suggestion {
  font-size: 0.9rem;
  color: var(--ok-green);
  font-weight: 600;
}

.issue-type-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  background: var(--beige-dark);
  color: var(--text-muted);
  margin-left: auto;
  white-space: nowrap;
}

.issue-explanation {
  font-size: 0.875rem;
  color: var(--text-main);
  margin-top: 0.3rem;
}

/* ---------- Section Dividers ---------- */
.section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1.5px solid var(--beige-darker);
}

.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 1.25rem;
  text-align: center;
}

/* ---------- Feedback Form ---------- */
.feedback-form {
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
}

.feedback-form .form-group {
  margin-bottom: 1rem;
}

.feedback-form label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-main);
}

.liked-buttons {
  display: flex;
  gap: 0.75rem;
}

.btn-liked {
  flex: 1;
  padding: 0.6rem 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.btn-liked:hover {
  border-color: var(--accent);
}

.btn-liked.active {
  border-color: var(--accent);
  background: var(--ok-bg);
  color: var(--ok-green);
  font-weight: 600;
}

.feature-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.feature-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: normal;
  cursor: pointer;
}

.feature-checkbox-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
  cursor: pointer;
}

.feedback-form select,
.feedback-form textarea {
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text-main);
  font-size: 0.9rem;
  font-family: inherit;
}

.feedback-form textarea {
  min-height: 80px;
  resize: vertical;
}

.feedback-form select:focus,
.feedback-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* ---------- Contact & Newsletter Forms ---------- */
.contact-form,
.newsletter-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 480px;
  margin: 0 auto;
}

.contact-form input,
.contact-form textarea,
.newsletter-form input {
  padding: 0.55rem 0.8rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: inherit;
}

.contact-form input:focus,
.contact-form textarea:focus,
.newsletter-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.contact-form textarea {
  min-height: 100px;
  resize: vertical;
}

.feedback-form .btn-primary,
.contact-form .btn-primary,
.newsletter-form .btn-primary {
  align-self: center;
}

#feedback p, #newsletter p, #contact p {
  text-align: center;
}

.form-msg {
  font-size: 0.875rem;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  display: none;
}
.form-msg.success { background: var(--ok-bg); color: var(--ok-green); border: 1px solid #a8e6c0; display: block; }
.form-msg.error   { background: var(--error-bg); color: var(--error-red); border: 1px solid #f5c6c2; display: block; }

/* ---------- Footer ---------- */
footer {
  background: #3a2e22;
  color: #c8b89a;
  padding: 1.25rem 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  margin-top: 4rem;
}

footer a {
  color: #c8b89a;
  margin: 0 0.4rem;
}

footer a:hover { color: #fff; }

.lang-switcher {
  margin-top: 0.6rem;
  font-size: 0.8rem;
}

.lang-active {
  font-weight: 700;
  color: #fff;
}

/* ---------- Blog / Content Pages ---------- */
.content-page { padding: 2rem 1.25rem 4rem; }

.content-container {
  max-width: 720px;
  margin: 0 auto;
}

.blog-post-nav {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.back-to-blog { color: var(--text-muted); }

.blog-post-cta {
  font-weight: 600;
  color: var(--accent-dark);
}

.post-date {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.post-hero-image {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 2rem;
}

.post-content {
  line-height: 1.8;
  font-size: 1.05rem;
}

.post-content p {
  margin-bottom: 1.25rem;
}

.post-content h2 {
  font-size: 1.3rem;
  color: var(--accent-dark);
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}

.post-content h3 {
  font-size: 1.1rem;
  color: var(--text-main);
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

.post-content ul,
.post-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}

.post-content li {
  margin-bottom: 0.5rem;
}

.post-content strong {
  color: var(--text-main);
}

.post-content em {
  color: var(--text-muted);
}

.blog-posts {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1rem;
}

.blog-post {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}

.blog-post a {
  text-decoration: none;
  color: inherit;
}

.blog-post h3 {
  color: var(--accent-dark);
  margin-bottom: 0.25rem;
}

.blog-post h3:hover { text-decoration: underline; }

/* ---------- Blog Tiles (home page) ---------- */
.blog-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

@media (max-width: 640px) {
  .blog-tiles { grid-template-columns: 1fr; }
}

.blog-tile {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s;
}

.blog-tile:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.08); }

.blog-tile-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}

.blog-tile-title {
  padding: 0.75rem;
  font-weight: 600;
  color: var(--accent-dark);
  font-size: 0.95rem;
  line-height: 1.3;
}

.blog-tile:hover .blog-tile-title { text-decoration: underline; }

.blog-view-all {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.9rem;
}

/* ---------- Legal Pages ---------- */
.legal-content h2 {
  font-size: 1.1rem;
  color: var(--text-main);
  margin: 1.5rem 0 0.5rem;
}

.legal-content p { margin-bottom: 0.75rem; font-size: 0.95rem; }

.legal-content ul {
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.legal-content ul li { margin-bottom: 0.3rem; }

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
  .hero {
    flex-direction: column;
    align-items: center;
  }

  .mascot-col {
    flex: unset;
    width: 100%;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
  }

  .mascot-img { width: 80px; }

  .lang-sidebar { flex: 1; }

  .lang-pill-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.3rem;
  }

  .lang-pill { width: auto; }

  .chalkboard-col { width: 100%; }

  .check-controls { flex-direction: column; align-items: stretch; }

  .lang-select-wrap { min-width: unset; }

  .btn-primary { width: 100%; }

  .results-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .site-main { padding: 1rem 1rem 3rem; }
  .hero { margin-top: 1rem; }
  .brand-name { font-size: 1.3rem; }
}
