@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;600&family=Space+Grotesk:wght@400;500;600&display=swap");

:root {
  --ink: #141414;
  --paper: #f5f5f5;
  --accent: #f26430;
  --accent-dark: #b13a14;
  --logo-accent: #1e6c5c;
  --shadow: rgba(20, 20, 20, 0.12);
  --glass: rgba(255, 255, 255, 0.9);
  --shelf-font: "Playfair Display", "Times New Roman", serif;
}

html,
body {
  height: 100%;
}

html {
  overflow-x: hidden;
  overflow-y: hidden;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  min-height: 100%;
  padding: 48px 24px 80px;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
}

body.modal-open {
  overflow: hidden;
}

.top-nav {
  max-width: 1400px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: relative;
  z-index: 2;
}

.top-nav-links {
  display: flex;
  gap: 18px;
  font-size: 1.05rem;
}

.top-nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
}

.top-nav-actions .auth-logout {
  padding: 8px 14px;
  border-radius: 999px;
  background: #1f1f1f;
  color: #f8f2ec;
  border: none;
  box-shadow: 0 10px 20px rgba(20, 20, 20, 0.18);
}

.auth-logout svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: none;
}

.auth-email {
  color: #4b3d33;
  font-weight: 600;
}

.auth-user {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 1.105rem;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.auth-user:hover {
  box-shadow: none;
  transform: none;
  background: transparent;
}

.auth-user:hover .auth-avatar {
  transform: scale(1.05);
}

.auth-user:hover #auth-name {
  text-decoration: underline;
}

.auth-avatar {
  transition: transform 0.2s ease;
}

.auth-avatar {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(20, 20, 20, 0.12);
  background: #f3ece5;
}

.top-nav-links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #5c5c5c;
  transition: color 0.2s ease;
}

.top-nav-links a svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: none;
}

.top-nav-links a:hover {
  color: var(--accent-dark);
}

.top-nav-links a.is-active {
  color: #1f1f1f;
  font-weight: 600;
}


.orb {
  position: absolute;
  border-radius: 50%;
  opacity: 0.35;
  z-index: 0;
}

.orb-one {
  width: 320px;
  height: 320px;
  background: #ededed;
  top: -120px;
  left: -80px;
}

.orb-two {
  width: 280px;
  height: 280px;
  background: #e6e6e6;
  bottom: -140px;
  right: -100px;
}

.hero {
  max-width: 960px;
  margin: 0 auto 40px;
  text-align: left;
  position: relative;
  z-index: 1;
}


.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-size: 12px;
  margin-bottom: 8px;
  color: #7a5d4b;
}

.hero h1 {
  font-size: clamp(3.64rem, 5.2vw, 5.46rem);
  margin: 0 0 12px;
}

.logo {
  letter-spacing: -0.02em;
}

.logo-mark {
  color: var(--logo-accent);
}

.lead {
  max-width: 560px;
  font-size: 1.05rem;
  line-height: 1.55;
  color: #5b4a3f;
}

.layout {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  max-width: 960px;
  margin: 0 auto 48px;
  position: relative;
  z-index: 1;
}

.auth-panel {
  display: grid;
  gap: 18px;
}

.modal-content.auth-panel {
  width: min(92vw, 520px);
}

.auth-panel form {
  max-width: 420px;
}

.auth-field {
  position: relative;
  display: grid;
}

.auth-input {
  padding-right: 48px;
}

.auth-submit {
  position: absolute;
  right: 8px;
  top: 6px;
  bottom: 6px;
  transform: none;
  width: 36px;
  height: auto;
  border-radius: 12px;
  border: 1px solid rgba(20, 20, 20, 0.15);
  background: #1f1f1f;
  color: #f8f2ec;
  display: grid;
  place-items: center;
  padding: 0;
  box-shadow: none;
  line-height: 0;
}

.auth-submit svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.icon-button {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid rgba(20, 20, 20, 0.15);
  background: transparent;
  color: #1f1f1f;
  display: grid;
  place-items: center;
  box-shadow: none;
  position: relative;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button:hover {
  transform: none;
  box-shadow: none;
}

.auth-header h2 {
  margin: 0 0 6px;
}

.auth-status {
  display: grid;
  gap: 12px;
  align-items: start;
}

.auth-status button {
  justify-self: start;
}

body.is-authenticated .auth-login {
  display: none;
}

body.is-authenticated .auth-register {
  display: none;
}

.auth-register {
  display: none;
}

.auth-login {
  display: none;
}

.auth-panel[data-active-tab="login"] .auth-login {
  display: grid;
}

.auth-panel[data-active-tab="register"] .auth-register {
  display: grid;
}

body:not(.is-authenticated) .auth-logout {
  display: none;
}

.auth-action {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(20, 20, 20, 0.15);
  background: #f3ebe4;
  color: #3a2f28;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.auth-action--primary {
  background: #1f1f1f;
  color: #f8f2ec;
  border: none;
}

.auth-icon {
  width: auto;
  height: auto;
  padding: 8px 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(20, 20, 20, 0.15);
  background: #f3ebe4;
  color: #3a2f28;
  position: relative;
}

.auth-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: none;
}

.auth-icon.auth-action--primary {
  background: #1f1f1f;
  color: #f8f2ec;
  border: none;
}

