/* natemillercw.com — Phase 1 enhancements.
   Loaded after site.css; uses its tokens (--paper, --ink, --sumac, --rule ...). */

/* ---------- Main nav: Writing · Services ▾ · About · Contact ---------- */
.nav-main > ul { align-items: baseline; gap: .25rem 1.5rem; }
.nav-main li { position: relative; }

.sub-toggle {
  font: inherit;
  font-family: var(--sans);
  font-size: .9375rem;
  color: var(--ink-soft);
  background: none;
  border: 0;
  padding: .25rem 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.sub-toggle:hover, .has-sub.is-open .sub-toggle { color: var(--ink); }
.has-sub.is-current > .sub-toggle { color: var(--ink); box-shadow: inset 0 -2px 0 var(--sumac); }
.caret {
  width: .4rem; height: .4rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-.15rem) rotate(45deg);
  transition: transform .15s ease;
}
.has-sub.is-open .caret { transform: translateY(.05rem) rotate(225deg); }

.subnav {
  position: absolute;
  top: calc(100% + .35rem);
  left: -1rem;
  z-index: 20;
  min-width: 12rem;
  display: none !important;          /* overrides .site-header ul { display:flex } */
  flex-direction: column;
  gap: 0 !important;
  margin: 0;
  padding: .5rem 0 !important;
  list-style: none;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 3px;
  box-shadow: 0 10px 28px -14px rgb(0 0 0 / .35);
}
.subnav a { display: block; padding: .5rem 1rem !important; white-space: nowrap; }
.subnav a:hover { background: var(--paper-deep); }
.subnav a[aria-current="page"] { box-shadow: inset 2px 0 0 var(--sumac) !important; }

/* Open states: JS toggles .is-open; :focus-within keeps it usable without JS. */
.has-sub.is-open > .subnav,
.has-sub:focus-within > .subnav { display: flex !important; }
@media (hover: hover) and (pointer: fine) {
  .has-sub:hover > .subnav { display: flex !important; }
  /* Bridge the gap between the button and the panel so hover doesn't drop. */
  .has-sub::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: .5rem; }
}

@media (max-width: 600px) {
  .site-header { row-gap: .5rem; }
  .nav-main > ul { gap: .25rem 1.25rem; }
}

/* ---------- Top-of-page call to action ---------- */
.cta-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 1.25rem;
  margin: 1.5rem 0 0;
}
.button-sm { padding: .65rem 1.2rem; font-size: .9375rem; }
.cta-alt { font-family: var(--sans); font-size: .9375rem; font-weight: 500; }

/* ---------- Collapsible rate tables ---------- */
details.rates {
  margin: 1.5rem 0;
  border-top: 1px solid var(--ink);
}
details.rates > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: .75rem;
  padding: .9rem 2.25rem .9rem 0;
  position: relative;
}
details.rates > summary::-webkit-details-marker { display: none; }
details.rates > summary::after {
  content: "+";
  position: absolute;
  right: .25rem;
  top: .7rem;
  font-family: var(--sans);
  font-size: 1.35rem;
  color: var(--sumac);
}
details.rates[open] > summary::after { content: "\2212"; }
details.rates > summary:hover h3 { color: var(--grass); }
details.rates > summary h3 { margin: 0; font-size: 1.25rem; font-weight: 500; line-height: 1.3; }
.rates-meta {
  margin-left: auto;
  font-family: var(--sans);
  font-size: .8125rem;
  color: var(--ink-soft);
  white-space: nowrap;
}
details.rates:not([open]) { border-bottom: 1px solid var(--rule); }

/* Safety net: if a table ever gets wider than its column, it scrolls in its own frame. */
.rates-frame { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rates-frame:focus-visible { outline: 2px solid var(--sumac); outline-offset: 2px; }
.rates-frame .rate-table { margin-top: 0; }

/* Phones: each row becomes a card. */
@media (max-width: 600px) {
  .rate-table thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
  .rate-table, .rate-table tbody, .rate-table tr, .rate-table td { display: block; width: 100%; }
  .rate-table tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "name rate" "desc desc";
    column-gap: 1rem;
    padding: .9rem 0;
    border-bottom: 1px solid var(--rule);
  }
  .prose .rate-table td { border: 0; padding: 0; text-align: left; white-space: normal; }
  .rate-table td:first-child { grid-area: name; font-weight: 600; }
  .rate-table td:last-child {
    grid-area: rate;
    text-align: right !important;
    font-family: var(--sans);
    font-size: .9375rem;
    font-weight: 500;
    max-width: 9.5rem;
  }
  .rate-table td:nth-child(2):not(:last-child) {
    grid-area: desc;
    margin-top: .3rem;
    color: var(--ink-soft);
    font-size: 1rem;
    line-height: 1.5;
  }
  /* Two-column tables (tutoring): name left, price right, no description row. */
  .rate-table tr:has(td:nth-child(2):last-child) { grid-template-areas: "name rate"; }
}

@media print {
  details.rates > summary::after { display: none; }
  .cta-top { display: none; }
}

/* Home "Read the work" block lists two destinations */
.path a + p { margin-top: 1.1rem; }
