.hub {
      max-width: 1400px;
      margin: 0 auto;
      padding: 0 20px var(--page-foot-clearance, 56px);
    }

    @keyframes hub-rise {
      from {
        opacity: 0;
        transform: translateY(14px);
      }
      to {
        opacity: 1;
        transform: none;
      }
    }

    .hub-top {
      display: flex;
      flex-direction: column;
      align-items: stretch;
      gap: 18px;
      padding: 0;
      width: 100%;
    }

    .layout {
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
      gap: 20px;
      align-items: stretch;
      direction: ltr;
      width: 100%;
    }

    /* Keep calendar at natural height when pinned tools grow the tools column. */
    .calendar-stack {
      align-self: start;
      display: flex;
      flex-direction: column;
      gap: 0;
      min-width: 0;
    }

    .calendar-panel {
      align-self: stretch;
      width: 100%;
      box-sizing: border-box;
    }

    .calendar-panel[hidden] {
      display: none !important;
    }

    .layout.layout--calendar-hidden {
      grid-template-columns: 1fr;
    }

    .layout.layout--calendar-hidden .calendar-stack {
      display: none;
    }

    .layout > * { direction: rtl; }

    @media (min-width: 960px) {
      .layout {
        grid-template-columns: minmax(380px, 520px) minmax(380px, 1fr);
      }

      .calendar-stack {
        gap: 8px;
      }
    }

    @media (max-width: 959px) {
      .layout { grid-template-columns: 1fr; direction: rtl; }
      .title-bubble h1 { font-size: 2rem; }
      .calendar-frame { height: min(480px, 62vh); }
      .panel-head { flex-wrap: wrap; gap: 8px; }
      .panel-head h2 { font-size: 0.76rem; }
    }

    @media (max-width: 768px) {
      .calendar-panel .panel-head {
        padding: 10px 10px 8px;
      }

      .calendar-frame-wrap {
        padding: 0;
        overflow: hidden;
      }

      .calendar-frame {
        height: 300px;
        max-height: 300px;
        overflow: hidden;
      }

      .tool-card {
        min-height: 120px;
        padding: 14px 12px;
        gap: 8px;
      }

      .tool-card h3 {
        font-size: 0.98rem;
      }

      .tool-card p {
        font-size: 0.82rem;
        line-height: 1.5;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
      }

      .tools-grid,
      .tools-grid--pinned {
        gap: 10px;
      }
    }

    .calendar-panel {
      position: relative;
      padding: 0;
      overflow: hidden;
      border: 1px solid var(--panel-border);
      background: var(--panel);
      box-shadow: none;
      border-radius: var(--radius);
      animation: hub-rise 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
    }

    html[data-theme="glass"] .calendar-panel {
      backdrop-filter: blur(var(--glass-blur));
      -webkit-backdrop-filter: blur(var(--glass-blur));
    }

    .calendar-panel .panel-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 16px 20px 12px;
      border-bottom: 1px solid var(--panel-border);
    }

    .calendar-panel h2 {
      font-size: 0.92rem;
      font-weight: 700;
      letter-spacing: 0;
      text-transform: none;
      color: var(--text-on-panel);
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .calendar-panel .panel-head .btn {
      padding: 7px 14px;
      font-size: 0.8rem;
    }

    .calendar-frame-wrap {
      padding: 0 14px;
    }

    .calendar-panel-foot {
      position: relative;
      height: 0;
      flex-shrink: 0;
      overflow: visible;
    }

    .calendar-panel-foot > * {
      position: relative !important;
      top: auto !important;
      bottom: auto !important;
      left: auto !important;
      right: auto !important;
      width: 100% !important;
      max-width: 100% !important;
      margin: 0 !important;
    }

    .calendar-frame {
      width: 100%;
      height: 480px;
      border: none;
      border-radius: var(--radius-sm);
      background: transparent;
      display: block;
      overflow: hidden;
    }

    .tools-section {
      display: flex;
      flex-direction: column;
      min-height: 0;
      gap: 16px;
    }

    .tools-section[hidden],
    .tools-section--pinned[hidden],
    .tools-section--today[hidden] {
      display: none !important;
    }

    .tools-section--pinned:not([hidden]),
    .tools-section--today:not([hidden]) {
      display: flex;
      flex-direction: column;
      min-height: 0;
    }

    .tools-section--today h2 {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 0.95rem;
      margin: 0 0 8px;
      color: var(--text);
    }

    .today-quote {
      margin: 0 0 12px;
      font-size: 0.88rem;
      line-height: 1.7;
      color: var(--text-muted);
    }

    .today-quote[hidden] {
      display: none !important;
    }

    .today-quote a {
      color: var(--accent);
      text-decoration: none;
    }

    .today-quote a:hover {
      text-decoration: underline;
    }

    /* Desktop only: hide today's-tools label; poem sits under calendar. */
    @media (min-width: 960px) {
      .tools-section--today > h2 {
        display: none !important;
      }

      .calendar-stack > .today-quote:not([hidden]) {
        margin: 0;
        padding: 0;
      }
    }

    /* Tools page: pinned block sits above the main grid */
    section.tools-section--pinned:not([hidden]) {
      margin-bottom: 32px;
    }

    .tools-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      grid-template-rows: repeat(3, 1fr);
      gap: 12px;
      flex: 1;
      min-height: 0;
    }

    .tools-section--pinned .tools-grid,
    .tools-grid--pinned,
    .tools-section--today .tools-grid,
    .tools-grid--today {
      grid-template-rows: none;
      flex: 0 0 auto;
    }

    .tool-card-wrap {
      position: relative;
      min-height: 0;
      height: 100%;
    }

    .tool-card-wrap .tool-card {
      height: 100%;
    }

    .tool-pin {
      position: absolute;
      top: 10px;
      left: 10px;
      z-index: 2;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 32px;
      height: 32px;
      padding: 0;
      border: 1px solid var(--panel-border);
      border-radius: 8px;
      background: var(--panel);
      color: var(--text-muted);
      line-height: 1;
      cursor: pointer;
      transition: color 0.15s, border-color 0.15s, background 0.15s;
    }

    .tool-pin-icon {
      display: block;
      opacity: 0.55;
      transition: opacity 0.15s;
      pointer-events: none;
    }

    .tool-pin:hover .tool-pin-icon,
    .tool-pin.pinned .tool-pin-icon {
      opacity: 1;
    }

    .tool-pin:hover,
    .tool-pin.pinned {
      color: var(--accent);
      border-color: color-mix(in srgb, var(--accent) 45%, transparent);
      background: var(--accent-soft);
    }

    .pin-heading-icon {
      width: 1em;
      height: 1em;
      flex-shrink: 0;
      color: var(--accent);
    }

    .tools-section--pinned h2,
    .tools-section--all h2 {
      font-size: 0.95rem;
      font-weight: 700;
      letter-spacing: 0;
      text-transform: none;
      color: var(--text-on-panel);
      margin-bottom: 12px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .tool-card {
      display: flex;
      flex-direction: column;
      gap: 10px;
      padding: 18px 16px;
      position: relative;
      border-radius: var(--radius);
      border: 1px solid var(--panel-border);
      background: var(--panel);
      color: var(--text-on-panel);
      text-decoration: none;
      transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.2s ease, background 0.2s ease;
      min-height: 0;
      height: 100%;
      box-shadow: none;
      animation: hub-rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
    }

    .tools-grid > .tool-card-wrap:nth-child(1) .tool-card,
    .tools-grid > .tool-card:nth-child(1) { animation-delay: 0.08s; }
    .tools-grid > .tool-card-wrap:nth-child(2) .tool-card,
    .tools-grid > .tool-card:nth-child(2) { animation-delay: 0.11s; }
    .tools-grid > .tool-card-wrap:nth-child(3) .tool-card,
    .tools-grid > .tool-card:nth-child(3) { animation-delay: 0.14s; }
    .tools-grid > .tool-card-wrap:nth-child(4) .tool-card,
    .tools-grid > .tool-card:nth-child(4) { animation-delay: 0.17s; }
    .tools-grid > .tool-card-wrap:nth-child(5) .tool-card,
    .tools-grid > .tool-card:nth-child(5) { animation-delay: 0.2s; }
    .tools-grid > .tool-card-wrap:nth-child(6) .tool-card,
    .tools-grid > .tool-card:nth-child(6) { animation-delay: 0.23s; }
    .tools-grid > .tool-card-wrap:nth-child(n+7) .tool-card,
    .tools-grid > .tool-card:nth-child(n+7) { animation-delay: 0.26s; }

    @media (prefers-reduced-motion: reduce) {
      .tool-card,
      .calendar-panel {
        animation: none;
      }
    }

    @media (max-width: 959px) {
      .tools-grid,
      .tools-grid--pinned {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        grid-template-rows: none;
      }

      .tool-card {
        height: auto;
        min-height: 148px;
      }
    }

    @media (max-width: 768px) {
      .tools-grid,
      .tools-grid--pinned {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }

      .tool-card {
        min-height: 120px;
      }
    }

    html[data-theme="glass"] .tool-card {
      backdrop-filter: blur(var(--glass-blur));
      -webkit-backdrop-filter: blur(var(--glass-blur));
    }

    .tool-card:hover {
      border-color: color-mix(in srgb, var(--accent) 45%, var(--panel-border));
      transform: translateY(-3px);
      background: color-mix(in srgb, var(--panel) 92%, var(--accent) 8%);
      text-decoration: none;
    }

    .tool-card-wrap.hidden-by-search {
      display: none;
    }

    .tool-card.hidden-by-search {
      display: none;
    }

    .tool-icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 2.5rem;
      height: 2.5rem;
      font-size: 1.3rem;
      line-height: 1;
      border-radius: var(--radius-sm);
      background: transparent;
      border: 1px solid var(--panel-border);
      flex-shrink: 0;
    }

    .tool-card h3 {
      font-size: 1.05rem;
      font-weight: 700;
      color: var(--text-on-panel);
    }

    .tool-card p {
      font-size: 0.88rem;
      color: var(--text-muted-panel);
      flex: 1;
      line-height: 1.65;
    }

    .tool-card .tag {
      align-self: flex-start;
      font-size: 0.72rem;
      padding: 2px 0;
      border-radius: 0;
      background: transparent;
      color: var(--accent);
      border: none;
      border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
      font-weight: 600;
    }

    .tool-card--more {
      border-style: dashed;
      justify-content: center;
      text-align: center;
      background: transparent;
    }

    .tool-card--more:hover {
      background: var(--accent-soft);
    }

    .tool-card--more h3 {
      font-size: 1.1rem;
    }

    .search-empty {
      display: none;
      text-align: center;
      padding: 40px 20px;
      color: var(--text-muted);
      font-size: 0.92rem;
    }

    .search-empty.visible { display: block; }

    .fullscreen-overlay {
      position: fixed;
      inset: 0;
      z-index: 1000;
      background: var(--overlay-bg);
      backdrop-filter: blur(10px);
      display: none;
      flex-direction: column;
      padding: 20px 24px;
    }

    .fullscreen-overlay.open { display: flex; }

    .fullscreen-bar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      max-width: 900px;
      width: 100%;
      margin: 0 auto 16px;
      padding: 12px 20px;
      background: var(--panel);
      border: 1px solid var(--panel-border);
      border-radius: var(--radius);
      color: var(--text-on-panel);
      box-shadow: var(--shadow-panel);
    }

    .fullscreen-bar strong {
      font-size: 1.05rem;
      font-weight: 700;
      color: var(--text-on-panel);
    }

    .fullscreen-overlay iframe {
      flex: 1;
      width: 100%;
      max-width: 900px;
      margin: 0 auto;
      border: 1px solid var(--panel-border);
      border-radius: var(--radius);
      background: var(--panel-2);
      min-height: 0;
    }

    .fullscreen-overlay .calendar-panel-foot {
      flex-shrink: 0;
      width: 100%;
      max-width: 900px;
      margin: 0 auto;
      overflow: visible;
    }

    .page-bottom-ad-mirror {
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      width: 100%;
      z-index: 2147483646;
      pointer-events: auto;
    }

    .cal-popup-overlay {
      position: fixed;
      inset: 0;
      z-index: 2147483647;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 24px;
    }

    .cal-popup-overlay.open { display: flex; }

    body.cal-popup-open .page-bottom-ad-mirror,
    body.cal-popup-open .calendar-panel-foot {
      display: none !important;
      visibility: hidden !important;
      pointer-events: none !important;
    }

    .cal-popup-overlay-backdrop {
      position: absolute;
      inset: 0;
      background: var(--overlay-bg);
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
    }

    #calPopupFrame {
      position: relative;
      z-index: 1;
      border: none;
      border-radius: var(--radius);
      background: transparent;
      width: min(560px, calc(100vw - 48px));
      height: 0;
      overflow: hidden;
    }

    #calPopupFrame.ready {
      overflow: visible;
    }

    #calPopupFrame.wide {
      width: 70vw;
      height: 70vh;
      max-width: 70vw;
      max-height: 70vh;
      background: var(--panel);
      border: 1px solid var(--panel-border);
      box-shadow: var(--shadow-panel);
      overflow: hidden;
    }

    @media (max-width: 768px) {
      .cal-popup-overlay {
        padding: 0;
        align-items: center;
        justify-content: center;
      }

      .cal-popup-overlay:has(#calPopupFrame.wide) {
        align-items: stretch;
      }

      #calPopupFrame {
        width: 100% !important;
        max-width: 100%;
        border-radius: 0;
      }

      #calPopupFrame:not(.wide) {
        align-self: center;
        max-height: calc(100dvh - 24px);
        overflow: auto;
      }

      #calPopupFrame.wide {
        width: 100% !important;
        height: 100% !important;
        max-width: none;
        max-height: none;
        border-radius: 0;
        border-left: none;
        border-right: none;
      }
    }

/* tools listing page */
main.page:not(.page-with-rails) {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 20px 56px;
}

main.page.page-with-rails {
  max-width: none;
  margin: 0 auto;
  padding-bottom: var(--page-foot-clearance);
}

body.has-site-top main.page.page-with-rails {
  padding-top: calc(var(--topbar-offset) + var(--topbar-control-h) + var(--topbar-gap));
}

body:not(.has-site-top) main.page.page-with-rails {
  padding-top: 20px;
}

.page-top {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 18px;
  padding: 0;
  width: 100%;
}

main.page .search-empty {
  padding: 48px 20px;
}