.auth-icon:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(20, 20, 20, 0.18);
}

.auth-icon.auth-action--primary:hover {
  background: #111111;
  color: #f8f2ec;
}

.auth-icon .auth-label {
  position: static;
  width: auto;
  height: auto;
  padding: 0;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: nowrap;
  border: 0;
}

body.is-authenticated .auth-action {
  display: none;
}

body:not(.is-authenticated) .auth-logout,
body:not(.is-authenticated) .auth-email {
  display: none;
}

body:not(.is-authenticated) #comment-form {
  display: none;
}

body.is-authenticated #comment-login {
  display: none;
}

body:not(.is-authenticated) .shelf-settings-btn,
body:not(.is-authenticated) .photo-rail .photo--add,
body:not(.is-authenticated) .lightbox-delete {
  display: none;
}

body:not(.is-authenticated) .lightbox-settings,
body:not(.is-authenticated) .lightbox-menu {
  display: none;
}

body:not(.is-authenticated) .photo-overlay {
  display: none;
}

body[data-page="explore"] .shelf-settings-btn,
body[data-page="explore"] .photo-rail .photo--add,
body[data-page="explore"] .lightbox-delete {
  display: none;
}

body[data-page="explore"] .photo-overlay {
  display: none;
}

.panel {
  background: var(--glass);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 24px 60px var(--shadow);
  backdrop-filter: blur(8px);
}

.panel h2 {
  margin-top: 0;
}

form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.95rem;
}

input,
select,
button {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #d8c3b2;
  font-size: 0.95rem;
  font-family: inherit;
}

textarea {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #d8c3b2;
  font-size: 0.95rem;
  font-family: inherit;
  resize: none;
}

.profile-lightbox-content textarea {
  min-height: 72px;
  max-height: 140px;
  line-height: 1.4;
}

.profile-about {
  gap: 10px;
}

.profile-bio {
  font-family: var(--shelf-font);
  font-size: 1.05rem;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  min-height: 48px;
  white-space: pre-wrap;
}

.profile-about textarea {
  border: none;
  border-radius: 18px;
  background: linear-gradient(180deg, #f3ece5 0%, #f8f4ef 100%);
  box-shadow: inset 0 0 0 1px rgba(20, 20, 20, 0.08);
  padding: 14px 50px 14px 16px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.profile-about textarea:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(20, 20, 20, 0.18),
    0 10px 24px rgba(20, 20, 20, 0.12);
}

.profile-about-field {
  position: relative;
  display: grid;
}

.icon-button--inline {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
}

.icon-button--inline .icon-save,
.icon-button--inline .icon-check,
.icon-button--inline .icon-dot {
  grid-area: 1 / 1;
  display: block;
}

.icon-button--inline .icon-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0;
}

.icon-button--inline .icon-check {
  opacity: 0;
}

.profile-public-form.is-saved .icon-button--inline .icon-save {
  animation: saveSwap 2s ease-in-out 0s 1;
}

.profile-public-form.is-saved .icon-button--inline .icon-dot {
  animation: saveDot 2s ease-in-out 0s 1;
}

.profile-public-form.is-saved .icon-button--inline .icon-check {
  animation: saveCheck 2s ease-in-out 0s 1;
}

@keyframes saveSwap {
  0%,
  20% {
    opacity: 1;
    transform: scale(1);
  }
  30%,
  70% {
    opacity: 0;
    transform: scale(0.8);
  }
  85%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes saveDot {
  0%,
  15% {
    opacity: 0;
    transform: scale(0.6);
  }
  20%,
  35% {
    opacity: 1;
    transform: scale(1);
  }
  40%,
  100% {
    opacity: 0;
    transform: scale(0.6);
  }
}

@keyframes saveCheck {
  0%,
  45% {
    opacity: 0;
    transform: scale(0.8);
  }
  55%,
  80% {
    opacity: 1;
    transform: scale(1);
  }
  90%,
  100% {
    opacity: 0;
    transform: scale(0.8);
  }
}

button {
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#upload-form button {
  background: #111111;
  color: #f8f2ec;
  border: 1px solid #111111;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(20, 20, 20, 0.18);
}

.hint {
  margin: 0;
  font-size: 0.8rem;
  color: #7a5d4b;
}

.gallery {
  max-width: 1400px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  overflow: visible;
}

.gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.gallery-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.shelf-order-btn {
  display: none;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: none;
  background: transparent;
  color: #8a7568;
  cursor: pointer;
  place-items: center;
  padding: 0;
  box-shadow: none;
}

.shelf-order-btn.is-visible {
  display: grid;
}

.shelf-order-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease;
}

.shelf-order-btn[data-order="old"] svg {
  transform: rotate(180deg);
}

.shelf-order-btn:hover {
  background: transparent;
  box-shadow: none;
  transform: none;
  color: #5f4b3f;
}

.shelf-order-btn:focus {
  outline: 2px solid rgba(31, 31, 31, 0.2);
  outline-offset: 2px;
}

.back-to-shelves {
  display: none;
  align-items: center;
  border-radius: 999px;
  border: 1px solid #d8c3b2;
  background: #fffaf5;
  color: #3a2f28;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  padding: 6px 14px;
  cursor: pointer;
  box-shadow: none;
}

.back-to-shelves.is-visible {
  display: inline-flex;
}

