:root {
  --accent-color: #2d7ff9;
  --surface-page: #edf1f7;
  --surface: #fff;
  --ink: #1f2430;
  --ink-muted: #4c5566;
  --ink-inverse: #fff;
  --line: #d8dde7;
  --brand: #101626;
  --success: #2c8d3a;
  --danger: #c74343;
  --border-default: 1px solid var(--line);
  --radius-tooltip: 0.55rem;
  --radius-input: 0.65rem;
  --radius-panel: 0.75rem;
  --radius-panel-lg: 1rem;
  --radius-pill: 999px;
  --font-mono: "SF Mono", "Monaco", "Consolas", monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--surface-page);
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--surface-page);
  background-image:
    radial-gradient(1200px 720px at -12% -14%, rgb(251 252 255 / 100%) 0%, rgb(251 252 255 / 0%) 72%),
    linear-gradient(180deg, #f8fafe 0%, #eff3f9 42%, var(--surface-page) 100%);
  background-repeat: no-repeat;
  color: var(--ink);
  font-family: "Atkinson Hyperlegible", "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.site-nav {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-bottom: var(--border-default);
  background: color-mix(in srgb, var(--surface), transparent 20%);
  backdrop-filter: blur(4px);
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  font-weight: 700;

  .heroicon {
    width: 1.15rem;
    height: 1.15rem;
  }
}

.site-nav-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;

  .button_to {
    margin: 0;
  }
}

.account-menu {
  position: relative;

  &[open] .account-menu-items {
    display: grid;
  }
}

.account-menu-summary {
  list-style: none;

  &::-webkit-details-marker {
    display: none;
  }
}

.account-menu-items {
  position: absolute;
  right: 0;
  z-index: 20;
  display: none;
  gap: 0.4rem;
  margin-top: 0.4rem;
  min-width: 220px;
  padding: 0.45rem;
  border: var(--border-default);
  border-radius: var(--radius-panel);
  background: var(--surface);
  box-shadow: 0 10px 24px rgb(16 22 38 / 12%);

  .button_to {
    margin: 0;
  }
}

.account-menu-item {
  width: 100%;
  text-align: left;
}

.page-shell {
  max-width: 960px;
  margin: 2rem auto;
  padding: 0 1rem 2rem;

  @media (max-width: 640px) {
    margin-top: 1rem;
  }
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;

  > :is(h1, h2, p) {
    margin: 0;
  }
}

.section-header-compact {
  margin-bottom: 0.75rem;
}

.button,
input[type="submit"],
button[type="submit"] {
  display: inline-block;
  padding: 0.55rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--brand);
  color: var(--ink-inverse);
  cursor: pointer;
  text-decoration: none;
  font: inherit;
}

.button-ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.icon-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.icon-label-icon {
  display: block;
}

.icon-label-text,
.camera-label {
  line-height: 1;
}

.heroicon {
  width: 1rem;
  height: 1rem;
  flex: none;
}

.inline-icon-link {
  display: inline-flex;
  align-items: center;
  text-decoration: underline;
}

.flash {
  max-width: 960px;
  margin: 1rem auto 0;
  padding: 0.6rem 0.75rem;
  border: var(--border-default);
  border-radius: var(--radius-panel);
  background: var(--surface);
}

.flash-notice {
  border-color: color-mix(in srgb, var(--success), white 70%);
  background: #f4fff4;
}

.flash-alert {
  border-color: color-mix(in srgb, var(--danger), white 70%);
  background: #fff4f4;
}

.field-group {
  display: grid;
  gap: 0.65rem;
  max-width: 420px;

  :is(input[type="text"], input[type="email"], input[type="password"], input[type="color"], input[type="file"]) {
    padding: 0.55rem;
    border: var(--border-default);
    border-radius: var(--radius-input);
    background: var(--surface);
  }
}

.auth-shell {
  max-width: 520px;
}

.auth-form {
  input[type="submit"] {
    margin-top: 0.75rem;
  }
}

