/* =============================================
   CodeToFun — HTML Color Picker
   Self-contained, mobile-first responsive CSS
   ============================================= */

/* --- Reset & Base --- */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html{font-size:16px;scroll-behavior:smooth;-webkit-text-size-adjust:100%}
body{font-family:"Inter",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,sans-serif;color:#1e293b;background:#fff;line-height:1.6;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}
img{max-width:100%;height:auto;display:block}
a{color:inherit;text-decoration:none}
ul,ol{list-style:none}
button{cursor:pointer;font-family:inherit;border:none;background:none}
code{font-family:"Courier New",Courier,monospace}
.container{max-width:1400px;margin:0 auto;padding:0 1rem}

.btn{display:inline-flex;align-items:center;justify-content:center;gap:.5rem;font-weight:600;font-size:.938rem;border-radius:.5rem;padding:.625rem 1.5rem;transition:all .2s ease;text-decoration:none;border:none;cursor:pointer;line-height:1.4}
a.btn-primary,button.btn-primary,.btn-primary{background:#2563eb;color:#fff}
a.btn-primary:hover,button.btn-primary:hover,.btn-primary:hover{background:#1d4ed8;color:#fff}
.btn-sm{padding:.5rem 1.25rem;font-size:.875rem}

/* ===================== HEADER ===================== */
.site-header{position:sticky;top:0;z-index:100;background:#fff;border-bottom:1px solid #e2e8f0;box-shadow:0 1px 3px rgba(0,0,0,.06)}
.header-inner{display:flex;justify-content:space-between;align-items:center;height:4rem}
.logo{display:flex;align-items:center;gap:.75rem}
.logo-icon{background:#2563eb;padding:.5rem;border-radius:.5rem;color:#fff;display:flex;align-items:center;justify-content:center}
.logo-text{display:flex;flex-direction:column;line-height:1.2}
.logo-name{font-size:1.125rem;font-weight:700;color:#0f172a}
.logo-tagline{font-size:.75rem;color:#64748b}
.desktop-nav{display:none;align-items:center;gap:2rem}
.desktop-nav a:not(.btn){color:#475569;font-weight:500;font-size:.938rem;transition:color .2s}
.desktop-nav a:not(.btn):hover{color:#2563eb}
.desktop-nav .btn-primary,.mobile-nav .btn-primary{background:#2563eb;color:#fff}
.desktop-nav .btn-primary:hover,.mobile-nav .btn-primary:hover{background:#1d4ed8;color:#fff}
.mobile-menu-btn{display:flex;padding:.5rem;color:#475569}
.mobile-nav{display:none;flex-direction:column;gap:1rem;padding:1rem;border-top:1px solid #e2e8f0;background:#fff}
.mobile-nav.open{display:flex}
.mobile-nav a:not(.btn){color:#475569;font-weight:500;font-size:.938rem;transition:color .2s}
.mobile-nav a:not(.btn):hover{color:#2563eb}

/* ===================== FOOTER ===================== */
.site-footer{background:#0f172a;color:#94a3b8;padding:3rem 0 0}
.footer-grid{display:grid;grid-template-columns:1fr;gap:2.5rem;margin-bottom:3rem}
.footer-brand p{color:#94a3b8;line-height:1.6;margin:1rem 0 1.5rem}
.footer-brand .logo-name{color:#fff}.footer-brand .logo-tagline{color:#94a3b8}
.follow-heading{color:#fff;font-size:.875rem;font-weight:600;margin-bottom:.75rem}
.social-links{display:flex;gap:.75rem;margin-bottom:1.5rem;flex-wrap:wrap}
.social-links a{background:#1e293b;padding:.625rem;border-radius:.5rem;transition:background .2s;display:flex;align-items:center;justify-content:center}
.social-links a:hover{background:#334155}
.trusted-badge{display:inline-flex;align-items:center;gap:.5rem;background:#1e293b;padding:.5rem 1rem;border-radius:.5rem;font-size:.875rem;border:1px solid #334155}
.trusted-badge .dot{width:.5rem;height:.5rem;border-radius:50%;background:#3b82f6}
.footer-links-col h4{color:#fff;font-size:.938rem;font-weight:600;margin-bottom:1rem}
.footer-links-col ul{display:flex;flex-direction:column;gap:.5rem}
.footer-links-col a{font-size:.875rem;transition:color .2s}
.footer-links-col a:hover{color:#60a5fa}
.footer-all-links ul{columns:2;column-gap:1.5rem}
.footer-all-links li{break-inside:avoid}
.footer-bottom{border-top:1px solid #1e293b;padding:2rem 0;display:flex;flex-direction:column;gap:1rem;align-items:center;text-align:center}
.footer-bottom p{font-size:.875rem;color:#94a3b8;display:flex;align-items:center;gap:.25rem;flex-wrap:wrap;justify-content:center}
.heart-icon{vertical-align:middle}
.footer-legal-links{display:flex;gap:1.5rem;font-size:.875rem}
.footer-legal-links a{transition:color .2s}.footer-legal-links a:hover{color:#60a5fa}

/* ===================== COOKIE NOTICE ===================== */
.cookie-notice{position:fixed;bottom:0;left:0;right:0;background:#0f172a;color:#cbd5e1;padding:1rem;display:flex;flex-direction:column;gap:.75rem;align-items:center;z-index:200;box-shadow:0 -4px 12px rgba(0,0,0,.15)}
.cookie-notice p{font-size:.813rem;text-align:center;line-height:1.5}
.cookie-notice a:not(.btn){color:#60a5fa;text-decoration:underline}
.cookie-notice .btn-primary{background:#2563eb;color:#fff}
.cookie-notice .btn-primary:hover{background:#1d4ed8;color:#fff}

/* =============================================
   COLOR PICKER PAGE
   ============================================= */
.color-picker-page{background:#f8fafc;min-height:100vh}
.cp-body{padding:1.5rem 0 0}

/* --- Breadcrumb --- */
.breadcrumb{display:flex;align-items:center;gap:.5rem;font-size:.875rem;color:#64748b;margin-bottom:1.5rem}
.breadcrumb a{transition:color .15s}.breadcrumb a:hover{color:#2563eb}
.breadcrumb .current{color:#0f172a;font-weight:500}

/* --- Page Header --- */
.cp-page-header{margin-bottom:2rem}
.cp-page-header h1{font-size:2rem;font-weight:800;color:#0f172a;margin-bottom:.5rem}
.cp-page-header p{font-size:1.125rem;color:#64748b}

/* =============================================
   MAIN PICKER CARD (3-col)
   ============================================= */
.picker-card{background:#fff;border-radius:.75rem;box-shadow:0 10px 40px rgba(0,0,0,.08);border:1px solid #e2e8f0;padding:1.5rem;margin-bottom:2rem}
.picker-grid{display:grid;grid-template-columns:1fr;gap:1.5rem}
.picker-grid h2{font-size:1.25rem;font-weight:700;color:#0f172a;margin-bottom:1rem}

/* Column 1 — pick */
.pick-col canvas{width:100%;max-width:300px;display:block;margin:0 auto;cursor:crosshair;border-radius:.5rem;border:2px solid #cbd5e1}
.hex-input-row{display:flex;gap:.5rem;margin-top:1rem}
.hex-input-row input[type="text"]{flex:1;padding:.5rem .75rem;border:2px solid #cbd5e1;border-radius:.5rem;font-size:1rem;font-family:inherit;outline:none;transition:border-color .15s}
.hex-input-row input[type="text"]:focus{border-color:#3b82f6}
.hex-input-row button{padding:.5rem 1.25rem;background:#e2e8f0;border:2px solid #cbd5e1;border-radius:.5rem;font-weight:600;font-size:.938rem;transition:background .15s}
.hex-input-row button:hover{background:#cbd5e1}
.pick-label{display:block;font-size:1rem;font-weight:600;color:#0f172a;margin-top:1rem;margin-bottom:.5rem}
.native-color{width:100%;height:3rem;border:2px solid #cbd5e1;border-radius:.5rem;cursor:pointer;padding:0;background:none}
.native-color::-webkit-color-swatch-wrapper{padding:2px}
.native-color::-webkit-color-swatch{border:none;border-radius:.375rem}

/* Column 2 — preview */
.color-preview-box{width:100%;max-width:300px;margin:0 auto;aspect-ratio:1/1;border-radius:.75rem;border:4px solid #e2e8f0;box-shadow:0 4px 12px rgba(0,0,0,.1);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.75rem;margin-bottom:1rem}
.color-preview-box .sample{font-size:1.375rem;font-weight:700}
.color-values{text-align:center;max-width:300px;margin:0 auto}
.color-values .hex-val{font-size:1.5rem;font-weight:700;color:#0f172a;font-family:"Courier New",Courier,monospace}
.color-values .sub-val{font-size:1rem;color:#475569;font-family:"Courier New",Courier,monospace;margin-top:.25rem}

/* Column 3 — shades */
.shade-row{display:flex;align-items:center;width:100%;gap:.5rem;padding:.125rem 0;cursor:pointer;transition:transform .1s}
.shade-row:hover{transform:scaleX(1.02)}
.shade-pct{width:3rem;text-align:right;font-weight:700;font-size:.813rem;color:#0f172a;flex-shrink:0}
.shade-bar{flex:1;height:1.75rem;border:1px solid #cbd5e1;transition:border-color .15s}
.shade-row:hover .shade-bar{border-color:#3b82f6}
.shade-hex{width:5rem;font-family:"Courier New",Courier,monospace;font-size:.813rem;color:#0f172a;font-weight:600;flex-shrink:0}

/* =============================================
   QUICK ACTIONS & SAVED
   ============================================= */
.actions-row{display:grid;grid-template-columns:1fr;gap:1.5rem;margin-bottom:2rem}
.act-card{background:#fff;border-radius:.75rem;box-shadow:0 4px 16px rgba(0,0,0,.06);border:1px solid #e2e8f0;padding:1.5rem}
.act-card h2{font-size:1.125rem;font-weight:700;color:#0f172a;margin-bottom:1rem;display:flex;align-items:center;gap:.5rem}
.act-card h2 svg{width:1.25rem;height:1.25rem;flex-shrink:0}
.act-grid{display:grid;grid-template-columns:1fr 1fr;gap:.75rem}
.act-btn{display:inline-flex;align-items:center;justify-content:center;gap:.5rem;padding:.75rem 1rem;border-radius:.5rem;font-weight:600;font-size:.875rem;color:#fff;transition:all .15s;border:none;cursor:pointer}
.act-btn svg{width:1rem;height:1rem;flex-shrink:0}
.act-btn.ab-blue{background:#2563eb}.act-btn.ab-blue:hover{background:#1d4ed8}
.act-btn.ab-green{background:#16a34a}.act-btn.ab-green:hover{background:#15803d}
.act-btn.ab-rose{background:#e11d48}.act-btn.ab-rose:hover{background:#be123c}
.act-btn.ab-purple{background:#9333ea}.act-btn.ab-purple:hover{background:#7e22ce}

.saved-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:1rem}
.saved-header h2{margin-bottom:0}
.clear-all{font-size:.75rem;color:#64748b;cursor:pointer;transition:color .15s;background:none;border:none;font-family:inherit}
.clear-all:hover{color:#dc2626}
.saved-empty{text-align:center;color:#94a3b8;padding:2rem 0;font-size:.938rem}
.saved-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:.5rem}
.saved-swatch{aspect-ratio:1/1;border-radius:.5rem;border:2px solid #e2e8f0;cursor:pointer;transition:all .15s;position:relative}
.saved-swatch:hover{border-color:#3b82f6;transform:scale(1.1)}
.saved-swatch .remove-x{position:absolute;top:-4px;right:-4px;width:1.25rem;height:1.25rem;background:#ef4444;color:#fff;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:.75rem;font-weight:700;opacity:0;transition:opacity .15s;border:none;cursor:pointer;line-height:1}
.saved-swatch:hover .remove-x{opacity:1}

/* =============================================
   PALETTE TABS
   ============================================= */
.palette-card{background:#fff;border-radius:.75rem;box-shadow:0 10px 40px rgba(0,0,0,.08);border:1px solid #e2e8f0;overflow:hidden;margin-bottom:2rem}
.palette-tabs{display:flex;flex-wrap:wrap;border-bottom:1px solid #e2e8f0}
.palette-tab{flex:1;min-width:7rem;padding:.875rem 1rem;font-weight:600;font-size:.875rem;display:flex;align-items:center;justify-content:center;gap:.5rem;transition:all .15s;color:#64748b;background:#fff;border:none;cursor:pointer;font-family:inherit}
.palette-tab:hover{background:#f8fafc}
.palette-tab.active{background:#2563eb;color:#fff}
.palette-tab svg{width:1rem;height:1rem;flex-shrink:0}
.palette-body{padding:1.5rem}
.palette-panel{display:none}
.palette-panel.active{display:block}

.palette-divider{height:4px;border-radius:2px;margin-bottom:1.5rem}

/* Material / Tailwind grid */
.color-family{margin-bottom:1.5rem}
.color-family:last-child{margin-bottom:0}
.family-name{font-weight:700;color:#0f172a;margin-bottom:.5rem;display:flex;align-items:center;gap:.5rem;font-size:.938rem}
.family-dot{width:1rem;height:1rem;border-radius:50%;flex-shrink:0}
.color-row{display:grid;grid-template-columns:repeat(10,1fr)}
.color-tile{aspect-ratio:1/1;cursor:pointer;border-right:1px solid rgba(0,0,0,.05);border-bottom:1px solid rgba(0,0,0,.05);position:relative;transition:transform .1s,z-index 0s}
.color-tile:last-child{border-right:none}
.color-tile:hover{transform:scale(1.15);z-index:5}
.color-tile .tile-tip{position:absolute;bottom:110%;left:50%;transform:translateX(-50%);background:#0f172a;color:#fff;font-size:.688rem;padding:.25rem .5rem;border-radius:.375rem;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .15s;z-index:10}
.color-tile:hover .tile-tip{opacity:1}

/* Flat UI cards */
.flat-grid{display:grid;grid-template-columns:1fr 1fr;gap:1.25rem}
.flat-card{border-radius:.75rem;overflow:hidden;border:2px solid #e2e8f0;transition:all .2s;box-shadow:0 2px 8px rgba(0,0,0,.05)}
.flat-card:hover{border-color:#3b82f6;box-shadow:0 6px 20px rgba(0,0,0,.1)}
.flat-preview{position:relative;aspect-ratio:1/1;overflow:hidden}
.flat-half{position:absolute;inset:0;cursor:pointer;transition:transform .15s}
.flat-half:hover{transform:scale(1.05)}
.flat-info{padding:1rem;background:#fff}
.flat-info h3{font-weight:700;color:#0f172a;font-size:.875rem;margin-bottom:.375rem}
.flat-info .flat-hexes{display:flex;gap:.75rem;font-family:"Courier New",Courier,monospace;font-size:.75rem;color:#64748b}

/* Gradient cards */
.grad-grid{display:grid;grid-template-columns:1fr;gap:1.25rem}
.grad-card{border-radius:.75rem;overflow:hidden;border:2px solid #e2e8f0;transition:all .2s;box-shadow:0 2px 8px rgba(0,0,0,.05)}
.grad-card:hover{border-color:#3b82f6;box-shadow:0 6px 20px rgba(0,0,0,.1)}
.grad-banner{height:10rem;position:relative;cursor:pointer}
.grad-banner .grad-label{position:absolute;bottom:0;left:0;right:0;padding:1rem;background:linear-gradient(to top,rgba(0,0,0,.55),transparent);color:#fff;font-weight:700;font-size:1.125rem}
.grad-swatches{padding:1rem;background:#fff}
.grad-swatch-row{display:grid;grid-template-columns:repeat(4,1fr);gap:.5rem}
.grad-swatch{aspect-ratio:1/1;border-radius:.5rem;border:2px solid #e2e8f0;cursor:pointer;transition:all .15s;position:relative}
.grad-swatch:hover{transform:scale(1.1);border-color:#3b82f6}
.grad-swatch .swatch-tip{position:absolute;bottom:110%;left:50%;transform:translateX(-50%);background:#0f172a;color:#fff;font-size:.688rem;padding:.125rem .375rem;border-radius:.25rem;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .15s;z-index:10}
.grad-swatch:hover .swatch-tip{opacity:1}
.grad-copy-css{display:flex;align-items:center;justify-content:center;gap:.375rem;margin-top:.75rem;font-size:.75rem;color:#2563eb;font-weight:600;cursor:pointer;background:none;border:none;font-family:inherit;transition:color .15s}
.grad-copy-css:hover{color:#1d4ed8}
.grad-copy-css svg{width:.75rem;height:.75rem}

/* =============================================
   EDUCATIONAL CONTENT
   ============================================= */
.edu-grid{display:grid;grid-template-columns:1fr;gap:1.5rem;margin-bottom:2rem}
.edu-card{border-radius:.75rem;padding:1.5rem;border:1px solid}
.edu-card.edu-blue{background:linear-gradient(135deg,#eff6ff,#e0e7ff);border-color:#bfdbfe}
.edu-card.edu-green{background:linear-gradient(135deg,#f0fdf4,#ecfdf5);border-color:#bbf7d0}
.edu-card h3{font-size:1.125rem;font-weight:700;margin-bottom:.75rem;display:flex;align-items:center;gap:.5rem}
.edu-card.edu-blue h3{color:#1e3a5f}
.edu-card.edu-green h3{color:#14532d}
.edu-card h3 svg{width:1.25rem;height:1.25rem;flex-shrink:0}
.edu-card p{font-size:.875rem;line-height:1.7;margin-bottom:.75rem}
.edu-card p:last-child{margin-bottom:0}
.edu-card.edu-blue p{color:#1e40af}
.edu-card.edu-green p{color:#166534}
.css-example{background:#fff;border-radius:.5rem;padding:1rem;font-family:"Courier New",Courier,monospace;font-size:.875rem;line-height:1.8}
.css-example .prop{color:#9333ea}
.css-example .val{color:#2563eb}

/* =============================================
   TOAST
   ============================================= */
.toast{position:fixed;bottom:1.5rem;left:50%;transform:translateX(-50%);background:#0f172a;color:#fff;padding:.75rem 1.5rem;border-radius:.5rem;font-size:.875rem;font-weight:500;z-index:9999;box-shadow:0 4px 12px rgba(0,0,0,.2);transition:opacity .3s;pointer-events:none}

/* =============================================
   RESPONSIVE
   ============================================= */
@media(min-width:640px){
  .cp-page-header h1{font-size:2.5rem}
  .flat-grid{grid-template-columns:repeat(3,1fr)}
  .grad-grid{grid-template-columns:1fr 1fr}
}

@media(min-width:768px){
  .desktop-nav{display:flex}
  .mobile-menu-btn{display:none}
  .footer-grid{grid-template-columns:2fr 1fr 1fr}
  .actions-row{grid-template-columns:1fr 1fr}
  .edu-grid{grid-template-columns:1fr 1fr}
  .flat-grid{grid-template-columns:repeat(3,1fr)}
  .grad-grid{grid-template-columns:repeat(2,1fr)}
}

@media(min-width:1024px){
  .container{padding:0 2rem}
  .footer-grid{grid-template-columns:2fr 1fr 1fr 2fr}
  .footer-all-links ul{columns:3}
  .picker-grid{grid-template-columns:1fr 1fr 1fr}
  .flat-grid{grid-template-columns:repeat(4,1fr)}
  .grad-grid{grid-template-columns:repeat(3,1fr)}
}
