:root {
  --bg: #f4f5f2;
  --surface: #fff;
  --surface-2: #e8ece8;
  --ink: #172039;
  --muted: #687082;
  --line: #d8dcd7;
  --blue: #263e86;
  --blue-dark: #182d69;
  --coral: #e86f59;
  --danger: #b53d37;
  --focus: #1479d0;
  --shadow: 0 20px 48px rgba(20, 31, 51, 0.16);
  --font-display: Fraunces, Georgia, serif;
  --font-body: Manrope, Arial, sans-serif;
  --font-data: "DM Mono", monospace;
}
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
}
button,
input,
textarea {
  font: inherit;
}
button {
  color: inherit;
}
.skip-link {
  position: fixed;
  left: 16px;
  top: -60px;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
}
.skip-link:focus {
  top: 16px;
}
.app-header {
  height: 72px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 32px;
  background: rgba(244, 245, 242, 0.94);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
}
.brand {
  font: 600 23px/1 var(--font-display);
  letter-spacing: -1px;
  text-decoration: none;
  color: var(--ink);
}
.brand span {
  color: var(--coral);
}
.album-identity {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.album-identity strong {
  font-size: 12px;
}
.album-identity span {
  font: 400 9px var(--font-data);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.header-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}
.button,
.toolbar-button,
.text-control,
.icon-button,
.page-button,
.user-button {
  border: 0;
  background: none;
  cursor: pointer;
}
.button {
  min-height: 42px;
  border-radius: 9px;
  padding: 0 15px;
  font-weight: 700;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.button-primary {
  background: var(--coral);
  color: #fff;
  box-shadow: 0 2px 0 #b95041;
}
.button-primary:hover {
  background: #d9604e;
}
.button-primary:active {
  transform: translateY(1px);
  box-shadow: none;
}
.button-secondary {
  background: var(--ink);
  color: #fff;
}
.button-secondary:hover {
  background: #2a3551;
}
.button-quiet {
  border: 1px solid transparent;
}
.button-quiet:hover {
  background: #e8ebe7;
}
.user-button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font: 500 11px var(--font-data);
  margin-left: 4px;
}
.workspace {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 44px 0 56px;
}
.workspace-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin: 0 68px 28px;
}
.kicker {
  margin: 0 0 7px;
  color: var(--blue);
  font: 500 9px/1.4 var(--font-data);
  letter-spacing: 0.12em;
}
.workspace-heading h1 {
  margin: 0;
  font: 600 clamp(34px, 4vw, 49px) / 1 var(--font-display);
  letter-spacing: -2px;
}
.album-description {
  color: var(--muted);
  margin: 10px 0 0;
  line-height: 1.5;
}
.workspace-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}
.save-status {
  margin: 0;
  color: var(--muted);
  font: 400 9px var(--font-data);
  display: flex;
  align-items: center;
  gap: 7px;
}
.save-status span {
  width: 7px;
  height: 7px;
  background: #6ba98d;
  border-radius: 50%;
}
.save-status.saving span {
  background: #d49b4c;
}
.album-workspace {
  position: relative;
}
.album-toolbar {
  margin: 0 68px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
}
.view-label,
.arrange-hint,
.toolbar-button {
  font: 500 9px var(--font-data);
  letter-spacing: 0.08em;
  color: var(--muted);
}
.view-label strong {
  color: var(--ink);
  margin-left: 4px;
}
.arrange-hint {
  margin-left: 18px;
  border-left: 1px solid var(--line);
  padding-left: 18px;
  letter-spacing: 0;
}
.toolbar-button {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.binder-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.binder {
  width: min(1000px, calc(100% - 92px));
  aspect-ratio: 1.94/1;
  min-height: 480px;
  max-height: 530px;
  position: relative;
  padding: 22px 24px 22px 68px;
  border-radius: 12px 18px 18px 11px;
  background: linear-gradient(105deg, #304c9a, #263e86 46%, #203678);
  box-shadow:
    0 30px 50px rgba(23, 35, 62, 0.24),
    inset 0 0 0 1px rgba(255, 255, 255, 0.13);
  overflow: hidden;
}
.binder:after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.2;
  background: repeating-linear-gradient(
    104deg,
    transparent 0 5px,
    rgba(255, 255, 255, 0.055) 6px 7px
  );
}
.binder-spine {
  position: absolute;
  z-index: 2;
  inset: 0 auto 0 0;
  width: 48px;
  background: linear-gradient(
    90deg,
    #172b68,
    #3556a3 75%,
    rgba(255, 255, 255, 0.12)
  );
  box-shadow: inset -2px 0 rgba(10, 20, 54, 0.22);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 18px 0;
}
.binder-spine span {
  writing-mode: vertical-rl;
  color: #d4e0ec;
  font: 500 8px var(--font-data);
  letter-spacing: 0.15em;
  margin-bottom: 3px;
}
.binder-spine i {
  width: 7px;
  height: 21px;
  border-radius: 0 5px 5px 0;
  background: #c1c9ca;
  box-shadow: inset 1px 0 #f1f2ef;
}
.album-page {
  height: 100%;
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 17px 20px;
  padding: 17px 22px;
  background: #cbd5cf;
  border: 6px solid #e3e8e2;
  border-radius: 5px;
  box-shadow:
    inset 0 0 22px rgba(47, 72, 68, 0.18),
    0 8px 14px rgba(10, 22, 54, 0.2);
}
.pocket {
  position: relative;
  min-width: 0;
  padding: 7px;
  background: rgba(236, 242, 238, 0.28);
  border: 1px solid rgba(81, 104, 100, 0.25);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.42);
  cursor: grab;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease;
}
.pocket:hover {
  transform: translateY(-4px);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.42),
    0 9px 15px rgba(28, 46, 55, 0.2);
}
.pocket:active {
  cursor: grabbing;
}
.pocket.dragging {
  opacity: 0.35;
}
.pocket.drop-target {
  outline: 3px solid var(--coral);
  outline-offset: 2px;
}
.print {
  height: 100%;
  background: #fff;
  padding: 6px 6px 18px;
  box-shadow: 0 2px 5px rgba(23, 33, 42, 0.28);
  display: flex;
  flex-direction: column;
}
.print img {
  display: block;
  width: 100%;
  min-height: 0;
  flex: 1;
  object-fit: cover;
  background: #e5e7e3;
}
.print-footer {
  height: 18px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 5px;
  padding: 4px 2px 0;
}
.print-title {
  font: 500 7px var(--font-data);
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.print-date {
  font: 400 6px var(--font-data);
  color: #7a7e84;
  white-space: nowrap;
}
.empty-slot {
  border: 1px dashed rgba(69, 91, 87, 0.35);
  display: grid;
  place-items: center;
  color: #65726e;
  background: rgba(255, 255, 255, 0.13);
  min-height: 0;
}
.empty-slot button {
  border: 0;
  background: none;
  color: inherit;
  font: 500 9px var(--font-data);
  cursor: pointer;
  padding: 20px;
}
.primary-empty button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}
.primary-empty button strong {
  font: 600 12px var(--font-body);
  color: var(--ink);
}
.primary-empty button span {
  font: 400 8px/1.4 var(--font-data);
  color: var(--muted);
}
.page-button {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(28, 39, 52, 0.09);
}
.page-button:hover:not(:disabled) {
  border-color: #aeb5ae;
  transform: translateY(-1px);
}
.page-button:disabled,
.text-control:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}
.page-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin-top: 20px;
}
.text-control {
  font-weight: 700;
  font-size: 11px;
  min-height: 36px;
  padding: 0 8px;
}
.page-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}
.page-dots button {
  border: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  padding: 0;
  background: #a8aeaa;
  cursor: pointer;
}
.page-dots button.active {
  width: 23px;
  border-radius: 8px;
  background: var(--blue);
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 80;
  transform: translate(-50%, 20px);
  padding: 11px 15px;
  border-radius: 9px;
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
dialog {
  border: 0;
  padding: 0;
  color: var(--ink);
}
dialog::backdrop {
  background: rgba(12, 21, 43, 0.72);
  backdrop-filter: blur(5px);
}
.photo-dialog {
  width: min(960px, 94vw);
  max-width: none;
  border-radius: 14px;
  background: #edf0ec;
  box-shadow: var(--shadow);
  overflow: visible;
}
.dialog-topbar {
  height: 52px;
  padding: 0 18px 0 23px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  font: 400 9px var(--font-data);
  color: var(--muted);
}
.dialog-topbar > div {
  display: flex;
  gap: 6px;
}
.icon-button {
  min-width: 38px;
  min-height: 38px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}
.icon-button:hover {
  background: rgba(23, 32, 57, 0.07);
}
#closePhoto,
#closeEdit,
#closeShare {
  font-size: 22px;
  font-weight: 500;
}
.photo-dialog-body {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  min-height: 570px;
}
.photo-viewer {
  display: grid;
  place-items: center;
  padding: 38px;
  background: #dce3de;
}
.pulled-print {
  height: min(480px, 64vh);
  max-width: 100%;
  background: #fff;
  padding: 12px 12px 42px;
  box-shadow: 7px 10px 22px rgba(24, 35, 47, 0.2);
  transform: rotate(-0.7deg);
}
.pulled-print img {
  height: 100%;
  max-width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
  display: block;
}
.photo-story {
  padding: 54px 38px 38px;
  display: flex;
  flex-direction: column;
}
.photo-date {
  font: 500 9px var(--font-data);
  letter-spacing: 0.08em;
  color: var(--blue);
  text-transform: uppercase;
  margin: 0 0 13px;
}
.photo-story h2,
.form-heading h2,
.confirm-dialog h2 {
  font: 600 38px/1.05 var(--font-display);
  letter-spacing: -1.5px;
  margin: 0;
}
.photo-caption {
  font: 500 15px/1.7 var(--font-display);
  color: #475066;
  margin: 20px 0 32px;
}
.author-note {
  display: flex;
  gap: 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 20px 0;
}
.mini-avatar {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--blue);
  color: #fff;
  font: 500 9px var(--font-data);
}
.author-note strong {
  font-size: 11px;
}
.author-note p {
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
  margin: 5px 0 0;
}
.file-meta {
  margin: auto 0 0;
}
.file-meta div {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding: 10px 0;
  font: 400 9px var(--font-data);
}
.file-meta dt {
  color: var(--muted);
}
.file-meta dd {
  margin: 0;
  text-align: right;
}
.photo-step {
  position: absolute;
  top: 50%;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 18px rgba(10, 20, 40, 0.2);
  cursor: pointer;
}
.previous-photo {
  left: -58px;
}
.next-photo {
  right: -58px;
}
.form-dialog {
  width: min(600px, calc(100% - 32px));
  border-radius: 14px;
  padding: 30px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.form-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 26px;
}
.form-heading h2 {
  font-size: 30px;
}
.form-dialog form > label,
.form-dialog > label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
  font-size: 11px;
  font-weight: 700;
}
.form-dialog input,
.form-dialog textarea {
  width: 100%;
  border: 1px solid #cbd0ca;
  border-radius: 8px;
  background: #fbfcfa;
  padding: 11px 12px;
  color: var(--ink);
  outline: none;
  resize: vertical;
}
.form-dialog input:focus,
.form-dialog textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(20, 121, 208, 0.13);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-row label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
}
.form-actions {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 28px;
}
.form-actions > div {
  display: flex;
  gap: 8px;
}
.danger-button {
  color: var(--danger);
}
.danger-button:hover {
  background: #fff0ee;
}
.danger-filled {
  background: var(--danger);
  color: #fff;
}
.share-dialog {
  width: min(510px, calc(100% - 32px));
}
.dialog-copy {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}
.copy-row {
  display: flex;
}
.copy-row input {
  border-radius: 8px 0 0 8px;
}
.copy-row .button {
  border-radius: 0 8px 8px 0;
  white-space: nowrap;
}
.privacy-note {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding: 15px;
  border-radius: 9px;
  background: #eef3f0;
}
.privacy-note > span {
  color: #579077;
}
.privacy-note p {
  font-size: 11px;
  line-height: 1.5;
  margin: 0;
  color: var(--muted);
}
.privacy-note strong {
  color: var(--ink);
}
.confirm-dialog {
  width: min(400px, calc(100% - 32px));
  border-radius: 14px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.confirm-dialog h2 {
  font-size: 27px;
}
.confirm-dialog p {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}
.confirm-dialog > div {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}
.access-dialog {
  width: min(460px, calc(100% - 32px));
  border-radius: 16px;
  padding: 36px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.access-dialog::backdrop {
  background: rgba(12, 21, 43, 0.82);
}
.access-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  font: 600 17px var(--font-display);
}
.access-dialog h2 {
  margin: 24px 0 10px;
  font: 600 34px/1.05 var(--font-display);
  letter-spacing: -1.3px;
}
.access-dialog > p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}
.access-dialog form {
  margin-top: 26px;
}
.access-dialog label {
  display: block;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 700;
}
.access-row {
  display: flex;
  gap: 8px;
}
.access-row input {
  min-width: 0;
  flex: 1;
  border: 1px solid #cbd0ca;
  border-radius: 9px;
  padding: 11px 12px;
  outline: none;
}
.access-row input:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(20, 121, 208, 0.13);
}
.form-error {
  min-height: 18px;
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 11px;
}
.guest-mode .owner-only,
.guest-mode #addPhotos,
.guest-mode #shareButton,
.guest-mode .arrange-hint,
.guest-mode #syncStatus {
  display: none !important;
}
.guest-mode .pocket {
  cursor: pointer;
}
.guest-banner {
  position: fixed;
  left: 50%;
  top: 82px;
  z-index: 18;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px 9px 14px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 8px 24px rgba(17, 28, 51, 0.18);
  font-size: 11px;
}
.guest-banner button {
  border: 0;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 7px 10px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
@media (max-width: 800px) {
  .app-header {
    height: 64px;
    padding: 0 16px;
    grid-template-columns: 1fr auto;
  }
  .album-identity {
    display: none;
  }
  .header-actions .button-quiet {
    display: none;
  }
  .workspace {
    width: 100%;
    padding: 28px 0 40px;
  }
  .workspace-heading {
    margin: 0 18px 22px;
    align-items: flex-start;
  }
  .workspace-heading h1 {
    font-size: 38px;
  }
  .album-description {
    max-width: 240px;
  }
  .workspace-actions {
    flex-direction: column-reverse;
    align-items: flex-end;
  }
  .save-status {
    display: none;
  }
  .album-toolbar {
    margin: 0 18px 10px;
  }
  .arrange-hint {
    display: none;
  }
  .binder-wrap {
    gap: 0;
  }
  .binder {
    width: 100%;
    min-height: 0;
    max-height: none;
    aspect-ratio: auto;
    height: 610px;
    border-radius: 0;
    padding: 16px 12px 16px 52px;
  }
  .binder-spine {
    width: 39px;
    gap: 14px;
  }
  .binder-spine i {
    height: 17px;
  }
  .album-page {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
    border-width: 5px;
  }
  .page-button {
    display: none;
  }
  .print {
    padding: 5px 5px 15px;
  }
  .print-footer {
    height: 15px;
  }
  .print-date {
    display: none;
  }
  .page-nav {
    justify-content: space-between;
    padding: 0 14px;
  }
  .photo-dialog {
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
  }
  .photo-dialog-body {
    display: block;
    min-height: 0;
    height: calc(100vh - 52px);
    overflow: auto;
  }
  .photo-viewer {
    padding: 25px 22px;
  }
  .pulled-print {
    height: auto;
    width: min(80vw, 370px);
    padding: 9px 9px 30px;
  }
  .pulled-print img {
    width: 100%;
    height: auto;
  }
  .photo-story {
    padding: 30px 23px;
  }
  .photo-story h2 {
    font-size: 34px;
  }
  .file-meta {
    margin-top: 28px;
  }
  .photo-step {
    display: none;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .form-actions {
    align-items: flex-start;
  }
  .form-actions > div {
    flex-direction: column-reverse;
  }
  .form-actions .button {
    width: 100%;
  }
  .guest-banner {
    top: 73px;
    width: max-content;
    max-width: calc(100% - 24px);
  }
}
@media (max-width: 460px) {
  .access-dialog {
    padding: 28px 22px;
  }
  .access-row {
    flex-direction: column;
  }
  .brand {
    font-size: 20px;
  }
  .header-actions {
    gap: 4px;
  }
  .header-actions .button {
    padding: 0 11px;
  }
  .user-button {
    display: none;
  }
  .workspace-heading {
    display: block;
  }
  .workspace-actions {
    align-items: stretch;
    margin-top: 18px;
  }
  .workspace-actions .button {
    width: 100%;
  }
  .binder {
    height: 548px;
  }
  .form-dialog {
    padding: 23px;
  }
  .copy-row {
    display: block;
  }
  .copy-row input {
    border-radius: 8px 8px 0 0;
  }
  .copy-row .button {
    width: 100%;
    border-radius: 0 0 8px 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
