/* =====================================================
   SketchKit — Main Stylesheet
   Simple drawing tools for artists and students
   ===================================================== */

/* --- CSS Custom Properties --- */
:root {
  --bg:              #ffffff;
  --bg-soft:         #f8f8f8;
  --bg-muted:        #f0f0f0;
  --border:          #e0e0e0;
  --border-strong:   #cccccc;
  --text:            #1a1a1a;
  --text-muted:      #666666;
  --text-light:      #999999;
  --primary:         #3b5bdb;
  --primary-hover:   #2f4ac0;
  --primary-light:   #eef2ff;
  --primary-border:  #c5d1fb;
  --accent:          #f59e0b;
  --danger:          #ef4444;
  --success:         #22c55e;
  --shadow-card:     0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-hover:    0 4px 16px rgba(0,0,0,0.11);
  --radius-sm:       4px;
  --radius:          8px;
  --radius-lg:       12px;
  --font:            system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --max-width:       1200px;
  --header-h:        60px;
  --sidebar-w:       288px;
  --transition:      0.16s ease;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { list-style: none; }
button { cursor: pointer; font-family: var(--font); border: none; outline: none; }
input, select, textarea { font-family: var(--font); color: var(--text); }
h1, h2, h3, h4 { line-height: 1.25; }

/* --- Typography --- */
h1 { font-size: clamp(1.75rem, 4vw, 2.75rem); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.25rem, 3vw, 1.9rem); font-weight: 650; letter-spacing: -0.01em; }
h3 { font-size: 1.05rem; font-weight: 600; }
h4 { font-size: 0.9rem; font-weight: 600; }
p  { margin-bottom: 0.8rem; }
p:last-child { margin-bottom: 0; }

/* --- Layout Utilities --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
main { flex: 1; }

/* =====================================================
   HEADER
   ===================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--header-h);
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

/* Logo */
.site-logo {
  font-size: 1.2rem;
  font-weight: 750;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 2px;
}
.site-logo:hover { text-decoration: none; color: var(--text); }
.site-logo .logo-accent { color: var(--primary); }

/* Desktop nav */
.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}
.site-nav a {
  display: inline-block;
  padding: 6px 13px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition), background var(--transition);
}
.site-nav a:hover,
.site-nav a.active {
  color: var(--text);
  background: var(--bg-muted);
  text-decoration: none;
}

/* Nav hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  padding: 6px;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.nav-toggle:hover { background: var(--bg-muted); }
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }

.btn-secondary { background: var(--bg); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--bg-muted); color: var(--text); }

.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-lg { padding: 11px 24px; font-size: 15px; }

.btn-danger { background: #fef2f2; color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: #fee2e2; }

.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--bg-muted); color: var(--text); }

/* =====================================================
   HERO
   ===================================================== */
.hero {
  padding: 80px 0 64px;
  text-align: center;
  background: linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}
.hero h1 { margin-bottom: 18px; max-width: 620px; margin-left: auto; margin-right: auto; }
.hero .subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto 36px;
}
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-badge {
  display: inline-block;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 100px;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 18px;
  letter-spacing: 0.02em;
}

/* =====================================================
   SECTIONS
   ===================================================== */
.section { padding: 72px 0; }
.section-sm { padding: 48px 0; }
.section-alt { background: var(--bg-soft); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.section-heading { text-align: center; margin-bottom: 6px; }
.section-subheading { text-align: center; color: var(--text-muted); margin-bottom: 44px; font-size: 1rem; max-width: 520px; margin-left: auto; margin-right: auto; }

/* =====================================================
   TOOL CARDS (homepage)
   ===================================================== */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}
.tool-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
}
.tool-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.tool-card-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 18px;
  font-size: 22px;
}
.tool-card h3 { margin-bottom: 8px; }
.tool-card p { color: var(--text-muted); font-size: 14px; flex: 1; margin-bottom: 22px; }
.tool-card .btn { width: 100%; }

