/* ==========================================================================
   ToolFlect SEO Tools — styles.css
   Meta Tag Generator & Social Media Previewer.
   Shares the ToolFlect design system used across image-tools & pdf-tools.
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --brand: #5b5ce2;
  --brand-600: #4a4bd0;
  --brand-050: #eef0ff;
  --ink: #111827;
  --ink-soft: #374151;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --good: #16a34a;
  --good-bg: #ecfdf5;
  --bad: #dc2626;
  --bad-bg: #fef2f2;
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 10px 30px rgba(16, 24, 40, .08);
  --shadow-lg: 0 24px 60px rgba(16, 24, 40, .14);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(180deg, #f7f8ff 0%, #ffffff 260px);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }

.container { width: min(1080px, 100% - 2rem); margin-inline: auto; }

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .82); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20; }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: .55rem; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand__mark { color: var(--brand); font-size: 1.35rem; line-height: 1; }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__name { font-size: 1.05rem; font-weight: 700; }
.brand__tag { font-size: .7rem; color: var(--muted); font-weight: 500; letter-spacing: .02em; }

/* ---------- Hero ---------- */
.hero { padding: 3.25rem 0 2rem; text-align: center; }
.breadcrumb { display: flex; gap: .4rem; justify-content: center; align-items: center; font-size: .82rem; color: var(--muted); margin-bottom: 1.25rem; }
.breadcrumb a { color: var(--muted); }
.crumb-sep { color: var(--line-strong); }
.hero__title { font-size: clamp(1.9rem, 4vw, 3rem); font-weight: 800; letter-spacing: -.02em; margin-bottom: .75rem; }
.hero__subtitle { max-width: 680px; margin: 0 auto 1.5rem; color: var(--ink-soft); font-size: 1.06rem; }
.hero__actions { margin-bottom: 1.5rem; }
.hero__trust { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; justify-content: center; padding: 0; margin: 0; color: var(--muted); font-size: .88rem; }

/* ---------- Tool card ---------- */
.tool-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.75rem; margin: .75rem 0 3rem; }
.tool-card__head { margin-bottom: 1.25rem; }
.tool-card__title { font-size: 1.4rem; }
.tool-card__sub { color: var(--muted); margin: 0; font-size: .95rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1.1rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, opacity .15s ease, transform .05s ease;
}
.btn:hover { background: var(--surface-soft); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--brand-600); }
.btn--lg { padding: .85rem 1.6rem; font-size: 1rem; }
.btn--sm { padding: .4rem .7rem; font-size: .82rem; }
.btn--success { background: var(--good); border-color: var(--good); color: #fff; }
.btn--success:hover:not(:disabled) { background: #128a3c; }

/* ---------- Fields / toolbar ---------- */
.toolbar__row { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: .4rem; min-width: 180px; }
.field__label { font-size: .8rem; font-weight: 600; color: var(--ink-soft); display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.field__counter { font-weight: 700; font-variant-numeric: tabular-nums; }
.field__counter.is-good { color: var(--good); }
.field__counter.is-warn { color: var(--amber); }
.field__counter.is-over { color: var(--bad); }
.field__hint { font-size: .76rem; color: var(--muted); }
.field__hint.is-warn { color: var(--amber); }
.field__hint.is-over { color: var(--bad); }
.select, .input {
  font: inherit; font-size: .92rem; color: var(--ink);
  padding: .55rem .75rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); width: 100%;
}
.select:focus, .input:focus { outline: 2px solid var(--brand-050); border-color: var(--brand); }
.input--area { resize: vertical; min-height: 76px; line-height: 1.5; }

/* ---------- SEO sections ---------- */
.seo-section { margin: 3rem 0; }
.seo-section__title { font-size: 1.5rem; font-weight: 800; letter-spacing: -.01em; margin-bottom: 1.25rem; }

.ht-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.ht-step { display: flex; gap: 1rem; align-items: flex-start; }
.ht-step__num { flex: 0 0 auto; width: 2rem; height: 2rem; border-radius: 999px; background: var(--brand-050); color: var(--brand-600); font-weight: 800; display: grid; place-items: center; margin-top: .1rem; }
.ht-step__title { margin: 0 0 .15rem; font-size: 1.02rem; }
.ht-step__text { margin: 0; color: var(--ink-soft); font-size: .92rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.comparison-table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 480px; }
.comparison-table th, .comparison-table td { text-align: left; padding: .7rem .9rem; border-bottom: 1px solid var(--line); }
.comparison-table thead th { background: var(--surface-soft); font-weight: 700; color: var(--ink-soft); white-space: nowrap; }
.comparison-table tbody tr:last-child th, .comparison-table tbody tr:last-child td { border-bottom: none; }
.comparison-table tbody th { font-weight: 600; color: var(--ink); }

.faq-list { display: flex; flex-direction: column; gap: .6rem; }
.faq-item { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; }
.faq-item__q { cursor: pointer; padding: .85rem 1rem; font-weight: 600; font-size: .95rem; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq-item__q::after { content: "+"; font-size: 1.2rem; color: var(--brand); transition: transform .15s ease; }
.faq-item[open] .faq-item__q::after { transform: rotate(45deg); }
.faq-item__a { padding: 0 1rem 1rem; color: var(--ink-soft); font-size: .9rem; }

.related-tools { display: flex; flex-wrap: wrap; gap: .6rem; }
.rt-chip { display: inline-block; padding: .5rem .9rem; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-soft); font-size: .85rem; font-weight: 500; transition: border-color .15s ease, background .15s ease; }
.rt-chip:hover { border-color: var(--brand); background: var(--brand-050); text-decoration: none; }

/* ---------- Tools directory grid ---------- */
.tools-directory { margin-top: 3rem; }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem; margin-top: 1rem; }
.tools-grid__card { display: flex; flex-direction: column; gap: .25rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); text-decoration: none; box-shadow: var(--shadow-sm); transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.tools-grid__card:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: var(--shadow); text-decoration: none; }
.tools-grid__card strong { font-size: .92rem; }
.tools-grid__card small { font-size: .76rem; color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 3rem; padding: 1.75rem 0; color: var(--muted); font-size: .85rem; text-align: center; }
.site-footer__nav { display: flex; flex-wrap: wrap; gap: 1.25rem; justify-content: center; margin-bottom: .75rem; font-weight: 500; }
.site-footer__nav a { color: var(--ink-soft); }
.site-footer__nav a:hover { color: var(--brand); }
.site-footer__nav--legal { font-size: .8rem; gap: 1rem; }
.site-footer__nav--legal a { color: var(--muted); }

