/* ==========================================================================
   2RE Club — custom styles on top of Bootstrap 5
   Brand: emerald accent (#10b981 / #059669) on dark slate (#0f172a)
   ========================================================================== */

:root {
  --brand: #10b981;            /* emerald accent — borders, icons, highlights */
  --brand-dark: #059669;       /* emerald 600 — buttons, stat values */
  --brand-darker: #047857;     /* emerald 700 — hover states */
  --brand-deep: #0f172a;       /* dark slate — header, footer, hero */
  --brand-ink: #1e293b;        /* body text */
  --brand-muted: #64748b;      /* secondary text */
  --brand-bg: #f8fafc;         /* page background */
  --brand-border: #e2e8f0;     /* card borders */
}

html,
body {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background-color: var(--brand-bg);
  color: var(--brand-ink);
}

main {
  flex: 1 0 auto;
}

/* --- Header & footer (shared colour scheme) ------------------------------ */

.site-header {
  background-color: var(--brand-deep);
  /* Compact header: trim Bootstrap's default navbar padding (0.5rem). */
  padding-top: 0.3rem;
  padding-bottom: 0.3rem;
}

.site-header .navbar-brand {
  color: #fff;
  font-weight: 600;
  font-size: 1.15rem;
  padding-top: 0;
  padding-bottom: 0;
}

.site-header .navbar-brand:hover,
.site-header .navbar-brand:focus {
  color: var(--brand);
}

.site-header .nav-link {
  color: rgba(255, 255, 255, 0.8);
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

.site-header .nav-link:hover,
.site-header .nav-link:focus,
.site-header .nav-link.active {
  color: var(--brand);
}

/* 2RE Club logo chip — keeps the charcoal cog visible on the dark header */
.site-header .brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 1px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.3);
}

/* Compact header — smaller hamburger button on mobile */
.site-header .navbar-toggler {
  padding: 0.25rem 0.5rem;
  font-size: 1rem;
}

.site-header .brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.site-footer {
  background-color: var(--brand-deep);
  margin-top: auto;
}

.footer-link {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
}

.footer-link:hover,
.footer-link:focus {
  color: var(--brand);
}

/* --- Buttons -------------------------------------------------------------- */

.btn-brand {
  background-color: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
  font-weight: 600;
}

.btn-brand:hover,
.btn-brand:focus {
  background-color: var(--brand-darker);
  border-color: var(--brand-darker);
  color: #fff;
}

/* --- Homepage hero -------------------------------------------------------- */

.hero {
  color: #fff;
  background:
    radial-gradient(900px 380px at 85% -10%, rgba(16, 185, 129, 0.28), transparent 60%),
    linear-gradient(160deg, #0f172a 0%, #14213d 55%, #0f172a 100%);
}

.badge-brand {
  background-color: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.45);
  font-weight: 500;
  letter-spacing: 0.03em;
}

/* 2RE Club cog logo on a light card so it stands out against the hero */
.hero-logo {
  display: inline-block;
  background: #fff;
  border-radius: 1.5rem;
  padding: 1.25rem;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.35);
}

.hero-logo img {
  display: block;
  width: 220px;
  height: auto;
  max-width: 100%;
}

/* --- Tool cards ----------------------------------------------------------- */

.tool-card {
  background: #fff;
  border: 1px solid var(--brand-border);
  border-radius: 1rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
  border-color: var(--brand);
}

.tool-icon {
  width: 48px;
  height: 48px;
  border-radius: 0.75rem;
  background: rgba(16, 185, 129, 0.12);
  color: var(--brand-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.tool-card.coming-soon .tool-icon {
  background: #e2e8f0;
  color: var(--brand-muted);
}

/* --- Word counter --------------------------------------------------------- */

textarea#textInput {
  min-height: 320px;
  resize: vertical;
  font-size: 0.95rem;
  line-height: 1.6;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--brand-border);
  border-radius: 0.75rem;
  padding: 1rem 0.75rem;
  height: 100%;
  text-align: center;
}

.stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--brand-dark);
  line-height: 1.2;
}

.stat-card .stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand-muted);
}

.insight-box {
  background: #fff;
  border: 1px solid var(--brand-border);
  border-radius: 0.75rem;
  padding: 1.25rem;
  height: 100%;
}

