/* ============================================================================
   Dive Tools — shared hamburger menu + About modal
   ----------------------------------------------------------------------------
   Loaded on every calculator page (NOT the portal home, which already
   surfaces every tool by design).
   Color tokens are pulled from /shared/portal.css where possible; any
   value below is a one-off scoped to this component.
   ============================================================================ */

/* -------------------------------------------------------------------------
   Hamburger trigger button (injected by menu.js into the page header)
   ------------------------------------------------------------------------- */

/* Both header variants need position:relative so the trigger anchors
   correctly to the top-right corner. */
header.app-header,
header.site-header .wrap {
  position: relative;
}

.dt-menu-trigger {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}
.dt-menu-trigger:hover { background: rgba(255,255,255,0.08); }
.dt-menu-trigger:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -2px;
}

/* Three horizontal bars drawn with stacked linear-gradients — no emoji,
   no external icon files, scales cleanly at any DPI. */
.dt-menu-bars {
  display: block;
  width: 22px;
  height: 16px;
  background:
    linear-gradient(to bottom, #fff 0, #fff 2px, transparent 2px) top    / 22px 2px no-repeat,
    linear-gradient(to bottom, #fff 0, #fff 2px, transparent 2px) center / 22px 2px no-repeat,
    linear-gradient(to bottom, #fff 0, #fff 2px, transparent 2px) bottom / 22px 2px no-repeat;
}

/* Privacy page (site-header) has a back-link above the title — slide
   the trigger up a touch so it aligns with the back-link row rather
   than floating below it. */
header.site-header .dt-menu-trigger {
  top: 4px;
  right: 0;
}

/* -------------------------------------------------------------------------
   Slide-in panel + backdrop
   ------------------------------------------------------------------------- */

.dt-menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  opacity: 0;
  transition: opacity 250ms ease;
}
.dt-menu-backdrop.dt-open { opacity: 1; }

.dt-menu-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  max-width: 320px;
  background: #fefefe;
  box-shadow: -4px 0 16px rgba(0,0,0,0.15);
  z-index: 1001;
  transform: translateX(100%);
  transition: transform 250ms ease-out;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
}
.dt-menu-panel.dt-open { transform: translateX(0); }

@media (max-width: 640px) {
  .dt-menu-panel { width: 85vw; }
}

/* -------------------------------------------------------------------------
   Panel internals
   ------------------------------------------------------------------------- */

.dt-menu-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 24px;
  color: #666;
  line-height: 1;
  border-radius: 4px;
  z-index: 1;
}
.dt-menu-close:hover { background: #f0f0f0; color: #1a1a1a; }
.dt-menu-close:focus-visible {
  outline: 2px solid #6b7280;
  outline-offset: -2px;
}

.dt-menu-brand {
  font-size: 18px;
  font-weight: 700;
  color: #374151;
  padding: 14px 56px 14px 20px; /* extra right padding clears the close button */
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
}

.dt-menu-nav { flex: 1; padding: 4px 0 16px; }

.dt-menu-list,
.dt-menu-tools {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dt-menu-section { margin: 0; }

.dt-menu-cat-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #888;
  padding: 18px 20px 6px;
  margin: 0;
  border-top: 1px solid #e0e0e0;
}
/* No top border on the very first category (right after Home) */
.dt-menu-list > li:nth-child(2) .dt-menu-cat-title { border-top: 0; padding-top: 14px; }

/* -------------------------------------------------------------------------
   Menu items (links + buttons)
   ------------------------------------------------------------------------- */

.dt-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: #1a1a1a;
  text-decoration: none;
  font-size: 14px;
  line-height: 1.35;
  border-left: 3px solid transparent;
  transition: background 80ms ease, border-color 80ms ease;

  /* Reset for <button> variants so they render identically to <a> */
  background: transparent;
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font: inherit;
}
.dt-menu-item:hover { background: #f5f7fa; }
.dt-menu-item:focus-visible {
  outline: 2px solid #6b7280;
  outline-offset: -2px;
}

/* Active page indicator — left accent bar + bold + subtle blue tint */
.dt-menu-item.dt-active {
  font-weight: 700;
  background: #f0f6fc;
  border-left-color: #6b7280;
}

/* The Home (Portal) entry — slightly heavier weight, no top divider */
.dt-menu-home {
  font-weight: 600;
  padding-top: 14px;
}

/* External-link glyph (↗) follows the label */
.dt-ext-icon {
  display: inline-block;
  font-size: 0.85em;
  color: #888;
  margin-left: 4px;
  font-weight: 500;
}

/* -------------------------------------------------------------------------
   Footer section (About & Contact, Privacy)
   ------------------------------------------------------------------------- */

.dt-menu-footer {
  margin-top: 8px;
  border-top: 2px solid #e0e0e0;
  padding-top: 6px;
}
.dt-menu-footer .dt-menu-cat-title { display: none; }

/* -------------------------------------------------------------------------
   Inline icons (CSS-drawn / SVG, never emoji)
   ------------------------------------------------------------------------- */

.dt-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #6b7280;
}
.dt-icon svg { display: block; width: 100%; height: 100%; fill: currentColor; }

.dt-menu-item.dt-active .dt-icon { color: #374151; }

/* -------------------------------------------------------------------------
   About modal
   ------------------------------------------------------------------------- */

.dt-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1100;
  opacity: 0;
  transition: opacity 200ms ease;
}
.dt-modal-backdrop.dt-open { opacity: 1; }

.dt-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 90vw;
  max-width: 480px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: #fff;
  border-radius: 8px;
  padding: 28px 32px 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  z-index: 1101;
  opacity: 0;
  transform: translate(-50%, -48%) scale(0.96);
  transition: opacity 200ms ease, transform 200ms ease;
}
.dt-modal.dt-open {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.dt-modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 24px;
  color: #888;
  border-radius: 4px;
  line-height: 1;
}
.dt-modal-close:hover { background: #f0f0f0; color: #1a1a1a; }
.dt-modal-close:focus-visible {
  outline: 2px solid #6b7280;
  outline-offset: -2px;
}

.dt-modal h2 {
  margin: 0 0 14px;
  font-size: 20px;
  font-weight: 600;
  color: #374151;
  padding-right: 40px; /* clear the close button */
}
.dt-modal p {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.55;
  color: #1a1a1a;
}
.dt-modal a { color: #6b7280; }
.dt-modal a:hover { color: #374151; }

.dt-modal-email {
  margin-top: 16px !important;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dt-modal-email .dt-mail {
  font-size: 16px;
  color: #6b7280;
}

.dt-modal-disclaimer {
  margin-top: 18px !important;
  font-size: 12px !important;
  color: #888;
  font-style: italic;
}
.dt-modal-version {
  margin: 18px 0 0 !important;
  font-size: 11px !important;
  color: #aaa;
  text-align: right;
}

/* -------------------------------------------------------------------------
   Reduced motion — animations off, snap in / out
   ------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .dt-menu-backdrop,
  .dt-menu-panel,
  .dt-modal-backdrop,
  .dt-modal,
  .dt-menu-item { transition: none; }
}

/* -------------------------------------------------------------------------
   Body scroll lock helper class (set by JS during open)
   ------------------------------------------------------------------------- */

body.dt-menu-locked {
  /* The actual position:fixed + top trick is applied inline by JS so it
     can store the scroll offset; this class is a hook for any
     additional styling we ever want. */
}
