/*
Theme Name: Blockframe
Theme URI: https://example.com/blockframe
Author: Your Studio
Author URI: https://example.com
Description: A colorful, block-driven WordPress theme for product and SaaS sites — built in the spirit of flexible, database-style tools where content organizes itself into grids, views, and cards. Bold geometric type, a rainbow accent system, a left-nav app shell with a real user-account menu, and a signature animated "cell grid" hero. Includes light/dark mode, GravityView compatibility styling, and a full set of Customizer appearance controls.
Version: 2.8.2
Requires at least: 6.0
Tested up to: 6.6
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: LICENSE
Text Domain: blockframe
Tags: blog, one-column, two-columns, grid-layout, custom-logo, custom-menu, custom-colors, editor-style, featured-images, full-width-template, threaded-comments, translation-ready
*/

/* ==========================================================================
   0. Tokens
   ========================================================================== */
:root{
  --ink:        #17181C;
  --ink-soft:   #4A4C56;
  --paper:      #FBF9F4;
  --paper-dim:  #F1EEE5;
  --line:       #E6E2D6;
  --surface:    #FFFFFF;
  --text:       var(--ink);
  --text-soft:  var(--ink-soft);
  --header-bg:  rgba(251,249,244,0.85);

  --yellow:     #FFC629;
  --coral:      #FF6B5E;
  --blue:       #2D7FF9;
  --violet:     #8B5CF6;
  --teal:       #12B3A8;

  --sidebar-bg: var(--paper-dim);
  --logo-bg:    transparent;
  --logo-size:  30px;

  --nav-hover:  rgba(255,255,255,.7);

  --display: "Sora", "Segoe UI", system-ui, sans-serif;
  --body:    "Inter", "Segoe UI", system-ui, sans-serif;
  --mono:    "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --body-font-size:   17px;
  --body-line-height: 1.6;
  --heading-weight:   700;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 28px;

  --shadow-card: 0 2px 0 rgba(23,24,28,0.06), 0 12px 30px -14px rgba(23,24,28,0.18);
  --container: 1180px;
  color-scheme: light;
}

/* Dark mode — toggled by setting data-theme="dark" on <html> (see js/main.js
   and the inline no-flash script in header.php / template-parts/app-shell.php).
   Uses html[data-theme="dark"] (type + attribute selector) rather than a
   plain [data-theme="dark"], so it reliably outranks the Customizer's
   inline :root overrides (equal-specificity rules resolve by source order,
   and the Customizer's <style> tag is injected after this stylesheet). */
html[data-theme="dark"]{
  --ink:        #17181C;
  --ink-soft:   #4A4C56;
  --paper:      #17181A;
  --paper-dim:  #202023;
  --line:       #34343A;
  --surface:    #232326;
  --text:       #F1EFE7;
  --text-soft:  #ABA89C;
  --header-bg:  rgba(23,24,26,0.85);
  --sidebar-bg: #202023;
  --nav-hover:  rgba(255,255,255,.06);
  --shadow-card: 0 2px 0 rgba(0,0,0,0.2), 0 12px 30px -14px rgba(0,0,0,0.5);
  color-scheme: dark;
}

/* ==========================================================================
   1. Reset & base
   ========================================================================== */
*,*::before,*::after{ box-sizing:border-box; }
html{ scroll-behavior:smooth; }
body{
  margin:0;
  background:var(--paper);
  color:var(--text);
  font-family:var(--body);
  font-size:var(--body-font-size);
  line-height:var(--body-line-height);
  -webkit-font-smoothing:antialiased;
}
img{ max-width:100%; height:auto; display:block; }
a{ color:inherit; text-decoration:none; }
ul{ margin:0; padding:0; list-style:none; }
button{ font-family:inherit; cursor:pointer; }
h1,h2,h3,h4{
  font-family:var(--display);
  font-weight:var(--heading-weight);
  line-height:1.1;
  margin:0 0 .5em;
  letter-spacing:-0.01em;
}
p{ margin:0 0 1em; color:var(--text-soft); }

:focus-visible{
  outline:3px solid var(--blue);
  outline-offset:3px;
}

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

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