.back-to-shelves:hover {
  background: #f4e9dd;
  box-shadow: none;
  transform: none;
}

.explore-filters {
  display: none;
  align-items: center;
  gap: 8px;
}

body[data-page="explore"] .explore-filters {
  display: inline-flex;
}

.explore-filter {
  border-radius: 999px;
  border: 1px solid #d8c3b2;
  background: #fffaf5;
  color: #3a2f28;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 14px;
  cursor: pointer;
  box-shadow: none;
}

.explore-filter:hover {
  background: #f4e9dd;
  box-shadow: none;
  transform: none;
}

.explore-filter.is-active {
  background: #1f1f1f;
  color: #f8f2ec;
  border-color: #1f1f1f;
}

body[data-page="shelves"] #gallery-title {
  margin-top: 16px;
}

.profile-summary {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 20px;
  align-items: center;
  margin-bottom: 32px;
}

.profile-summary-avatar img {
  width: 100%;
  max-height: 54vh;
  border-radius: 14px;
  object-fit: cover;
  object-position: center;
  border: 1px solid rgba(20, 20, 20, 0.12);
  background: #f3ece5;
}

.profile-summary-main h3 {
  margin: 0 0 8px;
  font-family: var(--shelf-font);
  font-size: 1.6rem;
}

.profile-summary-main p {
  margin: 0 0 16px;
  color: #6a5c52;
}

.profile-summary-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, 1fr));
  gap: 16px;
}

.profile-stat {
  display: grid;
  gap: 4px;
}

.profile-stat-value {
  font-size: 1.2rem;
  font-weight: 600;
}

.profile-stat-label {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a7568;
}

.about-panel {
  max-width: 960px;
  margin: 0 auto 48px;
}

.about-panel h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.about-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 16px;
}

.about-block p {
  margin: 0 0 10px;
  color: #5b4a3f;
}

.about-list {
  margin: 0;
  padding-left: 18px;
  color: #5b4a3f;
  line-height: 1.6;
}

.about-callout {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid #e6d7cb;
  background: #f7efe6;
}

.about-callout p {
  margin: 0;
  color: #4a3b33;
}

.about-panel[aria-hidden="true"] {
  display: none;
}

.profile-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.profile-actions button {
  background: #f0ebe6;
  color: #2f2f2f;
  border: 1px solid rgba(20, 20, 20, 0.16);
  padding: 8px 12px;
  box-shadow: none;
}

.profile-actions button:hover {
  box-shadow: none;
  transform: none;
}

.profile-lightbox-content button {
  box-shadow: none;
}

.profile-lightbox-content button:hover {
  box-shadow: none;
  transform: none;
}

.profile-meta h2 {
  margin: 0;
}

.profile-meta .hint {
  text-align: right;
}

.profile-nickname-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.profile-nickname-link:hover {
  text-decoration: underline;
}

.profile-lightbox-content {
  gap: 16px;
  max-height: 65vh;
  overflow-y: auto;
  padding-right: 18px;
}

.profile-lightbox-content--readonly {
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.profile-avatar-wrap {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  border: 2px dashed rgba(20, 20, 20, 0.25);
  background: #f3ece5;
  padding: 12px;
  width: 100%;
  margin: 0;
}

.profile-lightbox-content--readonly .profile-avatar-wrap {
  border: none;
  cursor: default;
  background: transparent;
  padding: 0;
}

.profile-lightbox-content .profile-avatar-image {
  width: 100%;
  max-height: 54vh;
  object-fit: contain;
  border-radius: 14px;
  display: block;
  transition: transform 0.2s ease;
}

.profile-avatar-wrap:hover .profile-avatar-image {
  transform: scale(1.02);
}

.profile-lightbox-content--readonly .profile-avatar-image {
  transition: none;
  max-height: 70vh;
}

.profile-lightbox-content--readonly .profile-avatar-wrap:hover .profile-avatar-image {
  transform: none;
}

.profile-public-form {
  width: 100%;
}

.profile-upload {
  position: absolute;
  right: 12px;
  bottom: 12px;
  background: #111111;
  color: #f8f2ec;
  border: 1px solid #111111;
  padding: 6px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

.shelf-grid {
  display: grid;
  gap: 40px;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  overflow: visible;
}

body[data-page="explore"] .shelf-grid {
  gap: 64px;
}

.shelf {
  background: white;
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 18px 40px var(--shadow);
  contain: layout paint;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  min-width: 0;
}

.shelf--with-author {
  overflow: visible;
  contain: none;
}

.shelf-skeleton {
  position: relative;
}

.shelf:not(.is-collapsed):hover {
  box-shadow: 0 22px 50px rgba(20, 20, 20, 0.16);
  transform: scale(1.01);
}

.shelf:not(.is-collapsed) {
  cursor: pointer;
}

.shelf--add {
  background: #f2f2f2;
  border: 2px dashed #c7c7c7;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.shelf-add {
  display: grid;
  gap: 16px;
  place-items: center;
  text-align: center;
  min-height: 220px;
}

.shelf-add p {
  margin: 0;
  color: #7b7b7b;
}

.shelf--add:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 44px rgba(20, 20, 20, 0.18);
}

.shelf-add-icon {
  width: 84px;
  height: 84px;
}

.shelf-add-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: #b0b0b0;
  stroke-width: 3;
}

