@charset "UTF-8";

:root {
  color-scheme: light;
  --ink: #172722;
  --muted: #687770;
  --line: #dce5df;
  --paper: #f3f6f1;
  --white: #fff;
  --forest: #164e40;
  --forest-dark: #103a30;
  --mint: #dff2e9;
  --amber: #9a5b11;
  --amber-pale: #fff2d8;
  --red: #9a3e35;
  --red-pale: #fff0ed;
  --shadow: 0 16px 44px rgba(24, 48, 39, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Aptos", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
:focus-visible { outline: 3px solid #d88434; outline-offset: 3px; }

.topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px max(24px, calc((100vw - 1180px) / 2));
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 19px;
  font-weight: 750;
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px 10px 10px 3px;
  background: var(--forest);
  color: #fff;
  font-family: Georgia, serif;
  font-size: 20px;
}

.topbar-caption, .site-footer { color: var(--muted); font-size: 13px; }
.page-shell { width: min(1180px, calc(100% - 40px)); margin: 42px auto 72px; }
.site-footer { width: min(1180px, calc(100% - 40px)); margin: -44px auto 28px; }

a, button { touch-action: manipulation; }

h1, h2, h3, h4, p { margin-top: 0; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; line-height: 1.15; }
h1 { margin-bottom: 10px; font-size: 34px; }
h2 { margin-bottom: 8px; font-size: 24px; }
h3 { margin-bottom: 6px; font-size: 17px; }
h4 { margin: 0 0 7px; font-size: 13px; }
.eyebrow { margin-bottom: 8px; color: var(--forest); font-size: 11px; font-weight: 800; letter-spacing: .11em; }
.lede { max-width: 650px; color: var(--muted); }

.dashboard-heading, .library-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}
.dashboard-heading { margin-bottom: 30px; }
.library-heading { align-items: end; margin: 34px 0 14px; }
.item-count { padding-bottom: 10px; color: var(--muted); font-size: 13px; }

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 9px 15px;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  transition: background-color .16s ease, border-color .16s ease;
}
.button-primary { background: var(--forest); color: #fff; }
.button-primary:hover { background: var(--forest-dark); }
.button-quiet { border-color: var(--line); background: #fff; color: var(--ink); }
.button-quiet:hover, .button-outline:hover { background: var(--mint); }
.button-outline { border-color: var(--line); background: #fff; color: var(--ink); }
.button-small { min-height: 34px; padding: 6px 10px; font-size: 13px; }
.button-share { background: var(--mint); color: var(--forest-dark); }
.button-share:hover { background: #cbe8da; }

.upload-strip {
  display: grid;
  grid-template-columns: minmax(230px, .8fr) minmax(300px, 1.2fr);
  gap: 28px;
  align-items: center;
  border-block: 1px solid var(--line);
  padding: 22px 0;
}
.upload-strip p:last-child { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.upload-form { display: grid; grid-template-columns: 1fr auto; gap: 9px 12px; align-items: end; }
.upload-form label { grid-column: 1 / -1; font-size: 13px; font-weight: 700; }
.upload-form input[type="file"] { min-width: 0; width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 5px; padding: 6px; background: #fff; }

.alert { margin: 0 0 24px; border: 1px solid; border-radius: 5px; padding: 14px 16px; }
.alert-success { border-color: #b5d9c5; background: #edf8f1; color: #20563c; }
.alert-error { border-color: #e7c0b8; background: var(--red-pale); color: #71372f; }
.alert ul { margin: 7px 0 0; padding-left: 20px; }
.share-created { display: grid; gap: 6px; margin-top: 12px; }
.share-created label { font-size: 13px; font-weight: 700; }
.share-created input { min-width: 0; width: 100%; border: 1px solid #b5d9c5; border-radius: 4px; padding: 9px; background: #fff; color: var(--ink); }

.media-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.media-item { min-width: 0; border: 1px solid var(--line); border-radius: 6px; padding: 16px; background: var(--white); box-shadow: 0 3px 14px rgba(24, 48, 39, .035); }
.media-item-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.media-type { color: var(--forest); font-size: 10px; font-weight: 800; letter-spacing: .1em; }
.media-size, .media-date { color: var(--muted); font-size: 12px; }
.media-item h3 { overflow-wrap: anywhere; }
.media-date { margin-bottom: 14px; }
.media-actions { display: flex; align-items: center; gap: 13px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.text-link { border: 0; padding: 0; background: transparent; color: var(--forest); cursor: pointer; font-size: 13px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.share-form { display: grid; gap: 6px; margin-top: 14px; }
.share-form label { font-size: 12px; font-weight: 700; }
.share-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
select, input:not([type="file"]) { min-height: 40px; border: 1px solid #cbd7cf; border-radius: 4px; padding: 8px 10px; background: #fff; color: var(--ink); }
.active-shares { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.active-share-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; color: var(--muted); font-size: 11px; }
.active-share-row form { flex: 0 0 auto; }
.text-danger { color: var(--red); }
.delete-form { margin-top: 14px; }
.data-note { margin-top: 28px; color: var(--muted); font-size: 12px; }

.empty-state { border-block: 1px solid var(--line); padding: 48px 18px; text-align: center; }
.empty-state p { max-width: 570px; margin: 0 auto; color: var(--muted); }
.empty-mark { width: 44px; height: 44px; display: grid; place-items: center; margin: 0 auto 14px; border-radius: 50%; background: var(--mint); color: var(--forest); font-size: 26px; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 22px; margin: 28px 0; color: var(--muted); font-size: 13px; }
.pagination a { color: var(--forest); font-weight: 700; text-decoration: none; }

.auth-panel { width: min(620px, 100%); margin: 28px auto; border: 1px solid var(--line); border-radius: 7px; padding: 28px; background: #fff; box-shadow: var(--shadow); }
.stack-form { display: grid; gap: 10px; }
.stack-form label { margin-top: 5px; font-size: 13px; font-weight: 700; }
.stack-form input { width: 100%; }
.stack-form fieldset { display: grid; gap: 9px; margin: 8px 0 12px; border: 1px solid var(--line); border-radius: 5px; padding: 16px; }
.stack-form legend { padding: 0 6px; color: var(--forest); font-size: 13px; font-weight: 800; }
.stack-form small { color: var(--muted); }
.stack-form .button { margin-top: 8px; }
.security-note { margin: 18px 0 0; border-left: 3px solid #d88434; padding-left: 12px; color: var(--muted); font-size: 12px; }

.viewer-heading { margin-bottom: 20px; }
.back-link { display: inline-block; margin-bottom: 22px; color: var(--forest); font-size: 13px; font-weight: 700; text-decoration: none; }
.viewer-frame { min-height: 300px; display: grid; place-items: center; overflow: hidden; border-radius: 6px; background: #172722; }
.viewer-image { display: block; max-width: 100%; max-height: 72vh; object-fit: contain; }
.viewer-video { display: block; width: 100%; max-height: 72vh; }
.viewer-actions { display: flex; align-items: center; gap: 16px; margin-top: 16px; color: var(--muted); font-size: 12px; }

@media (max-width: 850px) {
  .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .upload-strip { grid-template-columns: 1fr; gap: 16px; }
}

@media (max-width: 580px) {
  .topbar { padding-inline: 18px; }
  .topbar-caption { max-width: 120px; text-align: right; }
  .page-shell { width: calc(100% - 28px); margin-top: 26px; }
  .site-footer { width: calc(100% - 28px); }
  h1 { font-size: 29px; }
  .dashboard-heading { align-items: center; gap: 12px; }
  .dashboard-heading .lede { font-size: 13px; }
  .media-grid { grid-template-columns: 1fr; }
  .upload-form { grid-template-columns: 1fr; }
  .upload-form label { grid-column: auto; }
  .upload-form .button { width: 100%; }
  .auth-panel { padding: 20px; }
  .viewer-frame { min-height: 240px; }
  .viewer-actions { flex-wrap: wrap; }
}
