:root {
  --bg: #ffffff;
  --text: #1a1a1a;
  --text-muted: #767676;
  --border: #e4e4e4;
  --accent: #1a1a1a;
  --accent-contrast: #ffffff;
  --success: #16a34a;
  --danger: #c0362c;
  --radius: 8px;
  --max-width: 720px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
}

svg {
  display: block;
  flex-shrink: 0;
}

.icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* Top navigation */
.site-header {
  border-bottom: 1px solid var(--border);
}

.nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}

.brand-logo {
  width: 24px;
  height: 24px;
  display: block;
}

.brand:hover {
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.88rem;
  padding: 6px 10px;
  border-radius: 6px;
}

.nav-links a:hover {
  color: var(--text);
  text-decoration: none;
}

.nav-links a.active {
  color: var(--text);
  background: var(--border);
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 10px;
  margin: -10px;
  cursor: pointer;
  color: var(--text);
}

@media (max-width: 640px) {
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    display: none;
    order: 3;
    width: 100%;
    flex-direction: column;
    gap: 2px;
    padding-top: 10px;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    width: 100%;
    padding: 10px 12px;
  }
}

/* Main layout */
main {
  padding: 40px 0 64px;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.page-subtitle {
  color: var(--text-muted);
  margin: 0 0 32px;
  font-size: 0.95rem;
}

/* Hero (home page) */
.hero {
  text-align: center;
  padding: 20px 0 8px;
}

.hero h1 {
  font-size: 1.7rem;
  font-weight: 600;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.hero p {
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto;
  font-size: 0.98rem;
}

/* Home tool list — flat rows, no card effect */
.tool-list {
  margin-top: 36px;
  border-top: 1px solid var(--border);
}

.tool-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.tool-row:hover {
  text-decoration: none;
}

.tool-row:hover .tool-title {
  text-decoration: underline;
}

.tool-row .icon {
  width: 26px;
  height: 26px;
  stroke-width: 1.4;
  color: var(--text);
}

.tool-row-text {
  flex: 1;
  min-width: 0;
}

.tool-title {
  font-weight: 600;
  font-size: 1.02rem;
  margin: 0 0 2px;
}

.tool-desc {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin: 0;
}

.tool-row .arrow {
  color: var(--text-muted);
  width: 18px;
  height: 18px;
}

/* Sections inside tool pages — plain, blend into background */
.section {
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
}

.section:last-of-type {
  border-bottom: none;
}


/* Form elements */
label {
  display: block;
  font-weight: 500;
  font-size: 0.85rem;
  margin-bottom: 6px;
  color: var(--text);
}

.field {
  margin-bottom: 16px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 480px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-field label {
  margin-bottom: 0;
}

input[type="text"],
input[type="number"],
input[type="url"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

input[type="color"] {
  width: 100%;
  height: 40px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

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

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--text);
}

.hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: opacity 0.15s ease;
  font-family: inherit;
}

.btn:active {
  opacity: 0.75;
}

.btn .icon {
  width: 16px;
  height: 16px;
}

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

.btn-primary:hover {
  opacity: 0.85;
  text-decoration: none;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover {
  border-color: var(--text);
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.btn-block {
  width: 100%;
}

/* Preview area */
.preview-box {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  padding: 4px 0 20px;
  text-align: center;
}

.preview-box canvas,
.preview-box svg,
.preview-box img {
  max-width: 100%;
}

/* Status messages */
.status {
  border-radius: var(--radius);
  padding: 9px 12px;
  font-size: 0.85rem;
  margin-top: 14px;
  display: none;
  border: 1px solid transparent;
}

.status.visible {
  display: block;
}

.status.info {
  color: var(--text-muted);
  border-color: var(--border);
}

.status.success {
  color: var(--success);
  border-color: var(--success);
}

.status.error {
  color: var(--danger);
  border-color: var(--danger);
}

/* Scanner specific */
#scanner-view {
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}

.result-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  word-break: break-word;
}

.result-box .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.result-box .value {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 0;
  margin-bottom: 12px;
}

.site-footer {
  text-align: center;
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 28px 20px 40px;
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 4px;
  margin-bottom: 14px;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 4px 10px;
}

.footer-links a:hover {
  color: var(--text);
  text-decoration: none;
}

.footer-copyright {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 0;
}

/* Article meta + CTA box (blog posts) */
.article-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0 0 8px;
}

.blog-cta {
  margin-top: 8px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.blog-cta h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 600;
}

.blog-cta p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 0 0 18px;
}

/* Blog carousel, shown at the bottom of every page */
.blog-carousel-section {
  margin-top: 24px;
  padding-top: 36px;
  border-top: 1px solid var(--border);
}

.blog-carousel-section h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 18px;
}

.blog-carousel-track {
  display: flex;
  flex-direction: column;
}

.blog-carousel-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.blog-carousel-item:last-child {
  border-bottom: none;
}

.blog-carousel-item:hover {
  text-decoration: none;
}

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

.blog-item-title {
  font-weight: 600;
  font-size: 0.92rem;
  margin: 0 0 6px;
  line-height: 1.4;
}

.blog-item-desc {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.5;
  margin: 0;
}

.view-all-link {
  display: inline-block;
  margin-top: 18px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

/* Long-form SEO content blocks */
.content-block {
  margin-top: 24px;
  padding-top: 36px;
  border-top: 1px solid var(--border);
}

.content-block h2 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 32px 0 12px;
}

.content-block h2:first-child {
  margin-top: 0;
}

.content-block p {
  margin: 0 0 16px;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.7;
  max-width: 68ch;
}

/* FAQ accordion */
.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}

.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.98rem;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  color: var(--text-muted);
  font-weight: 400;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.faq-item[open] summary::after {
  content: "\2212";
}

.faq-item p {
  margin: 12px 0 0;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.7;
  max-width: 68ch;
}

/* Options popup */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-overlay.visible {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 380px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
}

.modal-close:hover {
  color: var(--text);
}

@media (max-width: 480px) {
  .nav {
    justify-content: center;
    text-align: center;
  }
}