.auth-form-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;

  :is(input[type="submit"], button[type="submit"]) {
    margin-top: 0;
  }

  button[type="submit"].button-link {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--ink-muted);
    text-decoration: underline;

    &:is(:hover, :focus-visible) {
      background: transparent;
      color: var(--ink);
    }
  }
}

.auth-form-separator {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: color-mix(in srgb, var(--ink), white 45%);
  font-size: 0.88rem;
  white-space: nowrap;

  &::before,
  &::after {
    content: "";
    width: 1.4rem;
    height: 1px;
    background: color-mix(in srgb, var(--line), white 45%);
  }
}

.skip-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;

  &:is(:hover, :focus-within) .skip-help-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-2px);
  }
}

.skip-help-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  line-height: 1;
  cursor: help;

  &:is(:hover, :focus-visible) {
    color: var(--ink);
  }
}

.skip-help-icon {
  width: 1rem;
  height: 1rem;
}

.skip-help-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.5rem);
  z-index: 10;
  width: max-content;
  max-width: 260px;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-tooltip);
  background: var(--brand);
  color: var(--ink-inverse);
  font-size: 0.78rem;
  line-height: 1.35;
  white-space: normal;
  box-shadow: 0 10px 24px rgb(16 22 38 / 30%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-50%);
  transition: opacity 120ms ease, transform 120ms ease;

  &::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--brand) transparent transparent transparent;
  }
}

.color-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.accent-swatch {
  width: 32px;
  height: 32px;
  border: var(--border-default);
  border-radius: 50%;
}

.event-list,
.photo-grid,
.feed-gallery-grid {
  display: grid;
  gap: 0.75rem;
}

.event-card {
  padding: 0.75rem 1rem;
  border: 1px solid color-mix(in srgb, var(--accent-color), white 75%);
  border-left: 6px solid var(--accent-color);
  border-radius: var(--radius-panel);
  background: var(--surface);
}

.panel {
  padding: 1rem;
  border: var(--border-default);
  border-radius: var(--radius-panel-lg);
  background: var(--surface);
}

.panel-accent {
  border: 1px solid color-mix(in srgb, var(--accent-color), white 70%);
  border-left: 8px solid var(--accent-color);
}

.event-header {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.event-logo {
  max-height: 200px;
  width: auto;
}

.event-admins,
.qr-card {
  margin-top: 1rem;
}

.event-admin-list {
  display: grid;
  gap: 0.4rem;
  margin: 0;
  padding-left: 1.1rem;

  li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    flex-wrap: wrap;
  }

  .button_to {
    margin: 0;
  }
}

.event-admin-meta {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.event-admin-email,
.qr-url,
.photo-filename,
.photo-modal-filename,
.feed-slideshow-caption {
  font-family: var(--font-mono);
}

.event-admin-email {
  font-size: 0.9rem;
}

.event-admin-role {
  color: var(--ink-muted);
  font-size: 0.82rem;
}

.event-admin-form {
  margin-top: 0.75rem;
}

.qr-card-layout {
  display: grid;
  align-items: center;
  gap: 1rem 2rem;
  grid-template-columns: minmax(0, 1fr) auto;

  @media (max-width: 640px) {
    align-items: start;
    grid-template-columns: 1fr;
  }
}

.qr-card-main {
  min-width: 0;
  display: grid;
  gap: 0.75rem;

  :is(h2, p) {
    margin: 0;
  }
}

.qr-card-aside {
  display: grid;
  justify-self: end;
  justify-items: end;
  gap: 0.65rem;

  @media (max-width: 640px) {
    justify-self: start;
    justify-items: start;
  }
}

.qr-code-graphic {
  svg {
    display: block;
    width: 180px;
    height: 180px;
  }
}

.qr-link-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  max-width: 100%;

  &[data-state="copied"] .qr-copy-button {
    border-color: color-mix(in srgb, var(--success), white 35%);
    color: #1d5b26;
  }

  @media (max-width: 640px) {
    flex-direction: column;
    align-items: stretch;
  }
}

