.portal {
  --portal-paper: var(--paper, #f6f0e8);
  --portal-ink: var(--plum, #341724);
  --portal-muted: var(--muted, #6d5459);
  --portal-line: #d7c5bd;
  --portal-serif: var(--serif, 'Cormorant Garamond', Georgia, serif);
  --portal-sans: var(--sans, Manrope, system-ui, sans-serif);
  min-block-size: 100svh;
  display: flex;
  flex-direction: column;
  margin: 0;
  color: var(--portal-ink);
  background: var(--portal-paper);
  font: 1rem/1.6 var(--portal-sans);
}

.portal *, .portal *::before, .portal *::after { box-sizing: border-box; }
.portal [hidden] { display: none !important; }
.portal a { color: inherit; }
.portal :focus-visible { outline: 2px solid #ad4e4c; outline-offset: 4px; }
.portal h1, .portal h2, .portal h3, .portal p { margin: 0; }
.portal h1, .portal h2, .portal h3 { font-family: var(--portal-serif); font-weight: 500; line-height: .98; letter-spacing: -.038em; }
.portal h1 { font-size: clamp(3.1rem, 7vw, 6.9rem); }
.portal h2 { font-size: clamp(2.05rem, 4vw, 3.05rem); }
.portal h3 { font-size: clamp(1.6rem, 3vw, 2.3rem); }
.portal h1 em { font-weight: inherit; }
.portal button, .portal input, .portal textarea, .portal select { font: inherit; }
.portal button { cursor: pointer; }
.portal button:disabled { opacity: .58; cursor: wait; }
.portal input, .portal textarea, .portal select { min-inline-size: 0; }
.portal :is([id], input, textarea, select, button) { scroll-margin-block: 1rem; }

.portal-frame { inline-size: min(calc(100% - clamp(2rem, 8vw, 8rem)), 88rem); margin-inline: auto; }
.portal > main { flex: 1; }
.portal-skip { position: fixed; z-index: 10; inset: .5rem auto auto 1rem; translate: 0 -150%; padding: .75rem 1rem; background: var(--portal-paper); }
.portal-skip:focus { translate: 0; }
.portal-head { border-bottom: 1px solid var(--portal-line); }
.portal-head-inner { display: flex; align-items: center; gap: clamp(1rem, 3vw, 3rem); min-block-size: 5.25rem; }
.portal-brand { display: inline-flex; align-items: center; gap: .7rem; text-decoration: none; margin-inline-end: auto; line-height: 1.02; white-space: nowrap; }
.portal-brand strong { display: block; font: 500 1.52rem/.98 var(--portal-serif); }
.portal-brand small { display: block; margin-block-start: .45rem; font-size: .7rem; letter-spacing: .17em; }
.portal-monogram { display: block; inline-size: 2.65rem; block-size: auto; aspect-ratio: 1; }
.portal-nav { display: flex; flex-wrap: wrap; align-items: center; gap: clamp(.7rem, 3vw, 2.45rem); }
.portal-nav a, .portal-foot a { text-decoration: none; }
.portal-nav a[aria-current], .portal-nav a:hover, .portal-foot a:hover { text-decoration: underline; text-underline-offset: .4em; text-decoration-color: #a75250; }
.portal-nav a, .portal-foot { font-size: .875rem; }
.portal-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.5rem; padding-block: 1.65rem; border-top: 1px solid var(--portal-line); margin-block-start: clamp(2rem, 5vw, 5rem); color: var(--portal-muted); }
.portal .portal-kicker { font-size: .825rem; font-weight: 680; letter-spacing: .17em; text-transform: uppercase; }

.course-cover { display: grid; grid-template-columns: 1.21fr .79fr; min-block-size: min(39rem, 78vh); margin-block-start: clamp(1.35rem, 4vw, 3.75rem); border: 1px solid var(--portal-line); }
.course-art { position: relative; isolation: isolate; display: flex; align-items: end; overflow: hidden; min-block-size: 30rem; color: #fff2e7; background: #341824; padding: clamp(1.5rem, 5.5vw, 5.2rem); }
.course-art::after { content: ''; position: absolute; z-index: -1; inset: 0; background: linear-gradient(8deg,#210d19e8 0%,#2b1122ab 26%,#2b112200 72%); }
.course-art-image { position: absolute; z-index: -2; inset: 0; background-color: #4e2333; background-image: linear-gradient(135deg, #732e4a38, #350f2654), url('assets/texture.webp'), radial-gradient(ellipse at 65% 43%, #dd8d74a1, #a6565580 25%, transparent 58%), radial-gradient(ellipse at 85% 35%, #200e22, #5f2b42 75%); background-position: center; background-size: cover; }
.course-art-image::after { content: ''; position: absolute; inset: 13% 13% 18% 17%; border: 1px solid #fdd7be82; border-radius: 50%; rotate: -26deg; box-shadow: 0 0 2.25rem #f5ae8d25 inset; animation: course-orbit 11s ease-in-out infinite alternate; }
@keyframes course-orbit { to { rotate: -16deg; scale: 1.08 .95; } }
.course-art h1 { font-size: clamp(2.8rem, 6.15vw, 6.9rem); }
.course-art h1 em { color: #ffa98d; }
.course-art .portal-kicker { margin-block-end: 1.15rem; color: #ffe0ce; }
.access-panel { display: grid; place-items: center; padding: clamp(1.5rem, 5vw, 5.5rem); background: #fff8f150; }
.access-content { inline-size: min(100%, 29rem); }
.access-content h2, .access-content h1 { margin-block: .7rem 1.1rem; }
.access-content > p:not(.portal-kicker) { color: var(--portal-muted); }
.access-content .portal-form { margin-block-start: 1.7rem; }
.local-note { font-size: .875rem; border-inline-start: 2px solid #c46f67; padding-inline-start: .8rem; margin-block-start: .75rem !important; }
.local-note a { text-decoration: underline; }

.portal-form { display: grid; gap: .9rem; }
.portal-form label { display: grid; align-content: start; gap: .35rem; min-inline-size: 0; font-size: .875rem; font-weight: 670; }
.portal-form input, .portal-form textarea, .portal-form select { inline-size: 100%; min-block-size: 2.85rem; padding: .65rem .85rem; color: var(--portal-ink); background: #fffaf4; border: 1px solid #bda5a0; border-radius: .28rem; font-size: 1rem; font-weight: 450; line-height: 1.3; }
.portal-form textarea { resize: vertical; }
.portal-form input::placeholder { color: #765d60; }
.portal .solid-button, .portal .outline-button { display: inline-flex; align-items: center; justify-content: center; justify-self: start; min-block-size: 2.8rem; max-inline-size: 100%; border-radius: 2rem; padding: .55rem 1.25rem; font-size: .875rem; line-height: 1.25; font-weight: 690; text-align: center; transition: background-color .2s ease, color .2s ease, border-color .2s ease; }
.portal .solid-button { border: 1px solid var(--portal-ink); background: var(--portal-ink); color: #fff5ee; }
.portal .solid-button:hover:not(:disabled) { border-color: #72364b; background: #72364b; }
.portal .outline-button { border: 1px solid #a77e77; color: var(--portal-ink); background: transparent; }
.portal .outline-button:hover:not(:disabled) { background: #f0dcd1; border-color: #92534f; }
.portal-form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
#refresh-bookings { margin: .65rem 0 1rem; }
.portal .portal-feedback { color: #5b413f; font-size: .875rem; font-weight: 600; }
.portal .portal-feedback[data-error='true'] { color: #92293b; }
.portal .portal-feedback:empty { display: none; }
.portal-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; }
.field-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.form-help { font-size: .875rem; color: var(--portal-muted); }

.course-library { margin-block-start: clamp(2rem, 5vw, 5rem); }
.course-library-intro { padding: clamp(2rem, 6vw, 5rem); background: #3a1c2b; color: #fff3e9; }
.course-library-intro h1, .admin-intro h1 { margin-block: .65rem .95rem; }
.course-library-intro h1 em { color: #ffa98d; }
.course-list { display: grid; gap: 1rem; margin-block-start: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr)); }
.course-item { display: grid; align-content: start; gap: .65rem; padding: clamp(1.35rem, 3.5vw, 2.7rem); border: 1px solid var(--portal-line); }
.course-item p { color: var(--portal-muted); }

.admin-login { display: grid; justify-items: center; padding: clamp(2rem, 7vw, 6rem) clamp(1rem, 4vw, 3.5rem); background: #fffaf455; border: 1px solid var(--portal-line); margin-block-start: clamp(1.5rem, 6vw, 5rem); }
.admin-login h1 { font-size: clamp(2.65rem, 5vw, 4.8rem); }
.admin-workspace { margin-block-start: clamp(2rem, 5vw, 4.5rem); }
.admin-intro h1 { font-size: clamp(3rem, 6.8vw, 6rem); }
.admin-intro em { color: #8b3d4b; }
.admin-nav { display: flex; flex-wrap: wrap; gap: 0 clamp(.8rem, 3vw, 2rem); margin-block: 1.15rem 2rem; border-bottom: 1px solid var(--portal-line); }
.admin-nav button { position: relative; padding: .55rem .15rem .8rem; border: 0; background: none; color: var(--portal-muted); font-weight: 680; }
.admin-nav button[aria-current] { color: var(--portal-ink); }
.admin-nav button[aria-current]::after { content: ''; position: absolute; inset: auto 0 -1px; block-size: 2px; background: #a85359; }
.admin-grid { display: grid; grid-template-columns: 1.25fr .75fr; align-items: start; gap: clamp(1.4rem, 4vw, 3.5rem); }
.admin-panel { padding: clamp(1rem, 2.8vw, 2.35rem); background: #fffaf45f; border: 1px solid var(--portal-line); }
.admin-panel h3 { margin-block-end: 1.15rem; }
.admin-list { margin-block-start: 1rem; border-top: 1px solid var(--portal-line); }
.admin-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; padding-block: 1.1rem; border-bottom: 1px solid var(--portal-line); gap: .75rem 1.5rem; }
.admin-row-image { flex: none; inline-size: 4.25rem; aspect-ratio: 1; object-fit: cover; }
.admin-row-copy { flex: 1 1 12rem; min-inline-size: 0; overflow-wrap: anywhere; }
.admin-row h3 { font-size: clamp(1.45rem, 2.7vw, 1.85rem); }
.admin-row p { color: var(--portal-muted); font-size: .875rem; margin-block-start: .4rem; }
.admin-row .admin-status { color: #7b2f42; font-weight: 670; }
.admin-empty { color: var(--portal-muted); padding-block: 1.1rem; }
#workspace-status:not(:empty) { margin-block-end: .9rem; }
.portal-dialog { inline-size: min(calc(100% - 2rem), 28rem); padding: 1.65rem; border: 1px solid var(--portal-line); background: var(--portal-paper); color: var(--portal-ink); }
.portal-dialog::backdrop { background: #21101ac7; }
.service-photo { display: grid; gap: .65rem; min-inline-size: 0; margin: 0; padding: .65rem .85rem .85rem; border: 1px solid var(--portal-line); }
.service-photo legend { padding-inline: .3rem; font-size: .875rem; font-weight: 670; }
#service-photo-preview { display: block; inline-size: min(100%, 12rem); aspect-ratio: 1.48; object-fit: cover; border-radius: .35rem; }
.service-question-editor { margin-block-start: 1.6rem; padding-block-start: 1.35rem; border-top: 1px solid var(--portal-line); }
.service-question-editor p { white-space: pre-line; }
.service-question-editor .portal-form { margin-block-start: 1rem; }
.service-gallery { inline-size: min(calc(100% - 1.5rem), 48rem); max-block-size: calc(100% - 1.5rem); padding: clamp(1rem, 4vw, 1.65rem); }
.service-gallery-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; margin-block-end: 1rem; }
#service-gallery-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: .7rem; }
.service-gallery-image { display: grid; align-content: start; gap: .35rem; min-inline-size: 0; padding: .35rem; border: 1px solid var(--portal-line); border-radius: .35rem; background: #fffaf4; color: var(--portal-ink); font-size: .78rem; text-align: start; overflow-wrap: anywhere; }
.service-gallery-image:hover { border-color: var(--portal-ink); }
.service-gallery-image img { display: block; inline-size: 100%; aspect-ratio: 1.48; object-fit: cover; border-radius: .2rem; }

@media (max-width: 52rem) {
  .course-cover, .admin-grid { grid-template-columns: minmax(0, 1fr); }
  .course-art { min-block-size: clamp(18rem, 57vw, 27rem); }
  .course-art h1 { font-size: clamp(3rem, 8.4vw, 6rem); }
  .access-panel { justify-items: start; }
}

@media (max-width: 32rem) {
  .portal-head-inner { min-block-size: 4.6rem; flex-wrap: wrap; gap: .45rem .85rem; padding-block: .65rem; }
  .portal-head-inner [data-logout] { margin-inline-start: auto; }
  .portal-brand { gap: .45rem; }
  .portal-brand strong { font-size: 1.2rem; }
  .portal-brand small { font-size: .62rem; margin-block-start: .25rem; }
  .portal-monogram { inline-size: 2.1rem; }
  .portal-nav { gap: .78rem; }
  .portal-nav a { font-size: .82rem; }
  .course-art h1 { font-size: clamp(2.6rem, 11vw, 3.75rem); }
  .field-pair { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .portal .course-art-image::after { animation: none; }
  .portal .solid-button, .portal .outline-button { transition: none; }
}
