/* Shared across every page: account nav dropdown + sign-in modal.
   Relies on the --ink / --shadow custom properties each page defines in its own :root. */

/* ---- Tools nav dropdown (Colour-Control / Root-Frame) ----
   Uses the same [data-auth-toggle] open/close/outside-click/Escape wiring
   in js/site.js as the account dropdown - that binding is generic, so this
   needed no JS changes, only markup + these styles. Independent of the
   .nav-account rendering, so it works the same whether a visitor is signed
   in or not.

   DESIGN RULE: this dropdown and the account (Sign In / logged-in) dropdown
   below share the same rounded-corner convention as .auth-panel (16px on
   the outer menu, 10px on each item) - part of the site-wide "tasteful
   rounded corners, never a sharp box" rule. */

.nav-tools {
  position: relative;
}

.tools-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
  text-decoration: none;
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  /* Matches .navbar a -- Gloock is Regular (400) only, so this stayed
     in sync when the nav links were switched off faux bold. */
  font-weight: 400;
  color: #4a4a4a;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: "Gloock", serif;
  transition: opacity 0.25s ease;
}

.tools-trigger::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.4s ease;
}

.tools-trigger:hover,
.tools-trigger:focus-visible {
  opacity: 0.68;
}

.tools-trigger:hover::after,
.tools-trigger:focus-visible::after {
  transform: scaleX(1);
  opacity: 0.54;
}

.tools-trigger .auth-caret {
  font-size: 0.62rem;
  transition: transform 0.25s ease;
}

.tools-trigger[aria-expanded="true"] .auth-caret {
  transform: rotate(180deg);
}

.tools-dropdown {
  position: absolute;
  top: calc(100% + 14px);
  left: 50%;
  min-width: 230px;
  display: flex;
  flex-direction: column;
  padding: 8px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(23, 19, 16, 0.12);
  border-radius: 16px;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -6px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  z-index: 1002;
}

.tools-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.tools-dropdown-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  text-decoration: none;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-family: "Gloock", serif;
}

.tools-dropdown-item:hover,
.tools-dropdown-item:focus-visible {
  background: rgba(23, 19, 16, 0.06);
}

.tools-dropdown-item .item-label {
  font-size: 0.86rem;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.tools-dropdown-item .item-note {
  font-size: 0.74rem;
  color: #7b6d61;
  letter-spacing: 0.01em;
  font-family: "Cormorant Garamond", serif;
}

@media (max-width: 640px) {
  .nav-tools {
    width: 100%;
    display: flex;
    justify-content: center;
  }
}

.nav-account {
  position: relative;
  margin-left: 10px;
  padding-left: 28px;
  border-left: 1px solid rgba(23, 19, 16, 0.16);
}

.account-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  /* Matches .navbar a / .tools-trigger -- Gloock is Regular (400) only. */
  font-weight: 400;
  color: #4a4a4a;
  padding: 9px 16px;
  border: 1px solid rgba(23, 19, 16, 0.15);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  font-family: "Gloock", serif;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.account-trigger:hover,
.account-trigger:focus-visible {
  opacity: 0.72;
  transform: translateY(-1px);
}

.auth-caret {
  font-size: 0.62rem;
  transition: transform 0.25s ease;
}

.account-trigger[aria-expanded="true"] .auth-caret {
  transform: rotate(180deg);
}

.auth-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 250px;
  display: flex;
  flex-direction: column;
  padding: 8px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(23, 19, 16, 0.12);
  border-radius: 16px;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  z-index: 1002;
}

.auth-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.auth-dropdown-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-family: "Gloock", serif;
}

.auth-dropdown-item:hover,
.auth-dropdown-item:focus-visible {
  background: rgba(23, 19, 16, 0.06);
}

.auth-dropdown-item .item-label {
  font-size: 0.86rem;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.auth-dropdown-item .item-note {
  font-size: 0.74rem;
  color: #7b6d61;
  letter-spacing: 0.01em;
  font-family: "Cormorant Garamond", serif;
}

.auth-dropdown-item.testing .item-label {
  color: #b1490f;
}

.auth-dropdown-item.signout .item-label {
  color: #8a3b3b;
}

/* ---- Logged-in nav state (mirrors .account-trigger's look) ---- */

.account-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #b1490f;
  color: #fff;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  flex-shrink: 0;
}