.shelf-add-text h3 {
  margin: 0 0 6px;
  color: #606060;
}

.shelf-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}

.shelf-title {
  display: grid;
  gap: 4px;
}

.shelf-title-row {
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
}

.shelf-title h3 {
  font-family: var(--shelf-font);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.shelf-title .shelf-meta {
  font-size: 0.45rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a7568;
}

.shelf-author {
  font-size: 1.6rem;
  letter-spacing: 0.02em;
  color: #141414;
  text-transform: none;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.shelf-author-card {
  position: absolute;
  left: -170px;
  top: 16px;
  width: 140px;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.shelf-author-card .shelf-author {
  pointer-events: auto;
}

.shelf-author-name {
  text-align: center;
  pointer-events: auto;
}

button.shelf-author {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
}

.shelf-author:hover {
  text-decoration: underline;
  box-shadow: none;
  transform: none;
  background: transparent;
}

.shelf-author-avatar {
  width: 110px;
  height: 110px;
  border-radius: 20px;
  object-fit: cover;
  border: 1px solid rgba(20, 20, 20, 0.1);
  background: #f3ece5;
}

.shelf-author-avatar--large {
  width: 117px;
  height: 117px;
}

.shelf-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}


.shelf-upload-btn {
  border-radius: 999px;
  border: 1px solid #1f1f1f;
  background: #1f1f1f;
  color: #f8f2ec;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  box-shadow: none;
}

.shelf-upload-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shelf-upload-btn:hover {
  background: #111111;
  border-color: #111111;
  transform: none;
  box-shadow: none;
}

.shelf-share-btn {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid #cdb8a6;
  background: white;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  color: #8a7568;
  text-decoration: none;
  position: relative;
}

.shelf-share-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.shelf-share-btn:hover {
  background: #f4e9dd;
  color: #5f4b3f;
  box-shadow: none;
  transform: none;
}

.shelf-share-btn:focus {
  outline: 2px solid rgba(31, 31, 31, 0.2);
  outline-offset: 2px;
}

.shelf-share-btn.is-copied::after {
  content: "Copied";
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: #1f1f1f;
  color: #f8f2ec;
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
}

.shelf-settings-btn {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid #cdb8a6;
  background: white;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.shelf-settings-btn svg {
  width: 16px;
  height: 16px;
  stroke: #8a8a8a;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.shelf-settings-btn:hover {
  background: #f4e9dd;
  box-shadow: none;
  transform: none;
}

.shelf.is-collapsed .photo-rail {
  display: none;
}

.shelf-preview {
  display: none;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  align-items: center;
  margin-top: 12px;
}

.shelf.is-collapsed .shelf-preview {
  display: grid;
}

.shelf-preview img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 10px;
}


.shelf-preview-empty {
  color: #7a5d4b;
  font-size: 0.9rem;
}

.shelf.is-collapsed {
  padding-bottom: 12px;
}

.shelf.is-collapsed {
  cursor: pointer;
  min-height: 220px;
}

.shelf.is-collapsed:hover {
  box-shadow: 0 22px 48px rgba(20, 20, 20, 0.18);
  transform: scale(1.01);
}


.photo-rail {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  grid-auto-flow: dense;
}

.shelf-skeleton {
  opacity: 0.9;
  pointer-events: none;
}

.shelf-skeleton .shelf-preview {
  background: transparent;
  padding: 0;
}

.shelf-skeleton .shelf-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.skeleton-line {
  border-radius: 999px;
  background: #ede6df;
  position: relative;
  overflow: hidden;
}

.skeleton-line::after,
.skeleton-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.5) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: shimmer 1.6s ease-in-out infinite;
}

.skeleton-line--title {
  width: 160px;
  height: 18px;
}

.skeleton-line--author {
  width: 100px;
  height: 16px;
}

.skeleton-line--meta {
  width: 80px;
  height: 10px;
  margin-top: 10px;
}

.skeleton-photo {
  position: relative;
  display: block;
  border-radius: 14px;
  background: #e7ded6;
  padding-top: 75%;
  overflow: hidden;
}

.skeleton-avatar {
  width: 130px;
  height: 130px;
  border-radius: 20px;
  background: #e7ded6;
  position: relative;
  overflow: hidden;
}

.skeleton-avatar::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.5) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: shimmer 1.6s ease-in-out infinite;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

.photo {
  background: #f4f0ea;
  border-radius: 14px;
  overflow: hidden;
  display: grid;
  margin-bottom: 0;
  box-shadow: 0 10px 26px rgba(20, 20, 20, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  transform: translateY(0) rotate(0deg);
  position: relative;
  cursor: pointer;
  will-change: transform;
}

.photo img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  height: auto;
  display: block;
}

.photo--landscape img {
  aspect-ratio: 4 / 3;
}

.photo--landscape {
  grid-column: span 2;
}

.photo-meta {
  display: grid;
  gap: 4px;
  padding: 10px 12px 14px;
  font-size: 0.85rem;
  background: white;
}

.photo-author {
  font-size: 0.78rem;
  color: #6a5c52;
}

.photo-meta time {
  color: #7a5d4b;
}

.empty {
  color: #7a5d4b;
  font-style: italic;
}

.photo--tilt-left {
  transform: translateY(2px) rotate(-1.2deg);
}

