/* ================================
    HEADER + CALCULATOR NAV
================================ */

/* Sticky header wrapper */
.calc-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  backdrop-filter: blur(16px);
  background: var(--cold-dark);
  border-bottom: 1px solid rgba(229, 231, 235, 0.2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

/* Header row (inside .container) */
.calc-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.75rem 0; /* horizontal padding handled by .container */
}

/* Base nav layout */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-text-main {
  font-family: "Cormorant Garamond", serif;
  font-size: 2.2rem;
  letter-spacing: 0.03em;
  color: var(--pizza);
}

.cpa-span {
    font-weight: bold;
}

.brand-text-sub {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--pita-dark);
}

/* Brand block */
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  white-space: normal;          /* allow wrapping on small screens */
}

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  max-height: 72px; /* keeps header compact */
  width: auto;
}

.brand-logo img {
  height: 100%;
  width: auto;
  display: block;
}

.header-location {
  font-size: 69%;
  color: var(--pita-dark);
}

/* Shell = hamburger + calculator */
.nav-calc-shell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
}

.nav-calc-shell.is-open .nav-calculator {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ================================
   NAV CALCULATOR (BASE)
   ================================ */

.nav-calculator {
  position: absolute;
  top: calc(100% + 0.65rem);
  right: 0;
  display: inline-flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.55rem 0.6rem;
  border-radius: 18px;
  background: radial-gradient(circle at top, #020617 0, #111827 45%, #020617 100%);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  max-width: 380px;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition:
    opacity 0.15s ease-out,
    transform 0.15s ease-out;
}

/* Close button inside calculator */
.nav-calc-close {
  position: absolute;
  top: 0.5rem;
  right: 0.6rem;
  background: transparent;
  border: none;
  color: #e5e7eb;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: block;
}

.nav-calc-close:hover {
  opacity: 0.8;
}

/* Calculator Screen */
.nav-calc-screen {
  border-radius: 12px;
  background: radial-gradient(circle at 10% 0, #0f172a 0, #020617 45%, #000 100%);
  padding: 0.45rem 0.6rem;
  border: 1px solid rgba(15, 23, 42, 0.9);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.25);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.nav-calc-output {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  text-align: right;
  color: #fefce8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-calc-hint {
  font-size: 0.68rem;
  color: #9ca3af;
  text-align: right;
}

/* Key Grid */
.nav-calc-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
}

/* Ten-key layout: 3 numeric columns + 1 tall "+" column */
.nav-calc-grid-tenkey {
  grid-template-columns: repeat(3, minmax(0, 1fr)) 0.9fr;
  grid-auto-rows: 1fr;
}

/* Big vertical "+" key on the right */
.nav-calc-btn-plus {
  grid-row: 1 / span 4;    /* spans all four rows */
  grid-column: 4 / 5;
  align-self: stretch;
  justify-content: center;
  align-items: center;
  background: var(--pizza)!important;
  box-shadow:
    inset 0 0 0 1px rgba(251, 191, 36, 0.9),
    0 12px 24px rgba(0, 0, 0, 0.95);
  color: #000000!important;
}

.nav-calc-btn-plus:hover {
  background: var(--pizza-dark)!important;
}

.nav-calc-btn-plus .nav-calc-sub {
  color: #000000!important;
}

.nav-calc-sub-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
}

/* Give the keys a more "ten-key" proportion */
.nav-calc-grid.nav-calc-grid-tenkey .nav-calc-btn {
  min-height: 2.5rem;
}

.nav-calc-btn {
  border: none;
  outline: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 0.45rem 0.4rem;
  background: radial-gradient(circle at 30% 0, #1f2937 0, #020617 65%);
  box-shadow:
    inset 0 0 0 1px rgba(55, 65, 81, 0.8),
    0 8px 16px rgba(0, 0, 0, 0.75);
  color: #e5e7eb;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
  transition:
    transform 0.06s ease-out,
    box-shadow 0.06s ease-out,
    background 0.1s ease-out;
  font-family: inherit;
}

.nav-calc-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 0 0 1px rgba(148, 163, 184, 0.9),
    0 10px 20px rgba(0, 0, 0, 0.9);
  background: radial-gradient(circle at 30% 0, #111827 0, #020617 65%);
}

.nav-calc-btn:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 0 0 1px rgba(30, 64, 175, 0.9),
    0 4px 10px rgba(0, 0, 0, 0.8);
}

.nav-calc-main {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.nav-calc-sub {
  font-size: 0.63rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ca3af;
}

/* Special keys */
.nav-calc-btn-action {
  background: radial-gradient(circle at 30% 0, #7f1d1d 0, #450a0a 65%);
  box-shadow:
    inset 0 0 0 1px rgba(127, 29, 29, 0.9),
    0 8px 16px rgba(0, 0, 0, 0.9);
}

.nav-calc-btn-wide {
  grid-column: span 3;
  background: radial-gradient(circle at 30% 0, #c9a25d 0, #8a6b2f 65%);
  box-shadow:
    inset 0 0 0 1px rgba(251, 191, 36, 0.9),
    0 12px 24px rgba(0, 0, 0, 0.95);
  color: #111827;
}

.nav-calc-btn-wide .nav-calc-sub {
  color: #1f2937;
}

/* =================================
   TOGGLE
   ================================= */

.nav-calc-toggle {
  border: 1px solid rgba(229, 231, 235, 0.3);
  background: rgba(0, 0, 0, 0.08);
  color: var(--pita);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  width: auto;
  height: 42px;
  cursor: pointer;
  justify-content: center;
  transition: border 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

/* Icon: three bars */
.nav-calc-toggle-icon {
  position: relative;
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: var(--pita);
  display: block;
  font-size: 0;
}

.nav-calc-toggle-icon::before,
.nav-calc-toggle-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: var(--pita);
  transition:
    transform 0.18s ease-out,
    top 0.18s ease-out,
    opacity 0.18s ease-out;
}

.nav-calc-toggle-icon::before {
  top: -6px;
}

.nav-calc-toggle-icon::after {
  top: 6px;
}

.nav-calc-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(229, 231, 235, 0.6);
  background: rgba(0, 0, 0, 0.14);
}

.nav-calc-toggle:active {
  transform: translateY(0);
}

.nav-calc-toggle-label {
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* When menu is open, turn into X */
.nav-calc-shell.is-open .nav-calc-toggle-icon {
  background: transparent;
}

.nav-calc-shell.is-open .nav-calc-toggle-icon::before {
  top: 0;
  transform: rotate(45deg);
}

.nav-calc-shell.is-open .nav-calc-toggle-icon::after {
  top: 0;
  transform: rotate(-45deg);
}

/* =================================
   BACKDROP (MOBILE)
   ================================= */

.nav-calc-backdrop {
  display: none; /* only used on mobile; see media query */
}

/* =================================
   RESPONSIVE BEHAVIOR
   ================================= */

/* Desktop / larger tablets */
@media (min-width: 641px) {
  .nav-calculator {
    width: min(420px, calc(100vw - 2.5rem));
  }

  .nav-calc-shell {
    align-self: center;
  }
}

/* Mobile */
@media (max-width: 640px) {
  /* Header row stays in one line */
  .calc-header-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  /* Let the brand shrink/wrap a bit on very small screens */
  .brand {
    max-width: 70%;
  }

  /* Shell just holds the button; calculator is fixed to viewport */
  .nav-calc-shell {
    position: static;
  }

  .nav-calc-toggle {
    display: flex;
  }

  /* Backdrop behind open menu */
  .nav-calc-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    z-index: 35;
    transition: opacity 0.15s ease-out;
  }

  .nav-calc-shell.is-open .nav-calc-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  /* Calculator = full-width overlay under the sticky header */
  .nav-calculator {
    position: fixed;
    top: calc(var(--header-offset) + 0.5rem);
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
    max-width: 420px;
    margin: 0 auto;
    z-index: 40;
  }
}