/*
Theme Name: Freetoolsly Flat Theme
Theme URI: https://example.com/freetoolsly
Author: Your Studio
Author URI: https://example.com
Description: A flat, modern theme for a suite of text/AI tools. A customizable homepage showcases tool pages via editable cards, with each tool page built around a live tool (rephraser, em dash remover, humanizer, output preview).
Version: 1.1.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: freetoolsly
*/

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root{
  /* color */
  --bg:            #FAFAF8;
  --surface:       #FFFFFF;
  --ink:           #011F45;   /* exact navy from the freetoolsly logo */
  --ink-soft:      #55575E;
  --line:          #E4E3DF;
  --accent:        #2B2FF3;   /* electric indigo, primary action / rewritten text */
  --accent-ink:    #FFFFFF;
  --flag:          #FA6239;   /* exact orange-red from the logo, flags removed em dashes */
  --flag-soft:     #FFE9E2;
  --mint:          #40BA45;   /* exact green from the logo, success / copied state */
  --brand-purple:  #6426E9;   /* exact purple from the logo */
  --brand-gold:    #FDA905;   /* exact gold from the logo */

  /* type */
  --font-display: "Space Grotesk", "Arial Narrow", sans-serif;
  --font-body:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono:    "JetBrains Mono", "SFMono-Regular", Consolas, monospace;

  /* scale */
  --radius: 10px;
  --radius-sm: 6px;
  --border: 1px solid var(--line);
  --container: 1180px;
  --header-height: 68px;
}

/* ============================================================
   RESET / BASE
   ============================================================ */