.photo--tilt-right {
  transform: translateY(-2px) rotate(1.1deg);
}

.photo--lift {
  box-shadow: 0 18px 36px rgba(20, 20, 20, 0.18);
}

.photo--frame img {
  outline: 6px solid #f7efe6;
  outline-offset: -12px;
}

.photo-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(20, 20, 20, 0) 20%,
    rgba(20, 20, 20, 0.55) 100%
  );
  display: grid;
  align-items: end;
  padding: 16px;
  color: white;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.photo:hover .photo-overlay {
  opacity: 1;
}

.photo--readonly .photo-overlay {
  display: none;
}

.photo--add {
  background: #f1f1f1;
  border: 2px dashed #c7c7c7;
  cursor: pointer;
  padding: 16px;
  min-height: 180px;
  display: grid;
  place-items: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.photo--add::after {
  content: "Add photo";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 18px;
  color: #9a9a9a;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
}


.photo-add-icon {
  width: 88px;
  height: 88px;
}

.photo-add-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: #b5b5b5;
  stroke-width: 3;
  transition: stroke 0.2s ease, transform 0.2s ease;
}

.photo--add:hover {
  transform: translateY(-3px);
  border-color: #9a9a9a;
  box-shadow: 0 18px 36px rgba(20, 20, 20, 0.18);
}

.photo--add:hover .photo-add-icon svg {
  stroke: #8d8d8d;
  transform: scale(1.05);
}

.photo--add:hover::after {
  color: #7d7d7d;
}

.photo--selected {
  outline: 3px solid #2f2f2f;
  outline-offset: 4px;
  box-shadow: 0 18px 40px rgba(20, 20, 20, 0.22);
}

.photo--selected .photo-overlay {
  opacity: 1;
  background: linear-gradient(
    180deg,
    rgba(20, 20, 20, 0.08) 0%,
    rgba(20, 20, 20, 0.65) 100%
  );
}

.photo--hover {
  outline: 3px solid #6f5b4f;
  outline-offset: 4px;
  box-shadow: 0 16px 32px rgba(20, 20, 20, 0.22);
}

.lightbox {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 50;
  place-items: center;
}

.lightbox.is-open {
  display: grid;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 12, 10, 0.78);
  backdrop-filter: blur(6px);
}

.lightbox-content {
  position: relative;
  z-index: 1;
  margin: auto;
  justify-self: center;
  align-self: center;
  max-width: min(90vw, 1200px);
  max-height: 90vh;
  display: grid;
  gap: 12px;
  padding: 24px;
  border-radius: 18px;
  background: #fbf6ef;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  overflow-y: auto;
}

#lightbox-image {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 12px;
  cursor: zoom-in;
  transition: transform 0.2s ease;
  position: relative;
  z-index: 0;
}

.lightbox.is-zoomed .lightbox-content {
  overflow: auto;
}

.lightbox.is-zoomed #lightbox-image {
  transform: scale(var(--lightbox-zoom, 1));
  transform-origin: var(--zoom-origin-x, 50%) var(--zoom-origin-y, 50%);
  cursor: zoom-out;
}

.lightbox-title {
  margin: 0;
}

.lightbox-meta {
  display: grid;
  gap: 6px;
}

.lightbox-meta,
.comment-panel {
  width: min(100%, var(--lightbox-media-width, 100%));
  justify-self: center;
}

.lightbox-description {
  margin: 0;
  color: #7a5d4b;
  font-size: 0.9rem;
  line-height: 1.5;
}

.lightbox-edit {
  display: none;
  gap: 10px;
}

.lightbox-edit.is-active {
  display: grid;
}

.lightbox-edit-field {
  display: grid;
  gap: 6px;
  color: #5b463b;
  font-size: 0.85rem;
}

.lightbox-edit-field input,
.lightbox-edit-field textarea {
  border-radius: 12px;
  border: 1px solid #d8c7bb;
  background: #fbf6ef;
  padding: 10px 12px;
  font: inherit;
  color: #2f241e;
}

.lightbox-edit-field textarea {
  resize: none;
}

.lightbox-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.lightbox-edit-actions button {
  border-radius: 10px;
  padding: 6px 12px;
  border: 1px solid #cdb8a6;
  background: white;
  color: #3a2f28;
  cursor: pointer;
  font-weight: 600;
}

.lightbox-edit-actions button[type="submit"] {
  background: #111111;
  color: #f8f2ec;
  border-color: #111111;
}

.comment-panel {
  display: grid;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid #e6d7cb;
}

.comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.comment-header h4 {
  margin: 0;
  font-size: 1rem;
}

.comment-count {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8a7568;
}

.comment-list {
  display: grid;
  gap: 12px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 6px;
}

.comment-item {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  align-items: start;
}

.comment-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
  object-position: center;
  max-width: none;
  max-height: none;
  border: 1px solid rgba(20, 20, 20, 0.12);
  background: #f3ece5;
  display: block;
  cursor: default;
}

.comment-body {
  display: grid;
  gap: 4px;
}

.comment-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.comment-author {
  font-weight: 600;
}

.comment-time {
  font-size: 0.75rem;
  color: #8a7568;
}

.comment-text {
  margin: 0;
  line-height: 1.5;
  color: #3a2f28;
  white-space: pre-wrap;
}