/* Coming soon */
.coming-soon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}
.coming-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
}
.coming-card .c-icon { font-size: 26px; margin-bottom: 8px; }
.coming-card h4 { font-size: 13px; margin-bottom: 6px; }
.badge-soon {
  display: inline-block;
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 100px;
  background: var(--bg-muted);
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* SEO prose section */
.seo-prose { max-width: 680px; }
.seo-prose h2 { margin-bottom: 14px; }
.seo-prose p { color: var(--text-muted); }

/* =====================================================
   FAQ
   ===================================================== */
.faq-list { max-width: 700px; margin: 0 auto; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-question {
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: 18px 0;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-radius: 0;
  transition: color var(--transition);
}
.faq-question:hover { color: var(--primary); }
.faq-chevron {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  transition: transform var(--transition);
}
.faq-item.open .faq-chevron { transform: rotate(180deg); }
.faq-answer {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.28s ease;
}
.faq-answer-inner {
  padding-bottom: 18px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.75;
}
.faq-item.open .faq-answer { max-height: 600px; }

/* =====================================================
   AD PLACEHOLDERS
   ===================================================== */
.ad-placeholder {
  background: var(--bg-soft);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-light);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ad-placeholder .ad-label { font-size: 10px; }
.ad-bottom { width: 100%; height: 90px; }
.ad-mid { max-width: 728px; height: 90px; margin: 0 auto; }
.ad-sidebar { width: 100%; min-height: 250px; }
.ad-section { padding: 20px 0; }
.ad-section-mid { padding: 32px 0; }

/* =====================================================
   FOOTER
   ===================================================== */
.site-footer {
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  padding: 48px 0 24px;
  margin-top: auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 36px;
}
.footer-brand .site-logo { margin-bottom: 10px; display: inline-block; }
.footer-brand p { font-size: 13.5px; color: var(--text-muted); max-width: 240px; }
.footer-col h4 {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 14px;
  font-weight: 600;
}
.footer-col ul { display: flex; flex-direction: column; gap: 9px; }
.footer-col a { font-size: 13.5px; color: var(--text-muted); text-decoration: none; transition: color var(--transition); }
.footer-col a:hover { color: var(--text); text-decoration: none; }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.footer-bottom p { font-size: 12.5px; color: var(--text-muted); margin: 0; }
.footer-bottom a { color: var(--text-muted); text-decoration: none; }
.footer-bottom a:hover { color: var(--text); }

/* =====================================================
   TOOL PAGE LAYOUT
   ===================================================== */
.tool-page-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - var(--header-h));
}

/* Sidebar */
.tool-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.sidebar-scroll { padding: 18px 14px; display: flex; flex-direction: column; gap: 14px; flex: 1; }
.sidebar-ad-wrap { padding: 14px; border-top: 1px solid var(--border); }

/* Tool main area */
.tool-main {
  flex: 1;
  overflow: auto;
  background: var(--bg-soft);
  display: flex;
  flex-direction: column;
}
.tool-main-head {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 13px 22px;
}
.tool-main-head h1 { font-size: 0.95rem; font-weight: 600; margin: 0; }
.tool-main-head p { font-size: 12.5px; color: var(--text-muted); margin: 0; }
.tool-main-inner { flex: 1; padding: 22px; display: flex; flex-direction: column; gap: 18px; }

/* Canvas container */
.canvas-wrap {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.canvas-placeholder {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 24px;
  pointer-events: none;
}
.canvas-placeholder .ph-icon { font-size: 52px; margin-bottom: 12px; opacity: 0.35; }
.canvas-placeholder p { font-size: 13.5px; }
canvas { max-width: 100%; max-height: 70vh; display: block; }

/* Tool info bar */
.tool-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
}
.info-stat { font-size: 12px; color: var(--text-muted); }
.info-stat strong { color: var(--text); }