.account-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .nav-account {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
    padding-top: 10px;
    margin-top: 4px;
    border-top: 1px solid rgba(23, 19, 16, 0.12);
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .auth-dropdown {
    right: auto;
    left: 50%;
    transform: translate(-50%, -6px);
  }

  .auth-dropdown.open {
    transform: translate(-50%, 0);
  }
}

/* ---- Sign-in modal ---- */

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  justify-content: center;
  padding: 24px;
  background: rgba(17, 12, 8, 0.58);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  /* Lets a panel taller than the viewport (the buy panel on a short phone
     screen, for example) scroll instead of getting clipped top/bottom.
     align-items:center is deliberately NOT used here - combined with
     overflow it makes the top of an overflowing panel permanently
     unreachable (scrollTop can't go negative). The panel is centered
     instead via margin:auto below, which degrades to top-then-scroll
     once it's taller than the viewport. */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.auth-modal.open {
  opacity: 1;
  visibility: visible;
}

/* DESIGN RULE: every modal/panel that reuses this .auth-panel chrome (sign-in,
   buy, refund, and any similar panel added in the future) gets tasteful
   rounded corners - never a sharp box, never an overly rounded "bubble".
   This radius scale (panel 22px, inputs/buttons 12px, the close button a
   circle) is the convention to follow for any new panel of this kind. */
.auth-panel {
  position: relative;
  width: min(100%, 480px);
  padding: 38px 34px 32px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(23, 19, 16, 0.12);
  border-radius: 22px;
  box-shadow: var(--shadow);
  color: var(--ink);
  /* Vertically centers the panel when it fits the viewport, and scrolls
     cleanly (full top and bottom reachable) once it doesn't. */
  margin: auto 0;
}

.auth-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(23, 19, 16, 0.12);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink);
  cursor: pointer;
  font-size: 1rem;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.auth-close:hover,
.auth-close:focus-visible {
  opacity: 0.72;
  transform: translateY(-1px);
}

.auth-kicker {
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #7b6d61;
  font-weight: 600;
  margin-bottom: 12px;
}

.auth-title {
  font-family: "Gloock", serif;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  letter-spacing: 0.08em;
  font-weight: 400;
  margin-bottom: 14px;
}

.auth-description {
  font-size: 1rem;
  line-height: 1.7;
  color: #5e5349;
  margin-bottom: 24px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  color: #4a4a4a;
}