.comment-empty {
  margin: 0;
  font-size: 0.85rem;
  color: #8a7568;
}

.comment-form {
  display: grid;
  gap: 8px;
}

.comment-form textarea {
  min-height: 80px;
  resize: none;
}

.comment-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.comment-hint {
  font-size: 0.75rem;
  color: #8a7568;
}

.comment-form button {
  background: #111111;
  color: #f8f2ec;
  border: 1px solid #111111;
}

.comment-form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.comment-login {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  background: #f3ece5;
  border: 1px solid rgba(20, 20, 20, 0.08);
}

.comment-login p {
  margin: 0;
}

.comment-login button {
  align-self: start;
  background: #1f1f1f;
  color: #f8f2ec;
  border: none;
}

.comment-item--skeleton .comment-body {
  gap: 8px;
}

.comment-skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #e7ded6;
  position: relative;
  overflow: hidden;
}

.comment-skeleton-avatar::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.5) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: shimmer 1.6s ease-in-out infinite;
}

.comment-skeleton-line {
  width: 160px;
  height: 10px;
}

.comment-skeleton-line--short {
  width: 90px;
}

.comment-skeleton-line--body {
  width: 220px;
  height: 12px;
  border-radius: 8px;
}

.lightbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e6d7cb;
}

.lightbox-close,
.lightbox-settings {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(20, 20, 20, 0.14);
  background: #fffaf5;
  color: #3a2f28;
  cursor: pointer;
  font-weight: 600;
  box-shadow: none;
}

.lightbox-close svg,
.lightbox-settings svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lightbox-close:hover,
.lightbox-settings:hover {
  transform: none;
  box-shadow: none;
  background: #ffffff;
}

.lightbox-menu-wrap {
  position: relative;
}

.lightbox-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(320px, 90vw);
  display: grid;
  gap: 6px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 250, 245, 0.92);
  border: 1px solid rgba(20, 20, 20, 0.12);
  box-shadow: 0 16px 30px rgba(20, 20, 20, 0.18);
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10;
}

.lightbox-menu.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.lightbox-action {
  background: transparent;
  color: #3a2f28;
  border: none;
  padding: 6px 4px;
  border-radius: 0;
  cursor: pointer;
  font-weight: 600;
  text-align: left;
  width: 100%;
}

.lightbox-action:hover {
  text-decoration: underline;
}

.lightbox-delete {
  background: transparent;
  color: #8b1f1f;
  border: none;
  padding: 6px 4px;
  border-radius: 0;
  cursor: pointer;
  font-weight: 600;
  text-align: left;
  width: 100%;
}

.lightbox-delete:hover {
  background: transparent;
  color: #7a1515;
  text-decoration: underline;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 60;
  place-items: center;
}

.modal.is-open {
  display: grid;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(245, 245, 245, 0.85);
  backdrop-filter: blur(3px);
}

.modal-content {
  position: relative;
  z-index: 1;
  margin: auto;
  justify-self: center;
  align-self: center;
  width: min(92vw, 900px);
  max-width: 900px;
  display: grid;
  gap: 16px;
  padding: 24px;
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
  max-height: 85vh;
  overflow-y: auto;
}

#upload-modal .modal-content {
  width: auto;
  max-width: 90vw;
}

#upload-modal form {
  width: auto;
  justify-items: center;
}

#upload-form {
  gap: 12px;
}

#upload-form .upload-fields {
  width: min(520px, 90vw);
  display: grid;
  gap: 10px;
  justify-items: stretch;
}

#upload-form .upload-field {
  gap: 4px;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a7568;
}

#upload-form input,
#upload-form textarea {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.9rem;
}

#upload-form textarea {
  min-height: 90px;
  line-height: 1.4;
}

#upload-form .upload-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

#upload-form .upload-actions .hint {
  margin: 0;
}

.upload-preview {
  border-radius: 18px;
  background: transparent;
  border: none;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: pointer;
  width: auto;
}

.upload-preview img {
  width: auto;
  max-width: 80vw;
  max-height: 60vh;
  object-fit: contain;
  display: none;
  background: #fbf6ef;
}

.upload-preview.is-active img {
  display: block;
}

.upload-preview-placeholder {
  color: #8a7568;
  font-size: 0.9rem;
}

.upload-preview.is-active .upload-preview-placeholder {
  display: none;
}

.upload-progress {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: rgba(251, 246, 239, 0.96);
  border: 1px solid rgba(20, 20, 20, 0.12);
  border-radius: 14px;
  padding: 12px 14px;
  min-width: 220px;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.upload-progress.is-active {
  opacity: 1;
  transform: translateY(0);
}

.upload-progress-label {
  font-size: 0.9rem;
  color: #3a2f28;
  margin-bottom: 6px;
}

.upload-progress-bar {
  width: 100%;
  height: 6px;
  background: #e6dbd0;
  border-radius: 999px;
  overflow: hidden;
}

.upload-progress-fill {
  height: 100%;
  width: 0%;
  background: #111111;
  border-radius: 999px;
  transition: width 0.15s ease;
}

.modal-content h3 {
  margin: 0;
}

.modal-close {
  justify-self: end;
  background: transparent;
  color: #3a2f28;
  border: 1px solid #cdb8a6;
  padding: 6px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

#profile-private-form button,
#profile-password-form button {
  background: #111111;
  color: #f8f2ec;
  border: 1px solid #111111;
}

.shelf-settings-preview {
  display: grid;
  gap: 10px;
}

.shelf-settings-save {
  background: #1f1f1f;
  color: #f8f2ec;
  border: 1px solid #1f1f1f;
}

.shelf-create-btn {
  background: #1f1f1f;
  color: #f8f2ec;
  border: 1px solid #1f1f1f;
}

.shelf-settings-visibility {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #e2d3c6;
  background: #fff8f1;
}

.shelf-settings-visibility-text {
  display: grid;
  gap: 4px;
}

.shelf-settings-label {
  margin: 0;
  font-weight: 600;
  color: #2b1f18;
}

.shelf-settings-visibility .hint {
  margin: 0;
}

.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 600;
  color: #2b1f18;
}

.toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: #d9c9bc;
  box-shadow: inset 0 0 0 1px rgba(20, 20, 20, 0.12);
  position: relative;
  transition: background 0.2s ease;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 3px 8px rgba(20, 20, 20, 0.2);
  transition: transform 0.2s ease;
}

.toggle input:checked + .toggle-track {
  background: #2f2f2f;
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(18px);
}

.toggle input:focus-visible + .toggle-track {
  outline: 2px solid #2f2f2f;
  outline-offset: 2px;
}

.shelf-settings-preview p {
  margin: 0;
  font-size: 0.9rem;
  color: #7a5d4b;
}

.shelf-settings-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  align-items: start;
}

.shelf-settings-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid transparent;
}

.shelf-settings-item input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.shelf-settings-item img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  display: block;
}

.shelf-settings-order {
  position: absolute;
  top: 8px;
  left: 8px;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #1a1a1a;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid rgba(20, 20, 20, 0.15);
  box-shadow: 0 6px 14px rgba(20, 20, 20, 0.18);
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 2;
  pointer-events: none;
}

.shelf-settings-item.selected .shelf-settings-order {
  opacity: 1;
}

.shelf-settings-focus {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  opacity: 0;
  pointer-events: none;
}

.shelf-settings-item.selected .shelf-settings-focus {
  opacity: 1;
  pointer-events: auto;
}

.shelf-settings-focus button {
  background: rgba(20, 20, 20, 0.7);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 4px 0;
  font-size: 0.7rem;
  cursor: pointer;
}

.shelf-settings-focus button.active {
  background: #1f1f1f;
}

.shelf-settings-item.selected {
  border-color: #2f2f2f;
  box-shadow: 0 10px 26px rgba(20, 20, 20, 0.22);
}

.footer {
  max-width: 960px;
  margin: 48px auto 0;
  font-size: 0.85rem;
  color: #7a5d4b;
}

@media (max-width: 1024px) and (min-width: 721px) {
  body {
    padding: 32px 18px 64px;
  }

  .top-nav {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px;
  }

  .top-nav-links {
    flex-wrap: wrap;
    gap: 12px;
  }

  .top-nav-actions {
    flex-wrap: wrap;
    gap: 10px;
  }

  .auth-avatar {
    width: 48px;
    height: 48px;
  }

  .hero {
    margin-bottom: 32px;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 20px;
  }

  .gallery-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .gallery-header-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .shelf-order-btn {
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }

  .profile-summary {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .profile-summary-avatar {
    max-width: 260px;
  }

  .profile-summary-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .shelf-grid {
    gap: 28px;
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .shelf {
    padding: 16px;
    display: grid;
    gap: 12px;
    width: 100%;
  }

  .shelf--with-author {
    overflow: hidden;
    contain: layout paint;
  }

  .shelf-header {
    margin-bottom: 0;
  }

  .shelf-title-row {
    gap: 16px;
  }

  .shelf-title h3 {
    font-size: 1.4rem;
  }

  .shelf-author-card {
    position: static;
    left: auto;
    top: auto;
    width: auto;
    margin-bottom: 10px;
    justify-content: flex-start;
    order: -1;
  }

  .shelf-author {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
  }

  .shelf-author-name {
    text-align: left;
  }

  .shelf-author-avatar,
  .shelf-author-avatar--large {
    width: 72px;
    height: 72px;
    border-radius: 16px;
  }

  .photo-rail {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
  }

  .shelf-preview {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
  }

  .photo-meta {
    font-size: 0.8rem;
  }

  .lightbox-content {
    max-width: 94vw;
    padding: 16px;
  }

  #lightbox-image {
    max-height: 55vh;
  }

  .comment-list {
    max-height: 220px;
  }

  .modal-content {
    padding: 18px;
  }

  #upload-form .upload-fields {
    width: min(440px, 90vw);
  }
}