/* ---------- Meta tag tool: split-screen layout ---------- */
.mt-layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 1.5rem;
  align-items: start;
}
.mt-inputs { display: flex; flex-direction: column; gap: 1rem; }
.mt-preview { display: flex; flex-direction: column; gap: 1.25rem; }
.mt-preview__section { background: var(--surface-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1rem 1.1rem; }
.mt-preview__label { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 .65rem; }

/* Google search result */
.g-result { font-family: Arial, sans-serif; max-width: 600px; }
.g-result__title { color: #1a0dab; font-size: 1.15rem; line-height: 1.3; overflow-wrap: anywhere; cursor: pointer; }
.g-result__title:hover { text-decoration: underline; }
.g-result__url { color: #006621; font-size: .82rem; line-height: 1.3; overflow-wrap: anywhere; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-result__desc { color: #4d5156; font-size: .85rem; line-height: 1.45; overflow-wrap: anywhere; }

.g-result--mobile { font-size: 15px; }
.g-result--mobile .g-result__row { display: flex; gap: .75rem; align-items: flex-start; }
.g-result--mobile .g-result__body { min-width: 0; flex: 1 1 auto; }
.g-result--mobile .g-result__site { display: flex; align-items: center; gap: .4rem; color: #202124; font-size: .75rem; }
.g-result--mobile .g-result__favicon { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--brand); color: #fff; font-size: .6rem; }
.g-result--mobile .g-result__title { font-size: 1rem; }
.g-result--mobile .g-result__thumb { flex: 0 0 auto; width: 96px; height: 72px; border-radius: 8px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.g-result--mobile .g-result__thumb img { width: 100%; height: 100%; object-fit: cover; }

/* Open Graph / Facebook card */
.og-card { border-left: 2px solid #ced0d4; background: #f2f3f5; max-width: 500px; }
.og-card__img { aspect-ratio: 1.91 / 1; background: var(--surface) center/cover no-repeat; border-bottom: 1px solid #ced0d4; display: grid; place-items: center; color: var(--muted); font-size: .8rem; }
.og-card__body { padding: .6rem .8rem .75rem; }
.og-card__domain { color: #606770; font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; }
.og-card__title { font-family: Helvetica, Arial, sans-serif; font-weight: 600; font-size: 1rem; line-height: 1.3; color: #1c1e21; margin: .15rem 0 .2rem; overflow-wrap: anywhere; }
.og-card__desc { font-size: .85rem; color: #606770; line-height: 1.4; overflow-wrap: anywhere; }

/* X (Twitter) Card */
.tw-card { max-width: 500px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
.tw-card__img { aspect-ratio: 16 / 9; background: var(--surface-soft) center/cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: .8rem; }
.tw-card__domain { color: var(--muted); font-size: .8rem; padding: .7rem .9rem 0; }
.tw-card__title { font-weight: 700; font-size: .98rem; padding: .15rem .9rem 0; overflow-wrap: anywhere; }
.tw-card__desc { color: var(--ink-soft); font-size: .88rem; padding: .2rem .9rem .85rem; overflow-wrap: anywhere; }

/* Image placeholders */
.mt-ph { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); font-size: .78rem; background: linear-gradient(135deg, #eef0ff, #f9fafb); }

/* Generated code box */
.code-box { margin-top: 1.5rem; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.code-box__head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.code-box__title { margin: 0; font-size: .95rem; }
.code-output-wrap { margin: 0; padding: 1rem; background: #0f172a; color: #e2e8f0; overflow-x: auto; }
.code-output { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; line-height: 1.65; white-space: pre; display: block; }
.code-output .tk-tag { color: #7dd3fc; }
.code-output .tk-attr { color: #c4b5fd; }
.code-output .tk-val { color: #a7f3d0; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .mt-layout { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .tool-card { padding: 1.1rem; }
  .field { min-width: 100%; }
  .hero { padding-top: 2.5rem; }
  .site-header__cta { display: none; }
  .brand__tag { display: none; }
}