.eyebrow{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-family:var(--mono);
  font-size:13px;
  font-weight:500;
  letter-spacing:0.04em;
  color:var(--text-soft);
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:999px;
  padding:6px 14px;
}
.eyebrow .dot{ width:7px; height:7px; border-radius:50%; background:var(--coral); }

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:13px 24px;
  border-radius:999px;
  font-weight:600;
  font-size:15px;
  border:1px solid transparent;
  transition:transform .15s ease, box-shadow .15s ease, background .15s ease;
  white-space:nowrap;
}
.btn:hover{ transform:translateY(-1px); }
.btn-primary{ background:var(--ink); color:#fff; }
.btn-primary:hover{ box-shadow:0 8px 20px -8px rgba(23,24,28,.5); }
.btn-outline{ background:var(--surface); border-color:var(--line); color:var(--text); }
.btn-outline:hover{ border-color:var(--text); }
.btn-yellow{ background:var(--yellow); color:var(--ink); }
.btn-yellow:hover{ box-shadow:0 8px 20px -8px rgba(255,198,41,.7); }

/* ==========================================================================
   2. Header
   ========================================================================== */
.site-header{
  position:sticky; top:0; z-index:50;
  background:var(--header-bg);
  backdrop-filter:blur(10px);
  border-bottom:1px solid var(--line);
}
.site-header .container{
  display:flex; align-items:center; justify-content:space-between;
  height:76px;
}
.site-branding{ display:flex; align-items:center; gap:10px; }
.site-branding .mark{
  background:linear-gradient(135deg,var(--yellow),var(--coral) 40%, var(--violet) 75%, var(--blue));
}
.site-title{ font-family:var(--display); font-weight:var(--heading-weight); font-size:19px; color:var(--text); }

/* Logo frame — wraps the custom logo image or the default gradient
   "mark" wherever either appears (site header, app-sidebar brand).
   Size and background are both Customizer-controlled tokens. In the
   app-shell sidebar specifically, it also shrinks when collapsed and
   grows back when expanded (see the .is-collapsed override below). */
.site-logo-frame{
  width:var(--logo-size); height:var(--logo-size); flex:0 0 auto;
  background:var(--logo-bg); border-radius:9px; overflow:hidden;
  display:flex; align-items:center; justify-content:center;
  transition:width .18s ease, height .18s ease;
}
.site-logo-frame img{ max-width:100%; max-height:100%; object-fit:contain; display:block; }
.site-logo-frame .mark{ width:100%; height:100%; border-radius:9px; }

/* Collapsed sidebar: shrink the logo to fit the icon-only column — never
   larger than the expanded (Customizer) size, only ever smaller. */
.app-shell.is-collapsed .site-logo-frame{
  width:min(24px, var(--logo-size));
  height:min(24px, var(--logo-size));
}

.main-navigation{ display:flex; align-items:center; gap:4px; }
.main-navigation ul{ display:flex; align-items:center; gap:2px; }
.main-navigation li{ position:relative; }
.main-navigation a{
  display:inline-block;
  padding:10px 16px;
  border-radius:999px;
  font-size:15px;
  font-weight:500;
  color:var(--text-soft);
  transition:background .15s ease, color .15s ease;
}
.main-navigation a:hover{ background:var(--paper-dim); color:var(--text); }

/* Submenu indicator — a small CSS-only chevron, so no icon markup is
   needed inside the default wp_nav_menu() output for this location. */
.main-navigation li.menu-item-has-children > a::after{
  content:""; display:inline-block; width:5px; height:5px; margin:0 0 1px 6px;
  border-right:1.5px solid currentColor; border-bottom:1.5px solid currentColor;
  transform:rotate(45deg);
}

/* Dropdown submenu (desktop): hidden until hover/focus on its parent. */
.main-navigation .sub-menu{
  display:none; flex-direction:column; align-items:stretch; gap:0;
  position:absolute; top:100%; left:0; margin-top:8px; min-width:200px;
  background:var(--surface); border:1px solid var(--line); border-radius:var(--radius-md);
  box-shadow:var(--shadow-card); padding:8px; z-index:60;
}
.main-navigation li.menu-item-has-children:hover > .sub-menu,
.main-navigation li.menu-item-has-children:focus-within > .sub-menu{ display:flex; }
.main-navigation .sub-menu a{ display:block; padding:10px 12px; border-radius:8px; white-space:nowrap; }
.main-navigation .sub-menu li.menu-item-has-children > a::after{ transform:rotate(-45deg) translate(1px,-1px); }
.main-navigation .sub-menu .sub-menu{ top:0; left:100%; margin-top:0; margin-left:8px; }

.header-actions{ display:flex; align-items:center; gap:10px; }
.menu-toggle{
  display:none;
  background:none; border:1px solid var(--line); border-radius:10px;
  width:42px; height:42px; align-items:center; justify-content:center;
}
.menu-toggle span, .menu-toggle span::before, .menu-toggle span::after{
  content:""; display:block; width:18px; height:2px; background:var(--text); position:relative;
}
.menu-toggle span::before{ position:absolute; top:-6px; }
.menu-toggle span::after{ position:absolute; top:6px; }

@media (max-width: 860px){
  .main-navigation{ display:none; }
  .menu-toggle{ display:flex; }
  .header-actions .btn-outline{ display:none; }
  body.nav-open .main-navigation{
    display:flex; position:absolute; top:76px; left:0; right:0;
    background:var(--paper); border-bottom:1px solid var(--line);
    padding:12px 24px 20px; flex-direction:column; align-items:stretch;
    max-height:calc(100vh - 76px); overflow-y:auto;
  }
  body.nav-open .main-navigation ul{ flex-direction:column; align-items:stretch; gap:0; }
  body.nav-open .main-navigation a{ padding:14px 10px; }
  /* On touch, there's no hover — submenus are always expanded inline,
     indented under their parent, instead of a hover/click dropdown. */
  body.nav-open .main-navigation .sub-menu{
    display:flex; position:static; box-shadow:none; border:none; background:none;
    margin:0 0 0 16px; padding:0;
  }
  body.nav-open .main-navigation .sub-menu .sub-menu{ margin-left:16px; }
}

/* ==========================================================================
   3. Hero + signature cell grid
   ========================================================================== */
.hero{ padding:88px 0 60px; overflow:hidden; }
.hero-grid{
  display:grid; grid-template-columns: 1.05fr .95fr; gap:48px; align-items:center;
}
.hero h1{ font-size:clamp(38px, 5vw, 62px); }
.hero .lede{ font-size:19px; max-width:46ch; margin-bottom:28px; }
.hero-cta{ display:flex; gap:12px; flex-wrap:wrap; margin-bottom:18px; }
.hero-note{ font-size:13px; color:var(--text-soft); font-family:var(--mono); }

.cellboard{
  --n: 4;
  position:relative;
  aspect-ratio: 1 / 0.85;
  border-radius:var(--radius-lg);
  background:var(--surface);
  border:1px solid var(--line);
  box-shadow:var(--shadow-card);
  padding:18px;
  display:grid;
  grid-template-columns:repeat(4, 1fr);
  grid-template-rows:repeat(4, 1fr);
  gap:10px;
}
.cellboard .cell{
  border-radius:12px;
  background:var(--paper-dim);
  opacity:0;
  transform:translateY(10px) scale(.96);
  animation:cellIn .6s cubic-bezier(.2,.7,.2,1) forwards;
  position:relative;
  overflow:hidden;
}
.cellboard .cell span{
  position:absolute; top:8px; left:10px;
  font-family:var(--mono); font-size:10px; color:rgba(23,24,28,.35);
}
.cellboard .cell.c-yellow{ background:var(--yellow); }
.cellboard .cell.c-coral{ background:var(--coral); }
.cellboard .cell.c-blue{ background:var(--blue); }
.cellboard .cell.c-violet{ background:var(--violet); }
.cellboard .cell.c-teal{ background:var(--teal); }
.cellboard .cell.wide{ grid-column:span 2; }
.cellboard .cell.tall{ grid-row:span 2; }

@keyframes cellIn{ to{ opacity:1; transform:translateY(0) scale(1); } }

@media (max-width: 900px){
  .hero-grid{ grid-template-columns:1fr; }
  .cellboard{ order:-1; max-width:420px; margin:0 auto; }
}

/* ==========================================================================
   4. Logo / proof strip
   ========================================================================== */
.proof-strip{ padding:28px 0; border-top:1px solid var(--line); border-bottom:1px solid var(--line); }
.proof-strip .container{ display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:18px; }
.proof-strip .label{ font-family:var(--mono); font-size:12px; color:var(--text-soft); letter-spacing:.05em; }
.proof-logos{ display:flex; gap:32px; flex-wrap:wrap; align-items:center; }
.proof-logos span{ font-family:var(--display); font-weight:var(--heading-weight); color:var(--text-soft); opacity:.55; font-size:18px; }

/* ==========================================================================
   5. Feature grid ("blocks")
   ========================================================================== */
.section{ padding:96px 0; }
.section-head{ max-width:640px; margin-bottom:56px; }
.section-head h2{ font-size:clamp(28px, 3.6vw, 42px); }
.section-head p{ font-size:18px; }

.blocks-grid{
  display:grid; grid-template-columns:repeat(3, 1fr); gap:20px;
}
.block-card{
  background:var(--surface); border:1px solid var(--line); border-radius:var(--radius-md);
  padding:28px; box-shadow:var(--shadow-card);
  transition:transform .2s ease, box-shadow .2s ease;
}
.block-card:hover{ transform:translateY(-4px); }
.block-card .chip{
  width:40px; height:40px; border-radius:11px; margin-bottom:18px;
  display:flex; align-items:center; justify-content:center;
  font-family:var(--mono); font-size:12px; font-weight:600; color:var(--ink);
}
.block-card h3{ font-size:19px; margin-bottom:8px; }
.block-card p{ font-size:15px; margin-bottom:0; }

@media (max-width: 900px){ .blocks-grid{ grid-template-columns:1fr 1fr; } }
@media (max-width: 600px){ .blocks-grid{ grid-template-columns:1fr; } }

/* ==========================================================================
   6. View switcher (tabs mimicking grid/kanban/calendar views)
   ========================================================================== */
.views{ background:var(--paper-dim); border-radius:var(--radius-lg); padding:40px; }
.view-tabs{ display:flex; gap:8px; margin-bottom:28px; flex-wrap:wrap; }
.view-tab{
  padding:10px 18px; border-radius:999px; font-size:14px; font-weight:600;
  background:var(--surface); border:1px solid var(--line); color:var(--text-soft);
}
.view-tab[aria-selected="true"]{ background:var(--ink); color:#fff; border-color:var(--ink); }
.view-panel{ display:none; background:var(--surface); border:1px solid var(--line); border-radius:var(--radius-md); padding:24px; min-height:220px; }
.view-panel[data-active="true"]{ display:block; }

/* ==========================================================================
   7. Testimonials
   ========================================================================== */
.testimonials-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:20px; }
.testimonial-card{
  background:var(--surface); border:1px solid var(--line); border-radius:var(--radius-md);
  padding:26px; display:flex; flex-direction:column; gap:16px;
}
.testimonial-card blockquote{ margin:0; font-size:16px; color:var(--text); }
.testimonial-meta{ display:flex; align-items:center; gap:10px; }
.testimonial-avatar{ width:36px; height:36px; border-radius:50%; }
.testimonial-name{ font-weight:600; font-size:14px; }
.testimonial-role{ font-size:13px; color:var(--text-soft); }

@media (max-width: 900px){ .testimonials-grid{ grid-template-columns:1fr; } }

/* ==========================================================================
   8. CTA band
   ========================================================================== */
.cta-band{
  border-radius:var(--radius-lg);
  padding:64px 48px;
  background:var(--ink);
  color:#fff;
  display:flex; align-items:center; justify-content:space-between; gap:24px; flex-wrap:wrap;
  position:relative; overflow:hidden;
}
.cta-band::after{
  content:""; position:absolute; right:-60px; top:-60px; width:220px; height:220px;
  border-radius:50%; background:radial-gradient(circle, var(--yellow), transparent 70%); opacity:.5;
}
.cta-band h2{ color:#fff; margin-bottom:6px; font-size:clamp(24px,3vw,34px); }
.cta-band p{ color:rgba(255,255,255,.7); margin:0; }

/* ==========================================================================
   9. Blog / archive / single
   ========================================================================== */
.post-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:24px; }
.post-card{ background:var(--surface); border:1px solid var(--line); border-radius:var(--radius-md); overflow:hidden; box-shadow:var(--shadow-card); }
.post-card .thumb{ aspect-ratio:16/10; background:var(--paper-dim); overflow:hidden; }
.post-card .thumb img{ width:100%; height:100%; object-fit:cover; }
.post-card .body{ padding:20px; }
.post-card h3{ font-size:18px; margin-bottom:6px; }
.post-card .meta{ font-family:var(--mono); font-size:12px; color:var(--text-soft); margin-bottom:10px; }
@media (max-width: 900px){ .post-grid{ grid-template-columns:1fr 1fr; } }
@media (max-width: 600px){ .post-grid{ grid-template-columns:1fr; } }

.single-post{ max-width:760px; margin:0 auto; }
.single-post .entry-title{ font-size:clamp(30px,4.5vw,46px); }
.single-post .entry-meta{ font-family:var(--mono); font-size:13px; color:var(--text-soft); margin-bottom:32px; }
.single-post .entry-content > *{ margin-bottom:1.3em; }
.single-post .entry-content h2{ font-size:28px; margin-top:1.6em; }
.single-post .entry-content img{ border-radius:var(--radius-md); }

.pagination{ display:flex; gap:10px; justify-content:center; margin-top:48px; }
.pagination a, .pagination span{
  padding:9px 16px; border-radius:999px; border:1px solid var(--line); background:var(--surface); font-size:14px;
}
.pagination .current{ background:var(--ink); color:#fff; border-color:var(--ink); }

/* ==========================================================================
   10. Footer
   ========================================================================== */

/* Full-height page structure (marketing pages only — the app shell has
   its own height:100vh flex layout and isn't affected by this). Keeps
   short pages from looking sparse, and gives the fixed bottom bar below
   a consistent frame to sit against rather than floating over whatever
   height the page's content happens to add up to. */
body:not(.app-shell-page){
  display:flex; flex-direction:column; min-height:100vh;
  padding-bottom:64px; /* reserves space for .footer-bottom, fixed below */
}
body:not(.app-shell-page) #primary{ flex:1 0 auto; }

.site-footer{ border-top:1px solid var(--line); padding:64px 0 32px; margin-top:40px; }
.footer-grid{ display:grid; grid-template-columns:1.4fr repeat(3,1fr); gap:32px; margin-bottom:48px; }
.footer-brand .site-title{ display:block; margin-bottom:10px; }
.footer-brand p{ max-width:32ch; font-size:14px; }
.footer-col h4{ font-size:13px; font-family:var(--mono); text-transform:uppercase; letter-spacing:.06em; color:var(--text-soft); margin-bottom:16px; }
.footer-col ul li{ margin-bottom:10px; }
.footer-col a{ font-size:14px; color:var(--text-soft); }
.footer-col a:hover{ color:var(--text); }

/* Fixed bottom bar — stays pinned to the bottom of the viewport
   regardless of scroll position, rather than scrolling away with the
   rest of the footer above it. body's padding-bottom (above) reserves
   space so real content never sits underneath it. */
.footer-bottom{
  position:fixed; left:0; right:0; bottom:0; z-index:80;
  display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:12px;
  padding:14px 24px; border-top:1px solid var(--line); font-size:13px; color:var(--text-soft);
  background:var(--header-bg); backdrop-filter:blur(10px);
}

@media (max-width: 900px){ .footer-grid{ grid-template-columns:1fr 1fr; } }
@media (max-width: 600px){
  .footer-grid{ grid-template-columns:1fr; }
  .footer-bottom{ justify-content:center; text-align:center; }
}

/* ==========================================================================
   11. 404
   ========================================================================== */
.error-404{ padding:120px 0; text-align:center; }
.error-404 h1{ font-size:clamp(60px,10vw,140px); margin-bottom:0; }

/* ==========================================================================
   12. Utilities
   ========================================================================== */
.text-center{ text-align:center; margin-left:auto; margin-right:auto; }
.screen-reader-text{
  position:absolute !important; clip:rect(1px,1px,1px,1px); width:1px; height:1px; overflow:hidden;
}

/* ==========================================================================
   13. App shell — left-nav "desktop app" layout (template-app.php)
   ========================================================================== */
.app-shell{ display:flex; height:100vh; background:var(--paper); overflow:hidden; }

.app-sidebar{
  width:264px; flex:0 0 264px;
  background:var(--sidebar-bg);
  border-right:1px solid var(--line);
  display:flex; flex-direction:column;
  padding:14px 10px;
  position:relative;
  transition:width .18s ease, flex-basis .18s ease, transform .2s ease;
}
.app-shell.is-collapsed .app-sidebar{ width:72px; flex-basis:72px; }
.app-shell.is-collapsed .app-label,
.app-shell.is-collapsed .app-sidebar-title,
.app-shell.is-collapsed .app-user-meta,
.app-shell.is-collapsed .app-section-label,
.app-shell.is-collapsed .app-new-btn span{ display:none; }
.app-shell.is-collapsed .app-nav-item,
.app-shell.is-collapsed .app-recent-item{ justify-content:center; align-items:center; }
.app-shell.is-collapsed .app-nav-toggle{ display:none; }
.app-shell.is-collapsed .app-nav-submenu{ display:none; }
.app-shell.is-collapsed .app-nav-submenu.is-flyout{ display:flex; }
.app-shell.is-collapsed .app-new-btn{ width:44px; padding:11px; }

/* The flyout's own child items are always a left-aligned text list —
   never icon-only — so they need to opt back out of the icon-centering
   rule above. Even though the flyout is position:fixed (visually
   detached), it's still nested inside .app-shell.is-collapsed in the
   DOM, so that rule still matches its children by selector; only a
   more specific override actually excludes them. */
.app-shell.is-collapsed .app-nav-submenu.is-flyout .app-nav-item{
  justify-content:flex-start; align-items:center;
}

.app-sidebar-head{ display:flex; align-items:center; padding:6px 30px 16px 4px; flex:0 0 auto; }
.app-shell.is-collapsed .app-sidebar-head{ padding-right:4px; justify-content:center; }
.app-sidebar-brand{ display:flex; align-items:center; gap:9px; min-width:0; }
.app-sidebar-brand .mark{
  background:linear-gradient(135deg,var(--yellow),var(--coral) 40%, var(--violet) 75%, var(--blue));
}
.app-sidebar-title{ font-family:var(--display); font-weight:var(--heading-weight); font-size:16px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* Floating collapse toggle — sits on the sidebar's edge, independent of
   the logo row, so it never crowds the logo at any sidebar width. */
.app-collapse-edge-btn{
  position:absolute; top:20px; right:-13px; z-index:6;
  width:26px; height:26px; border-radius:50%;
  background:var(--surface); border:1px solid var(--line); box-shadow:var(--shadow-card);
  display:flex; align-items:center; justify-content:center; color:var(--text-soft);
  transition:color .15s ease, border-color .15s ease;
}
.app-collapse-edge-btn:hover{ color:var(--text); border-color:var(--text); }
.app-collapse-edge-btn svg{ width:13px; height:13px; transition:transform .18s ease; }
.app-shell.is-collapsed .app-collapse-edge-btn svg{ transform:rotate(180deg); }
@media (max-width:760px){ .app-collapse-edge-btn{ display:none; } }

.app-icon-btn{
  width:30px; height:30px; border-radius:8px; border:1px solid var(--line); background:var(--surface);
  display:flex; align-items:center; justify-content:center; flex:0 0 auto; color:var(--text-soft);
}
.app-icon-btn:hover{ color:var(--text); border-color:var(--text); }
.app-icon-btn svg{ width:15px; height:15px; }

/* Dark mode toggle — sun/moon swap based on html[data-theme] */
.theme-toggle .icon-sun,
.theme-toggle .icon-moon{ display:flex; align-items:center; justify-content:center; }
.theme-toggle .icon-sun{ display:none; }
html[data-theme="dark"] .theme-toggle .icon-sun{ display:flex; }
html[data-theme="dark"] .theme-toggle .icon-moon{ display:none; }

.app-new-btn{
  display:flex; align-items:center; justify-content:center; gap:8px;
  width:100%; padding:11px 14px; margin-bottom:16px;
  border-radius:12px; background:var(--ink); color:#fff; font-weight:600; font-size:14px;
}
.app-new-btn:hover{ transform:translateY(-1px); }
.app-new-btn svg{ width:16px; height:16px; flex:0 0 auto; }

/* Nav list — flex:1 fills whatever space is left between the fixed
   header (logo) and fixed footer (user row) below, and scrolls
   independently once items overflow that space. This is what lets the
   sidebar handle a large number of items: the header/footer never move,
   only the list in between scrolls. */
.app-nav{
  display:flex; flex-direction:column; gap:2px;
  flex:1; min-height:0; overflow-y:auto;
  padding:2px 0 8px;
  scrollbar-width:thin; scrollbar-color:var(--line) transparent;
}
.app-nav::-webkit-scrollbar{ width:6px; }
.app-nav::-webkit-scrollbar-thumb{ background:var(--line); border-radius:3px; }
.app-nav::-webkit-scrollbar-track{ background:transparent; }

.app-nav-item-wrap{ display:flex; align-items:stretch; gap:2px; }
.app-nav-item-wrap .app-nav-item{ flex:1; min-width:0; }

.app-nav-item{
  display:flex; align-items:flex-start; gap:10px; padding:9px 10px; border-radius:10px;
  font-size:14px; font-weight:500; color:var(--text-soft); line-height:1.35;
}
.app-nav-item svg{ width:18px; height:18px; flex:0 0 auto; }
.app-nav-item .app-label{ overflow-wrap:anywhere; }
.app-nav-item:hover{ background:var(--nav-hover); color:var(--text); }
.app-nav-item.is-active{ background:var(--surface); color:var(--text); box-shadow:var(--shadow-card); }

/* Tooltip — shown only in the collapsed (icon-only) sidebar state, to
   the right of the icon, since the label itself is hidden there.
   This is a single shared element appended to <body> and positioned by
   JS (js/main.js) from the hovered icon's getBoundingClientRect() —
   not a CSS ::after on the icon itself. That's necessary, not just a
   style choice: the icon lives inside .app-nav, which has
   overflow-y:auto (so a large number of items can scroll) — and CSS
   has no way to let one axis scroll while letting content overflow
   visibly on the other axis, so a same-element tooltip would always be
   clipped. Living at the body level sidesteps that entirely. */
.app-tooltip{
  position:fixed; z-index:9999;
  background:var(--ink); color:#fff; font-family:var(--body); font-size:12px; font-weight:500;
  padding:6px 10px; border-radius:8px; white-space:nowrap; box-shadow:var(--shadow-card);
  opacity:0; pointer-events:none;
  transition:opacity .12s ease;
}
.app-tooltip.is-visible{ opacity:1; }

/* Submenu expand/collapse toggle (rendered only on items with children) */
.app-nav-toggle{
  flex:0 0 auto; width:28px; border-radius:8px; background:none; border:none;
  display:flex; align-items:center; justify-content:center; color:var(--text-soft);
}
.app-nav-toggle:hover{ background:var(--nav-hover); color:var(--text); }
.app-nav-toggle svg{ width:14px; height:14px; transition:transform .15s ease; }
.app-nav-toggle.is-open svg{ transform:rotate(180deg); }

.app-nav-submenu{ display:flex; flex-direction:column; gap:2px; margin:2px 0 4px; }
.app-nav-submenu[hidden]{ display:none; }
.app-nav-submenu .app-nav-item{ font-size:13px; }
.app-nav-submenu .app-nav-item svg{ display:none; }

/* Collapsed-sidebar flyout — the same .app-nav-submenu element as above,
   repositioned by JS (js/main.js) to drop down below the hovered parent
   icon, anchored to the sidebar's own left edge (not floating off to
   the right into the main content area).

   Uses a fixed dark background + light text (the same convention as
   .app-tooltip) rather than the theme's --surface/--text tokens, so it
   reads clearly regardless of whatever Side navigation color or Body
   background color you've set in the Customizer — those could
   otherwise end up close in tone to --surface and hurt legibility. */
.app-nav-submenu.is-flyout{
  position:fixed; z-index:9999; margin:0;
  background:var(--ink); border:1px solid rgba(255,255,255,.14); border-radius:var(--radius-md);
  box-shadow:var(--shadow-card); padding:8px; min-width:180px;
}
.app-nav-submenu.is-flyout .app-nav-item{
  padding-left:10px !important; /* overrides the inline indent style used in the expanded, inline view */
  color:rgba(255,255,255,.78);
}
.app-nav-submenu.is-flyout .app-nav-item:hover{
  background:rgba(255,255,255,.14); color:#fff;
}
.app-nav-submenu.is-flyout .app-nav-item.is-active{
  background:rgba(255,255,255,.18); color:#fff; box-shadow:none;
}
.app-nav-submenu-flyout-title{
  font-family:var(--mono); font-size:11px; letter-spacing:.05em; text-transform:uppercase;
  color:rgba(255,255,255,.55); padding:4px 10px 8px; margin-bottom:2px;
  border-bottom:1px solid rgba(255,255,255,.14);
}

.app-section-label{
  font-family:var(--mono); font-size:11px; letter-spacing:.06em; text-transform:uppercase;
  color:var(--text-soft); padding:0 10px; margin-bottom:8px;
}
.app-recent{ display:flex; flex-direction:column; gap:1px; overflow-y:auto; flex:1; min-height:0; }
.app-recent-item{
  display:flex; align-items:center; gap:10px; padding:8px 10px; border-radius:10px;
  font-size:13px; color:var(--text-soft); white-space:nowrap; overflow:hidden;
}
.app-recent-item .app-label{ overflow:hidden; text-overflow:ellipsis; }
.app-recent-item:hover{ background:var(--nav-hover); color:var(--text); }
.app-recent-item .swatch{ width:8px; height:8px; border-radius:3px; flex:0 0 auto; }

/* Sidebar profile card — sits right under the logo. Shows avatar,
   name, email, and a Sign Out (or Log In) link; collapses to just the
   small avatar when the sidebar is collapsed, same as nav labels do. */
.app-sidebar-profile{
  flex:0 0 auto; display:flex; flex-direction:column; align-items:center; text-align:center;
  padding:4px 14px 20px; margin-bottom:12px; border-bottom:1px solid var(--line);
}
.app-sidebar-profile-avatar{
  width:64px; height:64px; border-radius:50%; margin-bottom:12px; overflow:hidden; flex:0 0 auto;
}
.app-sidebar-profile-avatar img{ width:100%; height:100%; object-fit:cover; display:block; }
.app-sidebar-profile-avatar-fallback{
  display:flex; align-items:center; justify-content:center;
  background:var(--ink); color:#fff; font-size:20px; font-weight:600;
}
.app-sidebar-profile-name{
  font-family:var(--display); font-weight:var(--heading-weight); font-size:15px; color:var(--text);
  max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.app-sidebar-profile-email{
  font-size:12px; color:var(--text-soft); margin-top:2px;
  max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.app-sidebar-profile-signout{
  display:flex; align-items:center; gap:6px; margin-top:14px;
  padding:7px 14px; border-radius:999px; border:1px solid var(--line);
  font-size:12px; font-weight:600; color:var(--text-soft);
}
.app-sidebar-profile-signout svg{ width:14px; height:14px; }
.app-sidebar-profile-signout:hover{ color:var(--text); border-color:var(--text); }

.app-shell.is-collapsed .app-sidebar-profile{ padding:4px 0 16px; }
.app-shell.is-collapsed .app-sidebar-profile-avatar{ width:32px; height:32px; margin-bottom:0; }
.app-shell.is-collapsed .app-sidebar-profile-avatar-fallback{ font-size:13px; }
.app-shell.is-collapsed .app-sidebar-profile-name,
.app-shell.is-collapsed .app-sidebar-profile-email,
.app-shell.is-collapsed .app-sidebar-profile-signout{ display:none; }

.app-main{ flex:1; min-width:0; display:flex; flex-direction:column; height:100vh; }
.app-topbar{
  height:64px; flex:0 0 auto; border-bottom:1px solid var(--line);
  display:flex; align-items:center; justify-content:space-between; padding:0 24px; gap:16px;
}
.app-topbar-left{ display:flex; align-items:center; gap:14px; min-width:0; }
.app-drawer-toggle{ display:none; }
.app-search{
  display:flex; align-items:center; gap:8px; background:var(--paper-dim); border-radius:10px;
  padding:8px 12px; flex:1; max-width:340px;
}
.app-search svg{ width:15px; height:15px; color:var(--text-soft); flex:0 0 auto; }
.app-search input{ border:none; background:none; outline:none; font-size:14px; width:100%; font-family:var(--body); color:var(--text); }
.app-search-kbd{
  flex:0 0 auto; font-family:var(--mono); font-size:11px; color:var(--text-soft);
  background:var(--surface); border:1px solid var(--line); border-radius:6px; padding:2px 6px;
}
@media (max-width:1080px){ .app-search-kbd{ display:none; } }
.app-topbar-avatar{
  width:32px; height:32px; border-radius:50%; background:var(--ink); color:#fff;
  display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:600; flex:0 0 auto;
  border:none; padding:0; font-family:inherit; cursor:pointer;
}
.app-topbar-avatar img{ width:100%; height:100%; object-fit:cover; border-radius:50%; display:block; }

/* User account menu — button + dropdown panel */
.app-user-menu{ position:relative; flex:0 0 auto; }
.app-user-menu-panel{
  position:absolute; top:calc(100% + 10px); right:0; z-index:50;
  min-width:200px; background:var(--surface); border:1px solid var(--line);
  border-radius:var(--radius-md); box-shadow:var(--shadow-card); padding:10px;
}
.app-user-menu-panel[hidden]{ display:none; }
.app-user-menu-header{ padding:4px 10px 10px; border-bottom:1px solid var(--line); margin-bottom:6px; }
.app-user-menu-name{ font-size:14px; font-weight:600; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.app-user-menu-role{ font-size:12px; color:var(--text-soft); }
.app-user-menu-links{ display:flex; flex-direction:column; gap:2px; }
.app-user-menu-item{
  display:flex; align-items:center; gap:10px; padding:9px 10px; border-radius:8px;
  font-size:14px; color:var(--text-soft); white-space:nowrap;
}
.app-user-menu-item svg{ width:16px; height:16px; flex:0 0 auto; }
.app-user-menu-item:hover,
.app-user-menu-item.is-active{ background:var(--paper-dim); color:var(--text); }

/* Back to top */
.back-to-top{
  position:fixed; bottom:24px; right:24px; z-index:40;
  width:42px; height:42px; border-radius:50%;
  background:var(--surface); border:1px solid var(--line); box-shadow:var(--shadow-card);
  display:flex; align-items:center; justify-content:center; color:var(--text-soft);
  opacity:0; transform:translateY(8px); pointer-events:none;
  transition:opacity .2s ease, transform .2s ease, color .15s ease, border-color .15s ease;
}
.back-to-top.is-visible{ opacity:1; transform:translateY(0); pointer-events:auto; }
.back-to-top:hover{ color:var(--text); border-color:var(--text); }
.back-to-top svg{ width:18px; height:18px; }
@media (max-width:760px){ .back-to-top{ right:16px; bottom:16px; } }

/* On marketing pages (not the app shell), the fixed footer bar sits at
   the very bottom of the viewport — raise the button above it so the
   two never overlap. */
body:not(.app-shell-page) .back-to-top{ bottom:84px; }
@media (max-width:760px){ body:not(.app-shell-page) .back-to-top{ bottom:76px; } }

.app-content{ padding:28px 32px 40px; flex:1; overflow-y:auto; }
.app-content-head{ margin-bottom:24px; }
.app-content-head h1{ font-size:24px; margin-bottom:4px; }
.app-content-head p{ font-size:14px; margin-bottom:0; }
.app-grid{ display:grid; grid-template-columns:repeat(3, 1fr); gap:16px; }

/* App-shell footer bar. Deliberately NOT position:fixed — .app-main is
   already a flex column with a fixed height (100vh) where only
   .app-content scrolls internally; a plain flex sibling placed after it
   naturally never moves on scroll, the same way .app-topbar above
   doesn't, without needing to fight overlap/z-index the way a truly
   fixed element would. */
.app-footer-bar{
  flex:0 0 auto; display:flex; justify-content:space-between; align-items:center;
  flex-wrap:wrap; gap:12px; padding:12px 32px; border-top:1px solid var(--line);
  font-size:12px; color:var(--text-soft);
}
@media (max-width:760px){ .app-footer-bar{ padding:12px 20px; justify-content:center; text-align:center; } }

/* The back-to-top button is fixed to the viewport (unlike the footer
   bar above), so raise it to clear the bar rather than overlap it. */
body.app-shell-page .back-to-top{ bottom:84px; }
@media (max-width:760px){ body.app-shell-page .back-to-top{ bottom:76px; } }

.app-empty-state{
  border:1px dashed var(--line); border-radius:var(--radius-md);
  padding:48px 32px; text-align:center; max-width:420px; margin:24px auto;
}
.app-empty-state-icon{
  display:inline-flex; align-items:center; justify-content:center;
  width:44px; height:44px; border-radius:12px; background:var(--paper-dim);
  color:var(--text-soft); margin-bottom:16px;
}
.app-empty-state-icon svg{ width:20px; height:20px; }
.app-empty-state h3{ font-size:17px; margin-bottom:6px; }
.app-empty-state p{ font-size:14px; margin-bottom:20px; }

@media (max-width: 960px){
  .app-grid{ grid-template-columns:1fr 1fr; }
}

@media (max-width: 760px){
  .app-sidebar{
    position:fixed; top:0; left:0; bottom:0; z-index:60; width:264px; flex-basis:264px;
    transform:translateX(-100%); box-shadow:0 0 0 100vmax rgba(23,24,28,0);
  }
  .app-shell.is-drawer-open .app-sidebar{ transform:translateX(0); box-shadow:0 0 0 100vmax rgba(23,24,28,.35); }
  .app-shell.is-collapsed .app-sidebar{ width:264px; flex-basis:264px; }
  .app-shell.is-collapsed .app-label,
  .app-shell.is-collapsed .app-sidebar-title,
  .app-shell.is-collapsed .app-user-meta,
  .app-shell.is-collapsed .app-section-label,
  .app-shell.is-collapsed .app-new-btn span{ display:inline; }
  .app-drawer-toggle{ display:flex; }
  .app-content{ padding:20px; }
  .app-grid{ grid-template-columns:1fr; }
  .app-search{ display:none; }
}

/* ==========================================================================
   14. GravityView + Gravity Forms compatibility
   Restyles GravityView's default output (Table/List views, search widget,
   pagination, single-entry) and the Gravity Forms fields it embeds for
   search/edit/entry, so both read as part of Blockframe rather than as an
   unstyled plugin drop-in. Column headers use the theme's mono cell-label
   treatment, since a table of entries is exactly the "list becomes a grid"
   idea the rest of the theme is built around.
   ========================================================================== */

.gv-container, .gravityview-container{
  font-family:var(--body); color:var(--text); font-size:15px;
}
.gv-container h1, .gv-container h2, .gv-container h3{ font-family:var(--display); }

/* Search widget */
.gv-search-box, .gv-widget-search{
  display:flex; flex-wrap:wrap; align-items:flex-end; gap:14px;
  background:var(--paper-dim); border:1px solid var(--line); border-radius:var(--radius-md);
  padding:20px; margin-bottom:24px;
}
.gv-search-box .gv-search-field{ display:flex; flex-direction:column; gap:6px; }
.gv-search-box label{
  font-family:var(--mono); font-size:11px; text-transform:uppercase; letter-spacing:.05em; color:var(--text-soft);
}
.gv-search-box input[type="text"],
.gv-search-box input[type="search"],
.gv-search-box input[type="number"],
.gv-search-box input[type="date"],
.gv-search-box select{
  border:1px solid var(--line); border-radius:10px; padding:9px 12px;
  font-family:var(--body); font-size:14px; background:var(--surface); color:var(--text);
}
.gv-search-box input[type="submit"],
.gv-search-box button,
.gv-search-clear{
  display:inline-flex; align-items:center; justify-content:center;
  padding:10px 20px; border-radius:999px; font-weight:600; font-size:14px;
  background:var(--ink); color:#fff; border:1px solid var(--ink);
}
.gv-search-clear{ background:var(--surface); color:var(--text-soft); border-color:var(--line); }

/* Table view */
table.gv-table-view{
  width:100%; border-collapse:separate; border-spacing:0;
  background:var(--surface); border:1px solid var(--line); border-radius:var(--radius-md);
  overflow:hidden; margin-bottom:24px;
}
table.gv-table-view thead th{
  background:var(--paper-dim); text-align:left; padding:12px 16px;
  font-family:var(--mono); font-size:11px; text-transform:uppercase; letter-spacing:.05em;
  color:var(--text-soft); border-bottom:1px solid var(--line); font-weight:500;
}
table.gv-table-view tbody td{
  padding:14px 16px; border-bottom:1px solid var(--line); font-size:14px; vertical-align:top;
}
table.gv-table-view tbody tr:last-child td{ border-bottom:none; }
table.gv-table-view tbody tr:hover{ background:var(--paper-dim); }
table.gv-table-view a{ color:var(--blue); font-weight:500; }

/* List view */
.gv-list-view{
  background:var(--surface); border:1px solid var(--line); border-radius:var(--radius-md);
  padding:22px; margin-bottom:14px; box-shadow:var(--shadow-card);
}
.gv-list-view-title{ font-family:var(--display); font-weight:var(--heading-weight); font-size:18px; margin-bottom:4px; }
.gv-list-view-title a{ color:var(--text); }
.gv-list-view-subheading{ font-family:var(--mono); font-size:12px; color:var(--text-soft); margin-bottom:10px; }
.gv-list-view-content{ font-size:14px; color:var(--text-soft); }
.gv-list-view-footer{ margin-top:16px; padding-top:14px; border-top:1px solid var(--line); font-size:13px; }

/* Pagination */
.gv-widget-pagination,
.gv-container .page-numbers{
  display:inline-flex; align-items:center; gap:6px; margin-top:20px;
}
.gv-widget-pagination a.page-numbers,
.gv-widget-pagination span.page-numbers,
.gv-container .page-numbers{
  padding:9px 16px; border-radius:999px; border:1px solid var(--line); background:var(--surface); font-size:14px;
}
.gv-widget-pagination .page-numbers.current,
.gv-container .page-numbers.current{
  background:var(--ink); color:#fff; border-color:var(--ink);
}

/* Single entry */
.gv-back-link{
  display:inline-flex; align-items:center; gap:6px; font-size:14px; font-weight:500;
  margin-bottom:20px; color:var(--text-soft);
}
.gv-back-link:hover{ color:var(--text); }

/* DataTables (when Table view has sorting/paging/search enabled) */
.dataTables_wrapper{ font-family:var(--body); }
.dataTables_wrapper .dataTables_filter input{
  border:1px solid var(--line); border-radius:10px; padding:8px 12px; font-size:14px; margin-left:8px;
}
.dataTables_wrapper .dataTables_length select{
  border:1px solid var(--line); border-radius:8px; padding:6px 10px; font-size:14px;
}
.dataTables_wrapper .dataTables_info{ font-size:13px; color:var(--text-soft); }
.dataTables_wrapper .dataTables_paginate .paginate_button{
  padding:8px 14px; border-radius:999px !important; border:1px solid var(--line) !important;
  background:var(--surface) !important; font-size:14px; margin-left:4px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current{
  background:var(--ink) !important; color:#fff !important; border-color:var(--ink) !important;
}

/* Gravity Forms fields — used by GravityView's search widget (advanced
   search) and by embedded Edit Entry / entry-detail forms. */
.gform_wrapper .gfield{ margin-bottom:18px; }
.gform_wrapper .gfield_label{
  font-weight:600; font-size:14px; margin-bottom:6px; display:block; color:var(--text);
}
.gform_wrapper input[type="text"],
.gform_wrapper input[type="email"],
.gform_wrapper input[type="url"],
.gform_wrapper input[type="tel"],
.gform_wrapper input[type="number"],
.gform_wrapper textarea,
.gform_wrapper select{
  width:100%; border:1px solid var(--line); border-radius:10px; padding:10px 12px;
  font-family:var(--body); font-size:14px; background:var(--surface); color:var(--text);
}
.gform_wrapper textarea{ min-height:120px; }
.gform_wrapper .gform_footer input[type="submit"],
.gform_wrapper .gform_button{
  display:inline-flex; align-items:center; justify-content:center;
  padding:12px 24px; border-radius:999px; font-weight:600; font-size:15px;
  background:var(--ink); color:#fff; border:1px solid var(--ink);
}
.gform_wrapper .validation_error{
  border:1px solid var(--coral); background:var(--surface); color:var(--coral);
  border-radius:var(--radius-sm); padding:14px 16px; font-size:14px; margin-bottom:20px;
}
.gform_wrapper .gfield_description.validation_message{ color:var(--coral); font-size:13px; margin-top:4px; }