@media (max-width: 720px) {
  body {
    padding: 24px 14px 56px;
  }

  .lightbox,
  .modal {
    padding: 12px;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    left: 0;
    right: 0;
    overflow-x: hidden;
  }

  .lightbox.is-open,
  .modal.is-open {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .top-nav {
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
  }

  .top-nav-links {
    gap: 10px;
  }

  .top-nav-actions {
    flex-wrap: wrap;
    align-items: center;
    font-size: 0.8rem;
    gap: 8px;
  }

  body.is-authenticated #auth-name {
    display: none;
  }

  .top-nav-links a {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(20, 20, 20, 0.12);
    background: rgba(255, 255, 255, 0.9);
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  }

  .top-nav-links a svg {
    display: block;
  }

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

  .top-nav-links a:hover {
    color: var(--accent-dark);
    background: #f7efe6;
    border-color: rgba(20, 20, 20, 0.2);
  }

  .top-nav-links a.is-active {
    color: #1f1f1f;
    background: #f1e6dc;
    border-color: #d6c2b2;
    font-weight: 600;
  }

  .auth-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 12px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(20, 20, 20, 0.12);
    background: rgba(255, 255, 255, 0.9);
    color: #5c5c5c;
  }

  .auth-icon svg {
    width: 18px;
    height: 18px;
    display: block;
  }

  .auth-icon.auth-action--primary {
    background: #1f1f1f;
    color: #f8f2ec;
    border-color: #1f1f1f;
  }

  .auth-icon:hover {
    transform: none;
    box-shadow: none;
    color: var(--accent-dark);
    background: #f7efe6;
    border-color: rgba(20, 20, 20, 0.2);
  }

  .auth-icon.auth-action--primary:hover {
    background: #111111;
    color: #f8f2ec;
    border-color: #111111;
  }

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

  .auth-logout {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 12px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(20, 20, 20, 0.12);
    background: #1f1f1f;
    color: #f8f2ec;
    box-shadow: none;
  }

  .auth-logout svg {
    display: block;
  }

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

  .auth-avatar {
    width: 44px;
    height: 44px;
  }

  .auth-user {
    font-size: 1rem;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 18px;
  }

  .hero {
    text-align: left;
    margin-bottom: 24px;
  }

  .hero h1 {
    font-size: clamp(2.4rem, 10vw, 3.4rem);
  }

  .lead {
    font-size: 1rem;
  }

  .gallery-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  body[data-page="explore"] .gallery-header {
    margin-bottom: 20px;
  }

  .gallery,
  #shelves-section,
  #shelves,
  .shelf-grid {
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  .shelf-grid {
    justify-content: center;
    justify-items: stretch;
  }

  .shelf {
    max-width: 100%;
  }

  .profile-summary {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .profile-summary-avatar {
    max-width: 100%;
    width: 100%;
    justify-self: stretch;
  }

  .profile-summary-main h3 {
    font-size: 1.4rem;
  }

  .profile-summary-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shelf-grid {
    gap: 24px;
  }

  .shelf {
    padding: 16px;
    display: grid;
    gap: 12px;
    width: 100%;
  }

  .shelf.is-collapsed:hover,
  .shelf:not(.is-collapsed):hover {
    transform: none;
    box-shadow: 0 18px 40px var(--shadow);
  }

  .shelf-grid {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .shelf--with-author {
    overflow: hidden;
    contain: layout paint;
  }

  .shelf-author-card {
    position: static;
    left: auto;
    top: auto;
    width: auto;
    margin-bottom: 10px;
    justify-content: flex-start;
    order: -1;
  }

  .shelf-author {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
  }

  .shelf-author-name {
    text-align: left;
  }

  .shelf-author-avatar,
  .shelf-author-avatar--large {
    width: 64px;
    height: 64px;
    border-radius: 14px;
  }

  .shelf-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .shelf-actions {
    flex-wrap: wrap;
  }

  .shelf-upload-btn {
    font-size: 0.8rem;
    padding: 6px 10px;
  }

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

  .shelf-share-btn {
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }

  .photo-rail {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .photo--landscape {
    grid-column: span 1;
  }

  .shelf-preview {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
  }

  .shelf-preview img {
    height: 90px;
  }

  .lightbox-toolbar {
    flex-direction: row;
    align-items: center;
  }

  .lightbox-close,
  .lightbox-settings {
    justify-content: center;
    width: auto;
  }

  .lightbox-menu {
    width: min(320px, 90vw);
  }

  .lightbox-content {
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 24px);
    padding: 14px;
    border-radius: 16px;
    margin: 0;
  }

  .lightbox.is-zoomed .lightbox-content {
    overflow: auto;
  }

  #lightbox-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: none;
    margin: 0 auto;
    display: block;
  }

  .lightbox-meta {
    width: 100%;
    text-align: left;
  }

  .comment-panel {
    width: 100%;
  }

  .comment-list {
    max-height: 180px;
  }

  .comment-item {
    grid-template-columns: 32px 1fr;
  }

  .comment-avatar,
  .comment-skeleton-avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }

  .comment-form-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .modal-content {
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 24px);
    padding: 14px;
    border-radius: 16px;
    overflow-x: hidden;
    margin: 0;
  }

  .modal-content.auth-panel {
    width: 100%;
    max-width: 520px;
  }

  #upload-modal .modal-content {
    width: 100%;
    max-width: 100%;
  }

  #upload-form .upload-fields {
    width: min(360px, 100%);
  }

  .upload-preview img {
    max-width: 100%;
  }

  .profile-lightbox-content {
    max-height: 85vh;
    padding-right: 0;
  }

  .profile-lightbox-content textarea {
    min-height: 64px;
  }

  .shelf-settings-visibility {
    align-items: flex-start;
    flex-direction: column;
  }

  .toggle {
    align-self: flex-start;
  }

  .footer {
    margin-top: 32px;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }
}
