/* Shared public navigation and footer. Dashboard chrome is intentionally untouched. */
:root {
  --z-public-navigation: 1000;
  --z-public-dialog: 1100;
  --z-modal-backdrop: var(--z-public-dialog);
  --z-modal: calc(var(--z-public-dialog) + 10);
}

/* The report dialog must sit above the sticky public navigation, including its
   close control. Focus trapping and background inertness remain in the controller. */
#grader-modal.modal-backdrop { z-index: var(--z-public-dialog); }

/* Use the phone's width once, instead of stacking backdrop and card margins. */
@media (max-width: 520px) {
  #grader-modal.modal-backdrop { padding: var(--space-3); }
  #grader-modal .modal.grader-modal {
    width: 100%;
    margin: 0;
    max-height: calc(100vh - 2 * var(--space-3));
    max-height: calc(100dvh - 2 * var(--space-3));
  }
  #grader-modal .modal-header { padding: var(--space-3) var(--space-4) 0; }
  #grader-modal .modal-body { padding: var(--space-3) var(--space-4) var(--space-4); }
  #grader-modal .modal-close { width: 44px; height: 44px; }
  #grader-modal .grader-intro { gap: var(--space-3); }
  #grader-modal .grader-logo { font-size: 24px; }
}

.header.public-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: var(--z-public-navigation);
  width: 100%;
  padding: 0;
  color: #1c211d;
  background: #fff;
  border-bottom: 1px solid #e9e9e4;
  box-shadow: 0 2px 18px rgba(23, 33, 26, .035);
}

.public-header__inner {
  width: min(1440px, calc(100% - 64px));
  min-height: 78px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: clamp(20px, 2.7vw, 44px);
}

.public-header__brand,
.public-footer__logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #191e1a;
  text-decoration: none;
  white-space: nowrap;
  font-family: Fraunces, Georgia, serif;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.045em;
}