.qr-url {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0.5rem 0.65rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius-tooltip);
  background: #f8fafd;
  font-size: 0.86rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.qr-copy-button {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;

  @media (max-width: 640px) {
    width: fit-content;
  }
}

.booth-shell {
  min-height: 100vh;
  display: grid;
  align-content: center;
  gap: 1.5rem;
  padding: 1.25rem;
  background: radial-gradient(
    circle at top,
    color-mix(in srgb, var(--accent-color), white 78%) 0%,
    #f4f6fa 55%,
    #ebeff5 100%
  );
}

.booth-header {
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  text-align: center;

  h1 {
    margin: 0;
  }
}

.booth-actions {
  display: grid;
  justify-self: center;
  gap: 0.85rem;
  width: 100%;
  max-width: 420px;
}

.booth-capture-form {
  width: 100%;
}

.button-large {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 8.75rem;
  padding: 1.1rem 1rem 1.25rem;
  background: color-mix(in srgb, var(--accent-color), black 18%);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
}

.camera-icon {
  display: inline-flex;

  svg {
    width: 6rem;
    height: 6rem;
    fill: currentColor;
  }
}

.button-small {
  padding: 0.55rem 0.8rem;
  font-size: 0.95rem;
  text-align: center;
}

.booth-upload-note {
  margin: 0;
  color: var(--ink-muted);
  text-align: center;
}

.booth-upload-form {
  margin: 0;
}

.booth-upload-link {
  text-decoration: underline;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.photo-library,
.device-photos,
.feed-gallery,
.feed-mode-toggle {
  margin-top: 1rem;
}

.photo-library-header {
  margin-bottom: 0;
}

.segmented-control {
  display: inline-flex;
  gap: 0.5rem;
  flex-wrap: wrap;

  .button {
    padding: 0.4rem 0.85rem;

    &[aria-current="page"] {
      background: var(--brand);
      border-color: var(--brand);
      color: var(--ink-inverse);
    }
  }
}

.photo-table {
  width: 100%;
  margin-top: 1rem;
  overflow: hidden;
  border: var(--border-default);
  border-collapse: collapse;
  border-radius: var(--radius-panel);
  background: var(--surface);

  :is(th, td) {
    padding: 0.7rem 0.75rem;
    border-bottom: var(--border-default);
    text-align: left;
    vertical-align: middle;
  }

  thead {
    background: color-mix(in srgb, var(--brand), white 92%);
  }

  tbody tr:last-child td {
    border-bottom: 0;
  }

  @media (max-width: 640px) {
    font-size: 0.92rem;
  }
}

.photo-row {
  cursor: pointer;

  &:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--brand), white 10%);
    outline-offset: -2px;
  }

  &:hover {
    background: color-mix(in srgb, var(--brand), white 96%);
  }
}

.photo-thumbnail {
  width: 92px;

  @media (max-width: 640px) {
    width: 76px;
  }
}

.photo-thumbnail-image {
  display: block;
  width: 72px;
  max-width: 100%;
  border-radius: var(--radius-input);

  @media (max-width: 640px) {
    width: 56px;
  }
}