/* Controls group */
.ctrl-group {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 14px 16px;
}
.ctrl-group-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.ctrl-row { margin-bottom: 13px; }
.ctrl-row:last-child { margin-bottom: 0; }
.ctrl-lbl {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 7px;
  font-size: 13px;
  color: var(--text);
}
.ctrl-val { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* Range slider */
input[type="range"] {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2.5px solid #fff;
  box-shadow: 0 0 0 1.5px var(--primary);
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2.5px solid #fff;
  box-shadow: 0 0 0 1.5px var(--primary);
}

/* Color picker buttons */
.color-opts { display: flex; gap: 8px; flex-wrap: wrap; }
.color-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}
.color-btn:hover { transform: scale(1.12); }
.color-btn.active { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--primary); }
.color-btn[data-color="black"]  { background: #111111; }
.color-btn[data-color="white"]  { background: #ffffff; border-color: #ccc; }
.color-btn[data-color="red"]    { background: #ef4444; }
.color-btn[data-color="blue"]   { background: #3b82f6; }

/* Toggle switch */
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 2px 0; }
.toggle-lbl { font-size: 13px; color: var(--text); }
.tog {
  position: relative;
  width: 36px; height: 20px;
  display: inline-flex;
  flex-shrink: 0;
}
.tog input { opacity: 0; width: 0; height: 0; }
.tog-track {
  position: absolute; inset: 0;
  background: var(--border-strong);
  border-radius: 100px;
  cursor: pointer;
  transition: background var(--transition);
}
.tog-track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.tog input:checked + .tog-track { background: var(--primary); }
.tog input:checked + .tog-track::after { transform: translateX(16px); }

/* Upload area */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  background: var(--bg-soft);
  user-select: none;
}
.upload-area:hover, .upload-area.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}
.upload-area .u-icon { font-size: 28px; margin-bottom: 6px; opacity: 0.55; }
.upload-area p { font-size: 12.5px; color: var(--text-muted); margin: 0; }
.upload-area strong { color: var(--primary); }
.file-input { display: none; }

/* Action buttons */
.action-row { display: flex; gap: 8px; flex-wrap: wrap; }
.action-row .btn { flex: 1; min-width: 70px; }

/* Messages */
.msg {
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.msg-error   { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.msg-success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.msg-info    { background: var(--primary-light); color: var(--primary); border: 1px solid var(--primary-border); }
.msg-hidden  { display: none; }

/* =====================================================
   TIMER TOOL
   ===================================================== */
.timer-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-soft);
}
.timer-controls-bar {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 8px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.timer-image-stage {
  flex: 1;
  min-height: 0;
  max-height: 58vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 10px 24px;
  position: relative;
}
.timer-img-frame {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  max-width: 1040px;
  width: 100%;
  height: 100%;
}
.timer-img-frame img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: top center;
  display: block;
}
.timer-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 64px 32px;
}
.timer-empty .te-icon { font-size: 48px; opacity: 0.3; margin-bottom: 12px; }
.timer-empty p { font-size: 14px; }
.timer-hud {
  text-align: center;
  padding: 8px 24px 10px;
}
.timer-count {
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1;
  transition: color var(--transition);
}
.timer-count.warn   { color: var(--accent); }
.timer-count.danger { color: var(--danger); }
.timer-img-counter { font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.timer-action-btns { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }

/* Preset buttons */
.preset-row { display: flex; gap: 6px; flex-wrap: wrap; }
.preset-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 12.5px;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
}
.preset-btn:hover  { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.preset-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Custom time input */
.custom-t-row { display: flex; gap: 6px; align-items: center; }
.custom-t-row input[type="number"] {
  width: 58px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}
.custom-t-row input[type="number"]:focus { border-color: var(--primary); }

/* Upload list */
.upload-list { margin-top: 8px; max-height: 90px; overflow-y: auto; font-size: 12px; color: var(--text-muted); }
.upload-list-item { padding: 3px 0; border-bottom: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-count-badge { display: inline-block; font-size: 11px; padding: 2px 8px; background: var(--primary-light); color: var(--primary); border-radius: 100px; font-weight: 600; }

/* Fullscreen overlay */
#fullscreen-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #0e0e0e;
  flex-direction: column;
  align-items: stretch;
  box-sizing: border-box;
}
#fullscreen-overlay.active { display: flex; }

/* Top bar */
.fs-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: #161616;
  border-bottom: 1px solid #2a2a2a;
  flex-shrink: 0;
}
.fs-timer-info {
  display: flex;
  align-items: baseline;
  gap: 16px;
}
#fullscreen-overlay .timer-count {
  font-size: clamp(1.8rem, 4vw, 3rem);
  color: #f5f5f5;
  line-height: 1;
}
#fullscreen-overlay .timer-img-counter { color: #888; font-size: 13px; }