*, *::before, *::after{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
body{
  margin:0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img{ max-width:100%; display:block; }
a{ color: inherit; text-decoration: none; }
button{ font-family: inherit; cursor: pointer; }
ul{ list-style: none; margin:0; padding:0; }
h1,h2,h3,h4{ font-family: var(--font-display); margin:0; letter-spacing: -0.01em; }
p{ margin:0; }

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

.visually-hidden{
  position:absolute; width:1px; height:1px; overflow:hidden;
  clip:rect(0 0 0 0); white-space:nowrap;
}

/* focus visibility */
a:focus-visible, button:focus-visible, textarea:focus-visible, input:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce){
  *{ animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior:auto !important; }
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header{
  border-bottom: var(--border);
  background: var(--surface);
  position: sticky;
  top:0;
  z-index: 40;
}
.site-header .container{
  display:flex;
  align-items:center;
  justify-content: space-between;
  height: var(--header-height);
  transition: height .12s ease;
}
.site-logo{
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}
.site-logo .dot{
  width:9px; height:9px; border-radius:50%;
  background: var(--accent);
  display:inline-block;
  flex-shrink:0;
}
.site-logo .custom-logo{
  max-height: calc(var(--header-height) - 26px);
  width:auto;
  display:block;
}
.site-logo-text{
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
  color: var(--ink); /* fallback if gradient text isn't supported */
  background: linear-gradient(90deg, var(--ink) 0%, var(--ink) 30%, var(--accent) 48%, var(--mint) 62%, var(--brand-gold) 78%, var(--brand-purple) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.site-nav > ul{ display:flex; gap: 28px; align-items:center; }
.site-nav .nav-item{ position:relative; list-style:none; }
.site-nav a.nav-link{
  font-size: 0.92rem;
  color: var(--ink-soft);
  font-weight: 500;
  display:flex;
  align-items:center;
  gap:6px;
}
.site-nav a.nav-link:hover{ color: var(--ink); }

/* Dropdown toggle caret (Bootstrap's default ::after is fine, just recolor) */
.site-nav .dropdown-toggle::after{
  border-top-color: currentColor;
}

/* Flat-design override of Bootstrap's default dropdown-menu look.
   display/position are re-declared explicitly (matching Bootstrap's own
   defaults) so this stays correct regardless of load order against any
   other .site-nav ul rule; this must never be visible until Bootstrap's
   dropdown JS adds .show. */
.site-nav .dropdown-menu{
  display:none;
  position:absolute;
  border: var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 28px -12px rgba(1,31,69,.18);
  padding: 8px;
  margin-top: 10px;
  min-width: 220px;
  background: var(--surface);
}
.site-nav .dropdown-menu.show{
  display:block;
}
.site-nav .dropdown-item{
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
}
.site-nav .dropdown-item:hover, .site-nav .dropdown-item:focus{
  background: var(--bg);
  color: var(--ink);
}

@media (max-width: 991.98px){
  .site-nav .dropdown-menu{
    position: static;
    box-shadow:none;
    border:none;
    margin-top:6px;
    padding-left: 14px;
  }
}
.header-cta{
  background: var(--ink);
  color: #fff;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
}
.navbar-toggler{
  display:flex;
  background:none; border:var(--border); border-radius: var(--radius-sm);
  width:40px; height:40px; align-items:center; justify-content:center;
  flex-shrink:0;
  padding:0;
}

/* Bootstrap's .navbar-expand-lg handles the collapse/expand switch at the
   lg breakpoint; this just lays out what's inside it once it's visible. */
.navbar-collapse{
  gap: 28px;
}
@media (min-width: 992px){
  .navbar-collapse{
    display:flex;
    align-items:center;
    justify-content:flex-end;
    flex: 1 1 auto;
  }
}
@media (max-width: 991.98px){
  .navbar-collapse{
    position:absolute;
    top:100%;
    left:0;
    right:0;
    width:100%;
    max-height: calc(100vh - var(--header-height));
    overflow-y:auto;
    padding: 0 22px 22px;
    border-top: var(--border);
    background: var(--surface);
    box-shadow: 0 12px 24px -16px rgba(1,31,69,.16);
  }
  .navbar-collapse .site-nav ul{
    flex-direction: column;
    align-items:stretch;
    gap:0;
  }
  .navbar-collapse .site-nav .nav-item{
    border-bottom: var(--border);
  }
  .navbar-collapse .site-nav .nav-item:last-child{
    border-bottom:none;
  }
  .navbar-collapse .site-nav a.nav-link{
    padding: 14px 4px;
    font-weight:600;
    color: var(--ink);
    justify-content:space-between;
  }
  .navbar-collapse .site-nav a.nav-link:hover,
  .navbar-collapse .site-nav a.nav-link:focus-visible{
    color: var(--accent);
  }
  .navbar-collapse .site-nav .dropdown-menu{
    padding: 0 0 12px 14px;
  }
  .navbar-collapse .site-nav .dropdown-item{
    padding: 10px 12px;
  }
  .navbar-collapse .header-cta{
    display:block;
    text-align:center;
    margin-top: 18px;
  }
}

/* ============================================================
   HERO / TOOL
   ============================================================ */
.hero{
  padding: 56px 0 72px;
  border-bottom: var(--border);
}
.hero-head{
  max-width: 640px;
  margin-bottom: 40px;
}
.eyebrow{
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  display:flex;
  align-items:center;
  gap:8px;
  margin-bottom: 14px;
}
.eyebrow::before{
  content:"";
  width: 16px; height: 1px;
  background: var(--accent);
}
.hero-head h1{
  font-size: clamp(2rem, 4vw, 2.9rem);
  line-height: 1.08;
  font-weight: 600;
}
.hero-head h1 em{
  font-style: normal;
  color: var(--accent);
}
.hero-head p{
  margin-top: 16px;
  font-size: 1.05rem;
  color: var(--ink-soft);
  max-width: 52ch;
}

/* --- tool card --- */
.tool{
  background: var(--surface);
  border: var(--border);
  border-radius: 16px;
  overflow: hidden;
}
.tool-toolbar{
  display:flex;
  flex-wrap: wrap;
  align-items:center;
  gap: 18px;
  padding: 16px 22px;
  border-bottom: var(--border);
  background: var(--bg);
}
.toggle{
  display:flex;
  align-items:center;
  gap:8px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
}
.switch{
  position:relative;
  width: 36px; height: 20px;
  border-radius: 999px;
  background: var(--line);
  border: none;
  padding:0;
  flex-shrink:0;
  transition: background .15s ease;
}
.switch::after{
  content:"";
  position:absolute;
  top:2px; left:2px;
  width:16px; height:16px;
  border-radius:50%;
  background:#fff;
  transition: transform .15s ease;
  box-shadow: 0 0 0 1px rgba(0,0,0,.08);
}
.switch[aria-pressed="true"]{ background: var(--accent); }
.switch[aria-pressed="true"]::after{ transform: translateX(16px); }

.tone-select{
  display:flex; align-items:center; gap:8px;
  font-size:0.86rem; font-weight:600;
}
.tone-select select{
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: var(--border);
  background: var(--surface);
  color: var(--ink);
}

.unicode-toggle-group{
  display:flex;
  align-items:center;
  gap:10px;
}
.unicode-select-wrap{
  display:inline-flex;
  overflow:hidden;
  max-width: 190px;
  opacity: 1;
  transition: max-width .2s ease, opacity .2s ease, margin .2s ease;
}
.unicode-select-wrap[hidden]{
  display:inline-flex; /* keep transitionable instead of display:none jump-cut */
  max-width: 0;
  opacity: 0;
  pointer-events: none;
}
.unicode-select-wrap select{
  width: 190px;
  max-width: 190px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: var(--border);
  background: var(--surface);
  color: var(--ink);
  white-space:nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}

.tool-pane-label-actions{
  display:flex;
  align-items:center;
  gap:10px;
}
.paste-btn{
  display:inline-flex;
  align-items:center;
  gap:6px;
  background: transparent;
  border: var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight:600;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.paste-btn i{ font-size: 0.72rem; }
.paste-btn:hover{ border-color: var(--accent); color: var(--accent); }

.tool-body{
  margin: 0;
}
.tool-pane{
  padding: 22px;
  min-width:0;
}
.tool-pane-label{
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  display:flex;
  justify-content: space-between;
  margin-bottom: 10px;
}
.js-input-text{
  width:100%;
  min-height: 260px;
  resize: vertical;
  border: var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-family: var(--font-body);
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--surface);
}
.js-input-text:focus{ border-color: var(--accent); }

.output-preview{
  min-height: 260px;
  border: var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 0.98rem;
  line-height: 1.6;
  overflow-y:auto;
  background: var(--bg);
}
.output-preview .placeholder{ color: var(--ink-soft); }
.output-preview em.removed{
  background: var(--flag-soft);
  color: var(--flag);
  text-decoration: line-through;
  border-radius: 3px;
  padding: 0 2px;
}
.output-preview em.changed{
  background: transparent;
  color: var(--flag);
  text-decoration: none;
  border-radius: 3px;
}
.output-preview em.unicode-flag{
  background: #FFF4DA;
  color: var(--brand-gold);
  text-decoration: none;
  outline: 1px dashed var(--brand-gold);
  outline-offset: 1px;
}

.tool-divider{
  border-left: var(--border);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:10px;
  padding: 0 6px;
}
.tool-divider button{
  width: 40px; height:40px;
  border-radius: 50%;
  background: var(--ink);
  color:#fff;
  border:none;
  display:flex; align-items:center; justify-content:center;
  transition: transform .12s ease, background .12s ease;
  flex-shrink:0;
  font-size: 1rem;
}
.tool-divider button:hover{ background: var(--accent); }
.tool-divider button:active{ transform: scale(0.94); }
.tool-divider-secondary{
  width: 30px !important; height:30px !important;
  background: var(--surface) !important;
  color: var(--ink) !important;
  border: var(--border) !important;
}
.tool-divider-secondary:hover{
  background: var(--accent) !important;
  color:#fff !important;
  border-color: var(--accent) !important;
}

.tool-footer{
  display:flex;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
  gap:12px;
  padding: 14px 22px;
  border-top: var(--border);
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.tool-footer .stats{ display:flex; gap:16px; flex-wrap:wrap; }
.tool-footer .stats strong{ color: var(--ink); font-weight:700; }
.tool-footer-actions{ display:flex; align-items:center; gap:8px; }
.history-btn{
  background: transparent;
  border: var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight:600;
  color: var(--ink);
}
.history-btn:hover:not(:disabled){ border-color: var(--ink); }
.history-btn:disabled{ opacity:.4; cursor:not-allowed; }
.copy-btn{
  background: transparent;
  border: var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight:600;
  color: var(--ink);
}
.copy-btn:hover{ border-color: var(--ink); }
.copy-btn.copied{ border-color: var(--mint); color: var(--mint); }

@media (max-width: 991.98px){
  .tool-divider{ border-left:none; border-top: var(--border); border-bottom: var(--border); padding: 10px 0; flex-direction:row; }
  .tool-divider button{ transform: rotate(90deg); }
  .tool-divider button:active{ transform: rotate(90deg) scale(0.94); }
}

@media (max-width: 575.98px){
  .tool-footer-actions{ flex-wrap:wrap; width:100%; }
  .tool-footer-actions .history-btn,
  .tool-footer-actions .copy-btn,
  .tool-footer-actions .editor-cta-btn{
    flex: 1 1 100%;
    width:100%;
    justify-content:center;
    white-space:normal;
  }
}

/* ============================================================
   REQUEST A HUMAN EDITOR: lead-gen slide-down below the tool.
   Uses the same max-height/opacity reveal technique as
   .unicode-select-wrap above, just applied to a full-width block
   instead of an inline control.
   ============================================================ */
.editor-cta-btn{
  display:inline-flex;
  align-items:center;
  gap:8px;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight:600;
  color:#fff;
  transition: background .12s ease, border-color .12s ease;
}
.editor-cta-btn:hover{ background: var(--brand-purple); border-color: var(--brand-purple); }
.editor-cta-btn i{ font-size: 0.8rem; }

/* ============================================================
   REQUEST A HUMAN EDITOR: modal popup (not an inline slide-
   down): fixed overlay + backdrop, centered card. The theme has
   no other modal anywhere, so this introduces the pattern fresh
   rather than adapting an existing one.
   ============================================================ */
body.has-modal-open{ overflow:hidden; }

.editor-request{
  position: fixed;
  inset: 0;
  z-index: 1000;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 24px;
  opacity:0;
  visibility:hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
.editor-request.is-open{
  opacity:1;
  visibility:visible;
}
.editor-request-backdrop{
  position:absolute;
  inset:0;
  background: rgba(1,31,69,.5);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.editor-request-inner{
  position:relative;
  z-index:1;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 48px);
  overflow-y:auto;
  padding: 32px 28px;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: 0 30px 60px -20px rgba(1,31,69,.35);
  transform: scale(0.96) translateY(6px);
  transition: transform .2s ease;
}
.editor-request.is-open .editor-request-inner{ transform: scale(1) translateY(0); }

.editor-request-close{
  position:absolute;
  top: 16px;
  right: 16px;
  width: 34px; height: 34px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius: 50%;
  border: var(--border);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.85rem;
  transition: background .12s ease, color .12s ease, border-color .12s ease, transform .12s ease;
}
.editor-request-close:hover{
  background: var(--flag-soft);
  border-color: var(--flag);
  color: var(--flag);
  transform: rotate(90deg);
}

.editor-request-price{
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom: 14px;
}
.editor-request-price-was{
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--ink-soft);
  text-decoration: line-through;
  text-decoration-color: var(--flag);
  text-decoration-thickness: 2px;
}
.editor-request-price-now{
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight:700;
  color: var(--mint);
}
.editor-request-price-tag{
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--mint);
  background: rgba(64,186,69,.12);
  padding: 4px 10px;
  border-radius: 999px;
}

.editor-request-intro h3{
  font-size: 1.15rem;
  font-weight:600;
  margin-bottom: 8px;
}
.editor-request-intro p{
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height:1.6;
  max-width: 56ch;
  margin-bottom: 20px;
}

.editor-request-form{
  position:relative;
  display:flex;
  flex-direction:column;
  gap:16px;
}
.editor-request-field{
  display:flex;
  flex-direction:column;
  gap:6px;
  width:100%;
}
.editor-request-field label{
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}
.editor-request-field input{
  width:100%;
  border: var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--surface);
}
.editor-request-field input:focus{ border-color: var(--accent); outline:none; }
.editor-request-field input.is-invalid{ border-color: var(--flag); }
.editor-request-error{
  min-height: 1em;
  font-size: 0.78rem;
  color: var(--flag);
}

.editor-request-hp{
  position:absolute;
  left:-9999px;
  top:auto;
  width:1px;
  height:1px;
  overflow:hidden;
}

.editor-request-actions{ margin-top:4px; }
.editor-request-submit{
  width:100%;
  display:inline-block;
  background: var(--accent);
  color:#fff;
  border:none;
  border-radius: var(--radius-sm);
  padding: 13px 22px;
  font-weight:600;
  font-size:0.95rem;
  transition: background .12s ease, transform .12s ease;
}
.editor-request-submit-label{
  display:inline-block;
  vertical-align:middle;
}
.editor-request-submit-arrow{
  display:inline-block;
  vertical-align:middle;
  margin-left:8px;
  transition: transform .12s ease;
}
.editor-request-submit-arrow i{
  vertical-align:middle;
}
.editor-request-submit:hover:not(:disabled){ background: var(--brand-purple); transform: translateY(-1px); }
.editor-request-submit:hover:not(:disabled) .editor-request-submit-arrow{ transform: translateX(3px); }
.editor-request-submit:disabled{ opacity:.6; cursor:not-allowed; }

.editor-request-success{
  text-align:center;
  padding: 20px 10px 8px;
}
.editor-request-success-icon{
  display:inline-flex;
  width:52px; height:52px;
  border-radius:50%;
  align-items:center;
  justify-content:center;
  background: rgba(64,186,69,.14);
  color: var(--mint);
  font-size:1.5rem;
  margin-bottom:14px;
}
.editor-request-success h3{ font-size: 1.1rem; font-weight:600; margin-bottom:8px; }
.editor-request-success p{ color: var(--ink-soft); font-size:0.92rem; max-width:48ch; margin:0 auto; }

@media (max-width: 575.98px){
  .editor-request{ padding: 12px; }
  .editor-request-inner{ padding: 46px 16px 22px; }
}

/* extra editor content on a Tool Page, below the tool itself */
.page-content{
  max-width: 680px;
  margin: 44px auto 0;
  color: var(--ink-soft);
  font-size: 0.98rem;
  line-height: 1.7;
}
.page-content h2, .page-content h3{ color: var(--ink); margin: 1.4em 0 0.5em; }
.page-content p{ margin-bottom: 1em; }
.page-content a{ color: var(--accent); text-decoration: underline; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer{ padding: 34px 0; }
.site-footer .container{
  display:flex; align-items:center; justify-content:space-between;
  flex-wrap:wrap; gap:12px;
}
.site-footer small{ color: var(--ink-soft); font-size:0.82rem; }
.footer-links{ display:flex; gap:20px; }
.footer-links a{ color: var(--ink-soft); font-size:0.82rem; }
.footer-links a:hover{ color: var(--ink); }

