:root {
  color-scheme: light;
  --ink: #292722;
  --muted: #68635a;
  --line: #d8d1c4;
  --paper: #fffdf7;
  --soft: #f4efe4;
  --coral: #ed3d29;
  --coral-dark: #a92f26;
  --teal: #00801c;
  --teal-dark: #005f50;
  --yellow: #f2bd2f;
  --blue: #3178bd;
  --blue-dark: #13497b;
  --danger: #d36d13;
  font-family:
    "Trebuchet MS", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
}

a {
  color: inherit;
}

button,
.button-link {
  border: 0;
  border-bottom: 3px solid var(--coral-dark);
  border-radius: 6px;
  background: var(--coral);
  color: white;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  justify-content: center;
  min-height: 44px;
  padding: 0.75rem 1rem;
  text-decoration: none;
}

button:hover,
.button-link:hover {
  background: var(--coral-dark);
}

button:active,
.button-link:active {
  border-bottom-width: 1px;
  transform: translateY(2px);
}

input,
select {
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font: inherit;
  min-height: 44px;
  padding: 0.65rem 0.75rem;
  width: 100%;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--yellow) 70%, white);
  outline-offset: 2px;
}

label {
  display: grid;
  gap: 0.4rem;
  font-weight: 700;
}

input[name="tags"] {
  text-transform: uppercase;
}

.topbar {
  align-items: center;
  background: #fff9e8;
  border-bottom: 5px solid transparent;
  border-image: linear-gradient(90deg, var(--coral) 0 25%, var(--yellow) 25% 50%, var(--teal) 50% 75%, var(--blue) 75%) 1;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: 0.9rem clamp(1rem, 4vw, 2rem);
}

.brand {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
}

.topbar nav {
  align-items: center;
  display: flex;
  gap: 0.8rem;
}

.topbar nav a {
  font-weight: 700;
  text-decoration: none;
}

.topbar nav a:hover {
  color: var(--blue-dark);
  text-decoration: underline;
  text-decoration-color: var(--yellow);
  text-decoration-thickness: 3px;
  text-underline-offset: 4px;
}

.topbar nav form {
  margin: 0;
}

.ghost {
  background: transparent;
  border-bottom-color: transparent;
  color: var(--ink);
  min-height: 38px;
  padding: 0.45rem 0.65rem;
}

.ghost:hover {
  background: #f4e8c8;
}

.page {
  margin: 0 auto;
  max-width: 1180px;
  padding: clamp(1rem, 4vw, 2rem);
}

.narrow {
  max-width: 720px;
}

.page-heading {
  align-items: end;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.page-heading h1,
.login-panel h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.05;
  margin: 0;
}

.eyebrow {
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 0.35rem;
  text-transform: uppercase;
}

.filter {
  min-width: min(260px, 100%);
}

.filter-controls {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: minmax(0, 1fr) auto;
}

.date-filter {
  border-bottom: 2px solid var(--line);
  border-top: 2px solid var(--line);
  margin-bottom: 1.5rem;
  padding: 0.75rem 0;
}

.year-tabs {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding: 0.2rem 0;
}

.year-tab,
.month-chip {
  align-items: center;
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 800;
  justify-content: center;
  min-height: 40px;
  text-decoration: none;
}

.year-tab {
  border-bottom: 3px solid transparent;
  flex: 0 0 auto;
  min-width: 64px;
  padding: 0 0.65rem;
}

.year-tab:hover {
  border-bottom-color: var(--yellow);
}

.year-tab.active {
  border-bottom-color: var(--coral);
  color: var(--coral-dark);
}

.month-chips {
  display: grid;
  gap: 0.4rem;
  grid-template-columns: repeat(12, minmax(48px, 1fr));
  margin-top: 0.65rem;
}

.month-chip {
  background: #dceef9;
  border: 2px solid transparent;
  border-radius: 6px;
}

.month-chip:hover {
  border-color: var(--blue);
}

.month-chip.active {
  background: var(--yellow);
  border-color: var(--ink);
}

.month-chip.disabled {
  background: var(--soft);
  color: #9a9489;
  cursor: not-allowed;
}