/* Progress bar strip */
.fs-progress-wrap {
  height: 6px;
  background: #2a2a2a;
  flex-shrink: 0;
  width: 100%;
}
.fs-progress-wrap .progress-bar-track {
  height: 100%;
  background: #4f8ef7;
  transition: width 1s linear;
  min-width: 2px;
}

/* Image area */
.fs-image-area {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
}
#fullscreen-overlay .timer-img-frame {
  border-color: #2a2a2a;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}
#fullscreen-overlay .timer-img-frame img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Bottom bar */
.fs-bottombar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 12px 20px;
  background: #161616;
  border-top: 1px solid #2a2a2a;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.fs-exit {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font);
  transition: background var(--transition);
  flex-shrink: 0;
}
.fs-exit:hover { background: rgba(255,255,255,0.22); }
#fullscreen-overlay .timer-action-btns { margin-top: 0; }
#fullscreen-overlay .timer-action-btns .btn { min-width: 80px; }
.fs-presets { display: flex; gap: 6px; }
.fs-presets .preset-btn { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.15); color: #ccc; }
.fs-presets .preset-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Progress bar */
.progress-bar-wrap {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar-track { height: 100%; background: var(--primary); border-radius: 2px; transition: width 1s linear; }

/* =====================================================
   STATIC PAGES
   ===================================================== */
.static-page {
  max-width: 700px;
  margin: 0 auto;
  padding: 56px 24px 80px;
}
.static-page h1 { margin-bottom: 6px; }
.static-page .page-meta { color: var(--text-muted); font-size: 14px; margin-bottom: 44px; }
.static-page h2 { font-size: 1.2rem; margin: 36px 0 10px; }
.static-page h3 { font-size: 0.98rem; margin: 24px 0 6px; }
.static-page p  { color: var(--text-muted); font-size: 14.5px; line-height: 1.8; }
.static-page ul, .static-page ol { padding-left: 20px; margin-bottom: 14px; }
.static-page li { color: var(--text-muted); font-size: 14.5px; line-height: 1.8; margin-bottom: 4px; list-style: disc; }
.static-page ol li { list-style: decimal; }
.static-page a { color: var(--primary); }

/* Contact form */
.contact-form { margin-top: 32px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13.5px; font-weight: 500; margin-bottom: 6px; }
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: var(--primary); }
.form-group textarea { min-height: 130px; resize: vertical; }
.form-note { font-size: 12.5px; color: var(--text-muted); margin-top: 8px; }

/* =====================================================
   ABOUT PAGE
   ===================================================== */
.about-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin: 24px 0 12px;
}
.about-feature {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.about-feature .af-icon { font-size: 24px; margin-bottom: 8px; }
.about-feature h4 { margin-bottom: 4px; font-size: 13.5px; }
.about-feature p { font-size: 13px; color: var(--text-muted); }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 900px) {
  .tool-page-body { flex-direction: column; overflow: unset; min-height: unset; height: auto; }
  .tool-main { order: -1; overflow: unset; }
  .tool-sidebar {
    order: 1;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-y: unset;
  }
  .sidebar-scroll { flex-direction: row; flex-wrap: wrap; gap: 12px; padding: 12px; }
  .ctrl-group { flex: 1; min-width: 220px; }
  .sidebar-ad-wrap { display: none; }
  canvas { max-height: 55vw; }
}

@media (max-width: 768px) {
  .site-nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 10px;
    gap: 2px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    z-index: 200;
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 10px 12px; width: 100%; }
  .nav-toggle { display: flex; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
  .hero { padding: 52px 0 44px; }
  .timer-controls-bar { padding: 10px 16px; gap: 10px; }
}