.insight-box .insight-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--brand-ink);
}

.insight-box .insight-sub {
  font-size: 0.85rem;
  color: var(--brand-muted);
}

.progress {
  height: 8px;
  background-color: var(--brand-border);
}

.keywords-list .list-group-item {
  border-left: 0;
  border-right: 0;
  padding-left: 0;
  padding-right: 0;
}

/* --- Accessibility -------------------------------------------------------- */

a:focus-visible,
button:focus-visible,
.form-control:focus,
.form-check-input:focus {
  outline: 3px solid rgba(16, 185, 129, 0.45);
  outline-offset: 2px;
}

/* --- Responsive tweaks ---------------------------------------------------- */

@media (max-width: 575.98px) {
  textarea#textInput {
    min-height: 220px;
  }

  .stat-card .stat-value {
    font-size: 1.25rem;
  }

  .insight-box .insight-value {
    font-size: 1.15rem;
  }
}

/* --- Open Graph viewer --------------------------------------------------- */

.og-platform {
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
}

.og-platform-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand-muted);
  margin-bottom: 0.5rem;
}

.og-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

[data-platform="facebook"] .og-dot { background: #1877f2; }
[data-platform="x"] .og-dot { background: #111; }
[data-platform="linkedin"] .og-dot { background: #0a66c2; }

.og-card {
  background: #fff;
  border: 1px solid var(--brand-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  width: 100%;
}

.og-card-image {
  position: relative;
  width: 100%;
  aspect-ratio: 1.91 / 1;
  background: #eef2f7;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--brand-muted);
}

.og-card-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.og-card-image-empty svg {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
}

.og-card-image-empty span {
  font-size: 0.8rem;
}

.og-card-image-error::after {
  content: attr(data-fallback);
  font-size: 0.8rem;
}

.og-card-body {
  padding: 0.8rem 1rem 1rem;
}

.og-card-domain {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #65676b;
  margin-bottom: 0.25rem;
}

.og-card-title {
  font-size: 1.02rem;
  font-weight: 600;
  color: #1c1e21;
  line-height: 1.35;
  margin-bottom: 0.3rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.og-card-desc {
  font-size: 0.85rem;
  color: #4b4f56;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Platform-specific tweaks so the three cards read differently. */
[data-platform="x"] .og-card-domain {
  text-transform: none;
  font-weight: 400;
  letter-spacing: 0;
  color: #536471;
}

[data-platform="linkedin"] .og-card-title {
  font-size: 0.95rem;
}

[data-platform="linkedin"] .og-card-domain {
  color: #0a66c2;
}

/* X "summary" small card — image left, text right. */
.og-summary-row {
  display: flex;
  align-items: stretch;
}

.og-summary-row .og-summary-image {
  flex: 0 0 40%;
  max-width: 40%;
}

.og-summary-row .og-card-image {
  aspect-ratio: auto;
  height: 100%;
  min-height: 120px;
}

.og-summary-row .og-card-body {
  padding: 0.7rem 0.9rem 0.9rem;
}

/* Warnings panel */
.og-warning-item {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}

.og-warning-icon {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  margin-top: 0.15rem;
}

.og-warning-icon.error { background: #dc2626; }
.og-warning-icon.warning { background: #d97706; }
.og-warning-icon.info { background: #2563eb; }

.meta-key {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
}

.snippet-text {
  font-size: 0.8rem;
  min-height: 180px;
  resize: vertical;
  white-space: pre;
  overflow-x: auto;
}

@media (max-width: 575.98px) {
  .og-card-title {
    font-size: 0.95rem;
  }

  .og-card-body {
    padding: 0.7rem 0.8rem 0.85rem;
  }
}



/* --- OCR tool ----------------------------------------------------------- */

.ocr-dropzone {
  border: 2px dashed var(--brand-border);
  border-radius: 0.75rem;
  background: #fbfdfe;
  color: var(--brand-muted);
  text-align: center;
  padding: 2.5rem 1.5rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.ocr-dropzone:hover,
.ocr-dropzone:focus-visible,
.ocr-dropzone.dragover {
  border-color: var(--brand);
  background: rgba(16, 185, 129, 0.06);
  color: var(--brand-dark);
}

.ocr-preview {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  background: #f1f5f9;
  border-radius: 0.5rem;
}

textarea.ocr-text {
  min-height: 220px;
  resize: vertical;
  font-size: 0.9rem;
  line-height: 1.55;
}

/* --- Secret area (password-protected pages) ----------------------------- */

.secret-body {
  background:
    radial-gradient(800px 400px at 80% -10%, rgba(16, 185, 129, 0.2), transparent 60%),
    linear-gradient(160deg, #0f172a 0%, #14213d 60%, #0f172a 100%);
}

.secret-main {
  flex: 1 0 auto;
  display: flex;
  align-items: center;
  min-height: 100vh;
  padding: 2rem 0;
}

.secret-card {
  background: #fff;
  border: 0;
  border-radius: 1rem;
}

.secret-lock {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.12);
  color: var(--brand-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.secret-topbar {
  background: rgba(15, 23, 42, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.secret-thumb-wrap {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #eef2f7;
  overflow: hidden;
}

.secret-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #eef2f7;
}

.ocr-sidecar {
  white-space: pre-wrap;
  word-break: break-word;
  background: #f8fafc;
  border: 1px solid var(--brand-border);
  border-radius: 0.5rem;
  padding: 0.75rem;
  max-height: 220px;
  overflow-y: auto;
}

/* --- Color picker & shades of green -------------------------------------- */

/* Picker fields keep their values in a monospace face. */
.color-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Large swatch the selected color is painted onto (background set by JS). */
.live-panel {
  background-color: #3a6ea5;
  border-radius: 0.75rem;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem 1.25rem;
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.12s linear, box-shadow 0.15s ease;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06), 0 6px 18px rgba(15, 23, 42, 0.12);
}

.live-panel:hover,
.live-panel:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35), 0 10px 24px rgba(15, 23, 42, 0.18);
  outline: 3px solid rgba(16, 185, 129, 0.45);
  outline-offset: 2px;
}

.live-text {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #fff; /* script flips this between white and black */
  text-shadow: 0 1px 4px rgba(15, 23, 42, 0.3);
  word-break: break-word;
  pointer-events: none;
}

.current-hex-code {
  display: inline-block;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 999px;
  padding: 0.3rem 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--brand-ink);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.15);
  pointer-events: none;
}

/* Shades of green grid swatches. */
.color-square {
  width: 190px;
  height: 190px;
  margin: 0.2rem;
  border: 1px solid rgba(15, 23, 42, 0.18);
  border-radius: 0.5rem;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 0.55rem 0.6rem;
  box-sizing: border-box;
  cursor: default;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}

.color-square .name {
  font-weight: 700;
  font-size: 0.74rem;
  line-height: 1.25;
  color: #fff;
  text-shadow: 0 0 6px rgba(15, 23, 42, 0.95), 0 0 3px rgba(15, 23, 42, 0.8);
  margin-bottom: 2px;
  word-break: break-word;
}

.color-square .info {
  font-size: 0.6rem;
  line-height: 1.4;
  color: #fff;
  text-shadow: 0 0 6px rgba(15, 23, 42, 0.95), 0 0 3px rgba(15, 23, 42, 0.8);
}

.color-square .info span {
  display: block;
}

@media (max-width: 575.98px) {
  .live-panel {
    min-height: 190px;
  }

  .live-text {
    font-size: 0.95rem;
  }

  .color-square {
    width: 46%;
    height: auto;
    aspect-ratio: 1;
  }
}

/* --- Tech stack detective ------------------------------------------------ */

.tech-category {
  background: #fff;
  border: 1px solid var(--brand-border);
  border-radius: 1rem;
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}

.tech-category-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand-muted);
  margin-bottom: 0.65rem;
}

.tech-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tech-item {
  border: 1px solid var(--brand-border);
  border-radius: 0.75rem;
  padding: 0.5rem 0.7rem;
  background: var(--brand-bg);
  max-width: 100%;
}

.tech-name {
  font-weight: 600;
  color: var(--brand-ink);
  text-decoration: none;
}

a.tech-name:hover,
a.tech-name:focus {
  color: var(--brand-darker);
  text-decoration: underline;
}

/* Strong-signal items (header / cookie / generator match) get an emerald edge. */
.tech-confidence-high {
  border-color: rgba(16, 185, 129, 0.55);
  background: rgba(16, 185, 129, 0.06);
}

.tech-confidence-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: #cbd5e1;
}

.tech-confidence-high .tech-confidence-dot {
  background: var(--brand);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}

.tech-evidence-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.4rem;
}

.tech-evidence {
  font-size: 0.68rem;
  line-height: 1.4;
  color: var(--brand-muted);
  background: #fff;
  border: 1px solid var(--brand-border);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  white-space: nowrap;
}

/* --- URL encoder / decoder ---------------------------------------------- */

/* Segmented Encode/Decode and Component/Full URL toggles. */
.btn-check:checked + .btn-toggle {
  background-color: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}

.btn-check:focus-visible + .btn-toggle {
  box-shadow: 0 0 0 0.25rem rgba(16, 185, 129, 0.35);
}

.encoder-input {
  min-height: 190px;
  font-size: 0.85rem;
  resize: vertical;
}

/* --- Web page editor ---------------------------------------------------- */

.editor-toolbar {
  border: 1px solid var(--brand-border);
  border-radius: 0.75rem;
  padding: 0.5rem;
  background: #fff;
}

.editor-block-select {
  width: auto;
  min-width: 9rem;
}

.editor-frame {
  display: block;
  width: 100%;
  height: 72vh;
  min-height: 460px;
  border: 1px solid var(--brand-border);
  border-radius: 0.75rem;
  background: #fff;
}

/* --- Blog (Writing) ----------------------------------------------------- */

.blog-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.blog-card-media {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #eef2f7;
}

.blog-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.blog-title-link {
  color: inherit;
  text-decoration: none;
}

.blog-title-link:hover,
.blog-title-link:focus {
  color: var(--brand-darker);
  text-decoration: underline;
}

.blog-hero {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.75rem;
  margin-bottom: 1.5rem;
}

/* Rendered Markdown */
.blog-content {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--brand-ink);
}

.blog-content > *:first-child {
  margin-top: 0;
}

.blog-content h2 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-size: 1.4rem;
  font-weight: 700;
}

.blog-content h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.6rem;
  font-size: 1.2rem;
  font-weight: 700;
}

.blog-content p {
  margin-bottom: 1rem;
}

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

.blog-content li {
  margin-bottom: 0.35rem;
}

.blog-content blockquote {
  border-left: 4px solid var(--brand);
  background: var(--brand-bg);
  margin: 1.5rem 0;
  padding: 0.75rem 1.15rem;
  color: var(--brand-muted);
}

.blog-content blockquote p:last-child {
  margin-bottom: 0;
}

.blog-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: #eef2f7;
  border: 1px solid var(--brand-border);
  border-radius: 0.35rem;
  padding: 0.1rem 0.35rem;
}