.public-header__brand img,
.public-footer__logo img { display: block; width: 36px; height: 36px; object-fit: contain; }
.public-header__nav { display: flex; align-items: center; gap: clamp(14px, 1.65vw, 26px); margin-left: auto; }
.public-header__nav > a,
.public-header__product > summary,
.public-header__account {
  color: #29342c;
  text-decoration: none;
  white-space: nowrap;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 600;
}
.public-header__nav > a:hover,
.public-header__account:hover,
.public-header__product > summary:hover { color: #067f5d; }
.public-header__product { position: relative; }
.public-header__product > summary { display: flex; align-items: center; gap: 7px; cursor: pointer; list-style: none; }
.public-header__product > summary::-webkit-details-marker,
.public-header__mobile > summary::-webkit-details-marker { display: none; }
.public-header__product > summary span { font-size: 17px; line-height: 0; transition: transform .2s ease; }
.public-header__product[open] > summary span { transform: rotate(180deg); }
.public-header__product-panel {
  position: absolute;
  top: calc(100% + 28px);
  left: -28px;
  width: min(620px, calc(100vw - 48px));
  padding: 25px;
  background: #fff;
  border: 1px solid #e1e8e1;
  border-radius: 16px;
  box-shadow: 0 28px 70px rgba(17, 32, 24, .15);
}
.public-header__product-panel::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 28px; }
.public-header__menu-intro { margin: 0 0 16px; color: #647269; font-size: 13px; }
.public-header__product-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
.public-header__product-links a { display: grid !important; align-items: start !important; min-height: 0 !important; gap: 3px; padding: 11px 12px; border-radius: 9px; color: #202923; text-decoration: none; }
.public-header__product-links a:hover { background: #eff8f3; }
.public-header__product-links strong { font-size: 14px; }
.public-header__product-links span { color: #68736b; font-size: 12px; }
.public-header__menu-all { display: inline-flex; gap: 10px; margin: 16px 0 0 12px; color: #067f5d; font-size: 13px; font-weight: 700; text-decoration: none; }
.public-header__actions { display: flex; align-items: center; gap: 18px; margin-left: auto; }
.public-header__report {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 17px;
  color: #fff;
  background: #087e5e;
  border: 1px solid #087e5e;
  border-radius: 8px;
  box-shadow: none;
  white-space: nowrap;
  text-decoration: none;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}
.public-header__report:hover { color: #fff; background: #066d51; transform: translateY(-1px); }
.public-header__report-short { display: none; }
.public-header__mobile { display: none; }

.footer.public-footer { padding: 76px 0 0; background: #f4f5f0; border-top: 1px solid #e4e8df; color: #27342b; }
.public-footer__inner { width: min(1440px, calc(100% - 64px)); margin: 0 auto; }
.public-footer__main { display: grid; grid-template-columns: minmax(290px, 1fr) minmax(500px, 1.15fr); gap: clamp(56px, 8vw, 136px); padding-bottom: 68px; }
.public-footer__brand > p { max-width: 390px; margin: 24px 0 35px; color: #526056; font-size: 16px; line-height: 1.65; }
.public-footer__report { max-width: 440px; }
.public-footer__report label { display: block; margin-bottom: 12px; color: #1f2d23; font-size: 14px; font-weight: 700; }
.public-footer__report-row { display: flex; gap: 7px; }
.public-footer__report-row input[type="text"] { min-width: 0; flex: 1; height: 46px; padding: 0 14px; color: #233027; background: #fff; border: 1px solid #cbd7ce; border-radius: 8px; font-size: 14px; }
.public-footer__report-row button { min-height: 46px; padding: 0 14px; color: #fff; background: #087e5e; border: 0; border-radius: 8px; white-space: nowrap; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.public-footer__report-row button:hover { background: #066d51; }
.public-footer__links { display: grid; grid-template-columns: 1.3fr 1fr .8fr; gap: clamp(24px, 3vw, 48px); }
.public-footer__column { display: flex; flex-direction: column; align-items: start; gap: 12px; }
.public-footer__column h2 { margin: 3px 0 10px; color: #17241b; font-size: 13px; letter-spacing: .01em; font-weight: 800; }
.public-footer__column a { display: block !important; min-height: 0 !important; color: #56635a; text-decoration: none; font-size: 14px; line-height: 1.35; }
.public-footer__column a:hover { color: #087e5e; text-decoration: underline; text-underline-offset: 3px; }
.public-footer__bottom { display: flex; justify-content: space-between; gap: 20px; padding: 22px 0 30px; border-top: 1px solid #dbe2d9; color: #6b786e; font-size: 12px; }

@media (max-width: 1180px) {
  .public-header__nav { display: none; }
  .public-header__mobile { display: block; position: relative; }
  .public-header__actions { margin-left: auto; }
  .public-header__menu-toggle { display: flex; flex-direction: column; justify-content: center; gap: 5px; width: 44px; height: 44px; padding: 11px; border: 1px solid #dfe6de; border-radius: 8px; cursor: pointer; list-style: none; }
  .public-header__menu-toggle span { width: 20px; height: 2px; background: #26372c; border-radius: 2px; }
  .public-header__mobile-panel { position: absolute; top: calc(100% + 17px); right: 0; width: min(350px, calc(100vw - 32px)); max-height: calc(100dvh - 96px); overflow-y: auto; display: flex; flex-direction: column; gap: 0; padding: 16px; background: #fff; border: 1px solid #e0e8e1; border-radius: 12px; box-shadow: 0 22px 54px rgba(16, 37, 25, .16); }
  .public-header__mobile-panel a { padding: 9px 8px; color: #28352c; text-decoration: none; font-size: 14px; font-weight: 600; border-radius: 5px; }
  .public-header__mobile-panel a:hover { background: #eef7f0; }
  .public-header__mobile-label { padding: 3px 8px 9px; color: #7a887d; font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
  .public-header__mobile-divider { height: 1px; margin: 9px 0; background: #e5ebe4; }
}

@media (max-width: 1000px) {
  .public-footer__main { grid-template-columns: 1fr; gap: 50px; }
  .public-footer__links { max-width: 720px; }
}

@media (max-width: 640px) {
  .public-header__inner { width: calc(100% - 32px); min-height: 70px; gap: 8px; }
  .public-header__brand { gap: 5px; font-size: 20px; }
  .public-header__brand img { width: 30px; height: 30px; }
  .public-header__actions { gap: 0; }
  /* Legacy global link display rules must not crowd the phone header.
     Sign-in remains available inside the mobile navigation. */
  .public-header .public-header__account { display: none !important; }
  .public-header__report { min-height: 44px; max-width: 42vw; overflow: hidden; padding: 0 12px; font-size: 13px; text-overflow: ellipsis; }
  .public-header__report-full { display: none; }
  .public-header__report-short { display: inline; }
  .public-header__menu-toggle { width: 44px; height: 44px; padding: 11px; }
  .public-footer { padding-top: 56px; }
  .public-footer__inner { width: calc(100% - 36px); }
  .public-footer__brand > p { margin: 20px 0 28px; }
  .public-footer__links { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 38px 18px; }
  .public-footer__column:first-child { grid-row: span 2; }
  .public-footer__report-row { flex-wrap: wrap; }
  .public-footer__report-row input[type="text"], .public-footer__report-row button { width: 100%; }
  .public-footer__bottom { flex-direction: column; gap: 5px; padding-bottom: 28px; }
}

@media (max-width: 370px) {
  .public-header__brand { font-size: 18px; }
  .public-header__report { font-size: 12px; padding-inline: 10px; }
}