@media (max-width: 520px) {
  .footer-grid { grid-template-columns: 1fr; }
  .coming-soon-grid { grid-template-columns: repeat(2, 1fr); }
  .tools-grid { grid-template-columns: 1fr; }
  .hero-cta { flex-direction: column; align-items: center; }
  .timer-action-btns { gap: 8px; }
  .timer-count { font-size: 3.5rem; }
}

/* =====================================================
   VALUE CHECKER PAGE — MOBILE REFLOW
   This page uses a simple .container layout (no sidebar/main split),
   so we just make the container a flex column and assign order values.
   ===================================================== */
@media (max-width: 900px) {
  .value-page #vc-main {
    display: flex;
    flex-direction: column;
  }

  /* ── Section order ──
     1. Upload
     2. Output canvas (hidden until image loaded)
     3. Controls (contrast slider)
     4. How to use
     5. FAQ
  */
  .value-page #vc-upload   { order: 1; }
  .value-page #outWrap     { order: 2; }
  .value-page #vc-controls { order: 3; }
  .value-page #vc-how-to   { order: 4; }
  .value-page #vc-faq      { order: 5; }
}

/* =====================================================
   PALETTE PAGE — MOBILE REFLOW
   ===================================================== */
@media (max-width: 900px) {
  .palette-page .tool-sidebar,
  .palette-page .sidebar-scroll,
  .palette-page .tool-main,
  .palette-page .tool-main-inner {
    display: contents;
  }

  .palette-page .ctrl-group {
    flex: unset;
    min-width: unset;
    width: 100%;
    box-sizing: border-box;
  }

  /* ── Section order ──
     1. Tool title bar
     2. Upload
     3. Result area (empty state / loading / mobile card slot / result)
     4. Number of colours
     5. Actions
     6. Export
     7. Share
     8. FAQ
  */
  .palette-page .tool-main-head        { order: 1; }
  .palette-page #pal-ctrl-upload       { order: 2; }
  /* All result-area elements share order 3 — JS handles show/hide */
  .palette-page #pal-empty             { order: 3; width: 100%; }
  .palette-page #pal-loading           { order: 3; width: 100%; }
  .palette-page #pal-preview-group     { order: 3; }
  .palette-page #pal-mobile-card-slot  { order: 3; width: 100%; }
  .palette-page #pal-result            { order: 3; width: 100%; }
  .palette-page #pal-ctrl-num          { order: 4; }
  .palette-page #pal-ctrl-actions      { order: 5; }
  .palette-page #pal-export-group      { order: 6; }
  .palette-page #pal-ctrl-share        { order: 7; }
  .palette-page .pal-faq-section       { order: 8; }
}

/* =====================================================
   SIMPLIFIER PAGE — MOBILE REFLOW
   ===================================================== */
@media (max-width: 900px) {
  .simplifier-page .tool-sidebar,
  .simplifier-page .sidebar-scroll,
  .simplifier-page .tool-main,
  .simplifier-page .tool-main-inner {
    display: contents;
  }

  .simplifier-page .ctrl-group {
    flex: unset;
    min-width: unset;
    width: 100%;
    box-sizing: border-box;
  }

  /* ── Section order ──
     1. Tool title bar
     2. Upload
     3. Canvas  (hidden until image loaded)
     4. Info bar
     5. Adjustments
     6. Transform
     7. How to use
     8. Actions
     9. Share
    10. FAQ
  */
  .simplifier-page .tool-main-head        { order: 1; }
  .simplifier-page #simp-ctrl-upload      { order: 2; }
  .simplifier-page .canvas-wrap           { order: 3; }
  .simplifier-page .tool-info-bar         { order: 4; width: 100%; box-sizing: border-box; }
  .simplifier-page #simp-ctrl-adjustments { order: 5; }
  .simplifier-page #simp-ctrl-transform   { order: 6; }
  .simplifier-page .simp-how-section      { order: 7; margin: 0; }
  .simplifier-page #simp-ctrl-actions     { order: 8; }
  .simplifier-page #simp-ctrl-share       { order: 9; }
  .simplifier-page .simp-faq-section      { order: 10; }

  /* Hide canvas itself until image loaded; keep placeholder visible */
  .simplifier-page .canvas-wrap:not(.has-image) canvas { display: none; }

  /* Swap example images: hide desktop, show mobile version */
  .simplifier-page .simp-example-desktop { display: none !important; }
  .simplifier-page .simp-example-mobile  { display: block !important; }
}