.gallery {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.photo-tile {
  background: #fff;
  border: 2px solid #fff;
  border-bottom: 6px solid var(--coral);
  border-radius: 4px;
  box-shadow: 0 3px 10px rgb(41 39 34 / 12%);
  display: grid;
  overflow: hidden;
  text-decoration: none;
}

.photo-tile:nth-child(4n + 2) {
  border-bottom-color: var(--yellow);
  transform: rotate(0.25deg);
}

.photo-tile:nth-child(4n + 3) {
  border-bottom-color: var(--teal);
  transform: rotate(-0.25deg);
}

.photo-tile:nth-child(4n) {
  border-bottom-color: var(--blue);
}

.photo-tile:hover {
  box-shadow: 0 7px 18px rgb(41 39 34 / 18%);
  transform: translateY(-2px);
}

.photo-tile img {
  aspect-ratio: 1;
  background: var(--soft);
  object-fit: cover;
  width: 100%;
}

.empty-state,
.upload-form,
.login-panel,
.details {
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 6px;
  padding: clamp(1rem, 4vw, 1.5rem);
}

.empty-state {
  border-top: 7px solid var(--yellow);
}

.upload-form {
  border-top: 7px solid var(--blue);
}

.login-panel {
  border-top: 7px solid var(--coral);
  box-shadow: 0 8px 30px rgb(41 39 34 / 10%);
}

.details {
  border-top: 7px solid var(--teal);
}

.empty-state {
  max-width: 520px;
}

.empty-state h2 {
  margin: 0 0 0.5rem;
}

.empty-state p {
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 1rem;
}

.login-page {
  align-items: center;
  display: grid;
  background: #fff8df;
  padding: 1rem;
}

.login-panel {
  margin: 0 auto;
  max-width: 420px;
  width: 100%;
}

.login-panel h1 {
  margin-bottom: 1.25rem;
}

.form-error {
  color: var(--danger);
  font-weight: 700;
  margin: 0;
}

.form-success {
  color: var(--teal-dark);
  font-weight: 700;
  margin: 0 0 1rem;
}

.delete-trigger {
  background: transparent;
  border: 2px solid var(--danger);
  color: var(--danger);
}

.delete-trigger:hover,
.danger-button {
  background: var(--danger);
  border-bottom-color: #7d211d;
  color: #fff;
}

.delete-trigger:hover {
  border-bottom-color: var(--danger);
}

.danger-button:hover {
  background: #8f2823;
}

.delete-dialog {
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 6px;
  color: var(--ink);
  max-width: min(440px, calc(100vw - 2rem));
  padding: 1.5rem;
}

.delete-dialog::backdrop {
  background: rgb(41 39 34 / 62%);
}

.delete-dialog h2 {
  font-family: Georgia, "Times New Roman", serif;
  margin: 0 0 0.75rem;
}

.delete-dialog p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 1.25rem;
}

.dialog-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.dialog-actions form {
  margin: 0;
}

.photo-page {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  padding: clamp(1rem, 4vw, 2rem);
}

.viewer {
  align-items: center;
  background: #292722;
  border: 6px solid #fff;
  border-radius: 4px;
  box-shadow: 0 3px 14px rgb(41 39 34 / 18%);
  display: flex;
  min-height: 70vh;
  overflow: hidden;
  position: relative;
}

.back-to-gallery {
  align-items: center;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgb(41 39 34 / 22%);
  display: inline-flex;
  font-size: 1.5rem;
  font-weight: 800;
  height: 44px;
  justify-content: center;
  left: 1rem;
  line-height: 1;
  position: absolute;
  text-decoration: none;
  top: 1rem;
  width: 44px;
  z-index: 1;
}

.back-to-gallery:hover {
  background: var(--yellow);
}

.viewer img {
  max-height: 82vh;
  object-fit: contain;
  width: 100%;
}

.details {
  align-self: start;
  display: grid;
  gap: 1rem;
}

.details p {
  color: var(--muted);
  margin: 0;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tags a,
.tags span {
  background: #dceef9;
  border-radius: 999px;
  color: var(--ink);
  padding: 0.35rem 0.65rem;
  text-decoration: none;
}

.tags a:nth-child(4n + 2),
.tags span:nth-child(4n + 2) {
  background: #fff0b9;
}

.tags a:nth-child(4n + 3),
.tags span:nth-child(4n + 3) {
  background: #d9f0e9;
}

.tags a:nth-child(4n),
.tags span:nth-child(4n) {
  background: #f9ddd8;
}

.tags a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (prefers-reduced-motion: no-preference) {
  .photo-tile {
    transition: box-shadow 140ms ease, transform 140ms ease;
  }
}

@media (max-width: 760px) {
  .page-heading,
  .photo-page {
    display: grid;
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: start;
  }

  .topbar nav {
    flex-wrap: wrap;
    justify-content: end;
  }

  .viewer {
    min-height: auto;
  }

  .month-chips {
    grid-template-columns: repeat(4, minmax(54px, 1fr));
  }
}