.photo-filename {
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.photo-grid {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.photo-card {
  position: relative;
  margin: 0;
  padding: 0.5rem;
  border: var(--border-default);
  border-radius: var(--radius-panel);
  background: var(--surface);
}

.photo-card-image {
  display: block;
  width: 100%;
  border-radius: var(--radius-input);
}

.photo-open-button {
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.photo-modal {
  width: 92vw;
  max-width: min(92vw, 1120px);
  padding: 0;
  border: 0;
  background: transparent;

  @media (max-width: 640px) {
    width: 96vw;
    max-width: 96vw;
  }

  &::backdrop {
    background: rgb(8 12 20 / 75%);
    backdrop-filter: blur(2px);
  }
}

.photo-modal-card {
  margin: 0;
  padding: 0.75rem;
  border: 1px solid #263147;
  border-radius: 0.85rem;
  background: #111827;
  color: var(--ink-inverse);
}

.photo-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.photo-modal-filename {
  margin: 0;
  color: #dbe4f0;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.photo-modal-close {
  flex: none;
  border-color: #3d4a63;
  background: transparent;
  color: var(--ink-inverse);
}

.photo-modal-image {
  display: block;
  width: 100%;
  max-height: 78vh;
  border-radius: var(--radius-input);
  object-fit: contain;
}

.photo-delete-form {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  margin: 0;
}

.photo-delete-form-inline {
  position: static;
}

button.photo-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0 0 0 2px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--brand);
  color: var(--ink-inverse);
  line-height: 0;
  cursor: pointer;
  box-shadow: 0 6px 18px rgb(16 22 38 / 34%);

  &:is(:hover, :focus-visible) {
    background: color-mix(in srgb, var(--brand), white 10%);
  }
}

.photo-delete-icon {
  display: block;
  width: 1.1rem;
  height: 1.1rem;
  stroke-width: 2.25;
  transform: translate(-1px, 0);
}

button.photo-delete-text {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.photo-delete-text-icon {
  width: 0.95rem;
  height: 0.95rem;
  stroke-width: 1.9;
}

.hint {
  color: var(--ink-muted);
}

.errors {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--danger);
  border-radius: var(--radius-panel);
  background: #fff4f4;
}

.feed {
  min-height: calc(100vh - 72px);
  margin: 0;
  padding: 1rem;
}

.feed[data-fullscreen="true"] {
  min-height: 100vh;
  padding: 0;
  background: #000;
}

.feed-header {
  h1 {
    margin: 0;
    font-size: clamp(1.5rem, 1.2rem + 1.8vw, 2.4rem);
  }

  p {
    margin: 0.5rem 0 0;
    color: var(--ink-muted);
  }
}

.feed-mode-toggle {
  margin-top: 1rem;
}

.feed-gallery-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));

  @media (min-width: 1024px) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.feed[data-fullscreen="true"] .feed-gallery {
  margin-top: 0;
}

.feed[data-fullscreen="true"] .feed-gallery-grid {
  gap: 0;
  width: 100vw;
  min-height: 100vh;
  height: 100vh;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.feed[data-fullscreen="true"] .feed-gallery-item {
  border: 0;
  border-radius: 0;
  aspect-ratio: auto;
}

.feed[data-fullscreen="true"] .feed-gallery-item:nth-child(n + 7) {
  display: none;
}

@media (orientation: portrait) {
  .feed[data-fullscreen="true"] .feed-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(0, 1fr));
  }
}

.feed-gallery-item {
  margin: 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: var(--border-default);
  border-radius: 0.8rem;
  background: var(--surface);

  img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

.feed-slideshow {
  display: grid;
  align-content: center;
  min-height: calc(100vh - 220px);
  margin-top: 1rem;
}

.feed-slideshow-stage {
  margin: 0;
  overflow: hidden;
  border: var(--border-default);
  border-radius: var(--radius-panel-lg);
  background: #0f1523;
}

.feed-slideshow-image {
  display: block;
  width: 100%;
  max-height: calc(100vh - 290px);
  object-fit: contain;
}

.feed-slideshow-caption {
  min-height: 2.2rem;
  margin: 0;
  padding: 0.6rem 0.75rem;
  background: rgb(15 21 35 / 92%);
  color: #e5edf9;
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.feed[data-fullscreen="true"] .feed-slideshow {
  min-height: 100vh;
  margin-top: 0;
}

.feed[data-fullscreen="true"] .feed-slideshow-stage {
  height: 100vh;
  border: 0;
  border-radius: 0;
}

.feed[data-fullscreen="true"] .feed-slideshow-image {
  width: 100vw;
  height: 100vh;
  max-height: none;
}