/* =====================================================
   TIMER PAGE — MOBILE REFLOW
   ===================================================== */
@media (max-width: 900px) {
  .timer-page .tool-sidebar,
  .timer-page .sidebar-scroll,
  .timer-page .tool-main {
    display: contents;
  }

  .timer-page .ctrl-group {
    flex: unset;
    min-width: unset;
    width: 100%;
    box-sizing: border-box;
  }

  /* ── Section order ──
     1. Tool title bar
     2. Upload (your own images)
     3. Play screen (image + timer + controls)
     4. Reference Packs
     5. Session Mode
     6. Duration
     7. Options
     8. Share
     9. Session Stats
    10. How to use
  */
  .timer-page .tool-main-head    { order: 1; }
  .timer-page #upload-ctrl       { order: 2; }
  .timer-page .timer-body        { order: 3; width: 100%; box-sizing: border-box; }
  .timer-page #packs-ctrl        { order: 4; }
  .timer-page #ctrl-session-mode { order: 5; }
  .timer-page #duration-ctrl     { order: 6; }
  .timer-page #ctrl-options      { order: 7; }
  .timer-page #ctrl-share-timer  { order: 8; }
  .timer-page #timer-stats       { order: 9; }
  .timer-page .timer-how-wrap    { order: 10; width: 100%; padding: 0 0 16px; }
}

/* =====================================================
   GRID PAGE — MOBILE REFLOW
   Flatten sidebar + main into a single ordered column.
   Desktop layout is completely unaffected.
   ===================================================== */
@media (max-width: 900px) {
  /* Remove the boxes of the nested layout containers so their
     children become direct flex items of .tool-page-body */
  .grid-page .tool-sidebar,
  .grid-page .sidebar-scroll,
  .grid-page .tool-main,
  .grid-page .tool-main-inner {
    display: contents;
  }

  /* Each ctrl-group is now a full-width block, not a flex tile */
  .grid-page .ctrl-group {
    flex: unset;
    min-width: unset;
    width: 100%;
    box-sizing: border-box;
  }

  /* ── Section order ──
     1. Tool title bar
     2. Upload
     3. Canvas  (hidden until image loaded — see .has-image below)
     4. Info bar (hidden until image loaded)
     5. Grid Settings
     6. How to Use
     7. Actions
     8. Share
     9. FAQ
  */
  .grid-page .tool-main-head          { order: 1; }
  .grid-page #ctrl-upload             { order: 2; }
  .grid-page .canvas-wrap             { order: 3; }
  .grid-page .tool-info-bar           { order: 4; width: 100%; box-sizing: border-box; }
  .grid-page #ctrl-grid-settings      { order: 5; }
  .grid-page .how-to-use-section      { order: 6; margin: 0; }
  .grid-page #ctrl-actions            { order: 7; }
  .grid-page #ctrl-share              { order: 8; }
  .grid-page .faq-section             { order: 9; }

  /* Hide the canvas itself on mobile until an image is uploaded; keep the placeholder visible */
  .grid-page .canvas-wrap:not(.has-image) canvas { display: none; }
}

/* =====================================================
   SHARE BUTTON
   ===================================================== */
.share-btns {
  display: flex;
  gap: 8px;
}
.share-btns .btn { flex: 1; font-size: 12.5px; }

/* Share toast (reuse copy-toast pattern if not already on page) */
.sk-share-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1a1a1a;
  color: #fff;
  padding: 9px 20px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 9999;
  white-space: nowrap;
}
.sk-share-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =====================================================
   BLOG — Index page
   ===================================================== */