.auth-input {
  width: 100%;
  padding: 14px 14px;
  border: 1px solid rgba(23, 19, 16, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  letter-spacing: 0.02em;
  outline: none;
  transition: border-color 0.25s ease, background 0.25s ease;
}

.auth-input:focus {
  border-color: rgba(23, 19, 16, 0.42);
  background: #ffffff;
}

.auth-checkbox-row {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  align-items: start;
  font-size: 0.96rem;
  line-height: 1.55;
  color: #5e5349;
  cursor: pointer;
}

.auth-checkbox-row input {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: #1f1a17;
  cursor: pointer;
}

.auth-recaptcha-wrap {
  display: flex;
  justify-content: flex-start;
  padding: 2px 0 0;
  transform: scale(0.96);
  transform-origin: left center;
}

.auth-recaptcha-note {
  font-size: 0.78rem;
  line-height: 1.5;
  color: #7b6d61;
  margin-top: -4px;
}

.auth-submit {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 22px;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  background: #1f1a17;
  font-family: "Gloock", serif;
  font-size: 0.84rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 400;
  cursor: pointer;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.auth-submit:hover,
.auth-submit:focus-visible {
  opacity: 0.82;
  transform: translateY(-1px);
}

.auth-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.auth-note {
  font-size: 0.86rem;
  line-height: 1.55;
  color: #7b6d61;
  margin-top: 2px;
}

.auth-message {
  display: none;
  padding: 12px 14px;
  background: rgba(243, 238, 231, 0.8);
  border: 1px solid rgba(23, 19, 16, 0.1);
  border-radius: 12px;
  color: #4d433b;
  font-size: 0.92rem;
  line-height: 1.55;
}

.auth-message.show {
  display: block;
}

/* ---- Paid-course "buy" panel ----
   A larger variant of the same .auth-panel chrome, used only by the buy
   modal (id="buyModal" on teaching.html and dashboard.html - identical
   markup and behavior on both). Adds an overview blurb, a sample-work
   gallery, and an instructor block so the panel reads as a real course
   sales page rather than a bare price + paragraph. Centralized here
   (rather than duplicated per-page like the rest of that modal's markup)
   because this is meaningfully more complex UI shared by exactly two
   pages - one CSS source to maintain instead of two copies drifting apart.
   Content (overview text, gallery images, instructor bio) comes from
   COURSE_SALES_CONTENT in js/site.js - see docs/how-to-add-a-course.md. */

.buy-panel {
  width: min(100%, 1680px);
  padding: 40px 40px 34px;
}

.buy-header {
  margin-bottom: 22px;
}

.buy-header .auth-title {
  font-size: clamp(2.2rem, 4.4vw, 3.4rem);
}

.buy-layout {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 40px;
  margin-bottom: 26px;
}

.buy-side-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.buy-gallery-main {
  width: 100%;
  /* Root 2 rectangle: width : height = sqrt(2) : 1 */
  aspect-ratio: 1.41421356 / 1;
  border-radius: 16px;
  overflow: hidden;
  background: var(--card-thumb-bg, #e7ded1);
  margin-bottom: 10px;
}

.buy-gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.buy-gallery-thumbs {
  display: flex;
  gap: 3px;
}

.buy-gallery-thumbs button {
  width: 100%;
  /* Matches .buy-gallery-main's root 2 rectangle */
  aspect-ratio: 1.41421356 / 1;
  padding: 0;
  border: none;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  background: none;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.buy-gallery-thumbs button:hover,
.buy-gallery-thumbs button:focus-visible {
  opacity: 0.85;
}

.buy-gallery-thumbs button.active {
  opacity: 1;
}

.buy-gallery-thumbs img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.buy-section-label {
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #7b6d61;
  font-weight: 600;
  margin-bottom: 8px;
}

.buy-overview {
  /* Deliberately inverted relative to the page's own theme (dark box on a
     light page, light box on a dark page) so it reads as a distinct,
     called-out block rather than blending into the rest of the panel. */
  background: var(--ink);
  color: var(--bg);
  border-radius: 16px;
  padding: 22px 24px;
  margin-bottom: 24px;
}

.buy-overview .buy-section-label {
  font-size: 1.2rem;
  letter-spacing: 0.02em;
  color: var(--bg);
  opacity: 0.72;
}

.buy-overview p {
  font-size: 1.08rem;
  line-height: 1.7;
  color: var(--bg);
}

.buy-instructor {
  padding-top: 20px;
  border-top: 1px solid rgba(23, 19, 16, 0.1);
}

.buy-instructor-name {
  text-transform: none;
  letter-spacing: normal;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.buy-instructor-row {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.buy-instructor-photo {
  /* Base fallback size before JS measures the "Instructor" word and sets
     an exact inline width to match it - see syncInstructorPhotoSize(). */
  width: 64px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
}

.buy-instructor-bio {
  font-size: 0.92rem;
  line-height: 1.6;
  color: #5e5349;
}

@media (max-width: 960px) {
  .buy-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

@media (max-width: 720px) {
  .buy-panel {
    padding: 32px 22px 26px;
  }
}

/* ---- Page-load entrance ----
   Very subtle fade + rise on first paint, shared across every page via
   this stylesheet's plain-element selectors (header.topbar / main /
   footer exist on all 11 pages). Pure CSS, no JS: it runs automatically
   as soon as each element paints, so there's no flash-of-unstyled-content
   to guard against. Disabled entirely for prefers-reduced-motion. */

@media (prefers-reduced-motion: no-preference) {
  header.topbar,
  main,
  footer {
    animation: page-enter 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  header.topbar {
    animation-delay: 0s;
  }

  main {
    animation-delay: 0.08s;
  }

  footer {
    animation-delay: 0.2s;
  }
}

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* .lightbox-scene layout (artwork + its caption, stacked) and the
   .lightbox-caption typography live inline in each gallery page's
   own <style> block, alongside the rest of the lightbox chrome
   (.lightbox / .lightbox-image-wrap / .lightbox img). The wall
   plate that used to sit here has been removed. */