.blog-content pre {
  background: var(--brand-deep);
  color: #e2e8f0;
  border-radius: 0.75rem;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  margin: 1.25rem 0;
}

.blog-content pre code {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font-size: 0.85rem;
  line-height: 1.6;
}

.blog-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
}

.blog-content table {
  width: 100%;
  margin: 1.25rem 0;
  border-collapse: collapse;
}

.blog-content th,
.blog-content td {
  border: 1px solid var(--brand-border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.blog-content th {
  background: var(--brand-bg);
}

.blog-content hr {
  margin: 2rem 0;
}

.blog-content a {
  color: var(--brand-darker);
}

/* --- Markdown previewer ------------------------------------------------ */

.markdown-input {
  min-height: 480px;
  font-size: 0.85rem;
  resize: vertical;
}

.markdown-preview {
  display: block;
  width: 100%;
  height: 540px;
  border: 1px solid var(--brand-border);
  border-radius: 0.75rem;
  background: #fff;
}

@media (max-width: 991.98px) {
  .markdown-preview {
    height: 420px;
  }
}

/* --- Spell check pad ---------------------------------------------------- */

.spell-input {
  min-height: 420px;
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
}

.spell-findings {
  max-height: 480px;
  overflow-y: auto;
}

.spell-finding {
  cursor: pointer;
}

.spell-finding-type {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand-ink);
}

.spell-finding-excerpt {
  display: block;
  font-size: 0.78rem;
  color: var(--brand-muted);
  word-break: break-word;
}