.blog-index {
  max-width: 900px;
  margin: 0 auto;
  padding: 56px 24px 80px;
}
.blog-index-hero {
  text-align: center;
  margin-bottom: 48px;
}
.blog-index-hero h1 { margin-bottom: 10px; }
.blog-index-hero p  { color: var(--text-muted); font-size: 15px; max-width: 480px; margin: 0 auto; }

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}
.blog-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}
.blog-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}
.blog-card-thumb {
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 54px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}
.blog-card-body {
  padding: 18px 20px 22px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.blog-card-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: 100px;
  margin-bottom: 10px;
  width: fit-content;
}
.blog-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 8px;
  color: var(--text);
}
.blog-card-excerpt {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.65;
  flex: 1;
  margin-bottom: 14px;
}
.blog-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 10px;
}
.blog-card-read { color: var(--primary); font-weight: 600; margin-top: 14px; font-size: 13px; }

/* =====================================================
   BLOG — Post page
   ===================================================== */
.blog-post-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 88px;
}
.blog-post-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 32px;
  transition: color var(--transition);
}
.blog-post-back:hover { color: var(--primary); }

.blog-post-header { margin-bottom: 32px; }
.blog-post-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: 100px;
  margin-bottom: 14px;
}
.blog-post-header h1 {
  font-size: clamp(1.55rem, 4vw, 2rem);
  line-height: 1.25;
  margin-bottom: 14px;
}
.blog-post-meta {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.blog-post-divider {
  height: 1px;
  background: var(--border);
  margin: 28px 0;
}

/* Article body typography */
.blog-post-body { line-height: 1.8; }
.blog-post-body h2 {
  font-size: 1.25rem;
  margin: 40px 0 12px;
  color: var(--text);
}
.blog-post-body h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 28px 0 8px;
  color: var(--text);
}
.blog-post-body p {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 18px;
}
.blog-post-body ul,
.blog-post-body ol {
  padding-left: 22px;
  margin-bottom: 18px;
}
.blog-post-body li {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 6px;
  line-height: 1.7;
}
.blog-post-body ul li { list-style: disc; }
.blog-post-body ol li { list-style: decimal; }
.blog-post-body strong { color: var(--text); }
.blog-post-body a { color: var(--primary); }

/* In-article tool CTA box */
.blog-tool-cta {
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin: 36px 0;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.blog-tool-cta .cta-icon { font-size: 36px; flex-shrink: 0; }
.blog-tool-cta .cta-text { flex: 1; min-width: 160px; }
.blog-tool-cta .cta-text strong { display: block; font-size: 15px; margin-bottom: 4px; }
.blog-tool-cta .cta-text span { font-size: 13.5px; color: var(--text-muted); }
.blog-tool-cta .btn { white-space: nowrap; }

/* Like button */
.post-like-wrap {
  margin: 32px 0 8px;
  display: flex;
  justify-content: center;
}
.sk-like-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 28px;
  border: 2px solid #e0e0e0;
  border-radius: 50px;
  background: white;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: #888;
  transition: all 0.2s;
}
.sk-like-btn:hover { border-color: #e05555; color: #e05555; }
.sk-like-btn.liked { border-color: #e05555; background: #fff5f5; color: #e05555; }
.sk-like-btn .like-heart { font-size: 1.1rem; }
#sk-like-count { font-weight: 700; min-width: 14px; text-align: center; }

/* Like count on blog cards */
.blog-card-likes {
  font-size: 0.75rem;
  color: #e05555;
  font-weight: 600;
  margin-top: 4px;
}

/* Post-end share section */
.blog-post-share {
  border-top: 1px solid var(--border);
  margin-top: 48px;
  padding-top: 32px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.blog-post-share p { font-size: 14px; font-weight: 600; color: var(--text); margin: 0; }

/* Related posts */
.blog-related { margin-top: 48px; }
.blog-related h3 { font-size: 1rem; font-weight: 700; margin-bottom: 16px; }

@media (max-width: 520px) {
  .blog-grid { grid-template-columns: 1fr; }
  .blog-tool-cta { flex-direction: column; text-align: center; }
  .blog-post-share { flex-direction: column; }
}

/* =====================================================
   PRINT
   ===================================================== */
@media print {
  .site-header, .site-footer, .ad-placeholder, .ad-section { display: none; }
  body { color: #000; background: #fff; }
}
