:root {
  color-scheme: light;
  --ink: #22332b;
  --muted: #5b6a60;
  --soft: #e1e4da;
  --canvas: #e8ebe3;
  --paper: #fbfcf7;
  --green: #203d30;
  --active: #deead5;
  --serif: Georgia, "Times New Roman", serif;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .43; }
button, input, textarea, select { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 2px solid #5d745e; outline-offset: 2px; }
input, select, textarea { min-width: 0; border: 1px solid #d3d8cc; border-radius: .55rem; padding: .66rem .75rem; width: 100%; background: #fff; }
input::placeholder, textarea::placeholder { color: #677267; }
label { display: grid; gap: .4rem; font-size: .89rem; font-weight: 600; }
select { cursor: pointer; }
textarea { resize: vertical; }
img[hidden] { display: none; }
.primary, .secondary, .text-button, .square { border-radius: .55rem; font-size: .88rem; font-weight: 650; min-height: 2.45rem; white-space: nowrap; }
.primary { color: white; background: var(--green); border: 1px solid var(--green); padding: .64rem 1.03rem; }
.primary:hover { background: #315741; }
.secondary { color: var(--green); background: var(--paper); border: 1px solid #c5cec0; padding: .57rem .85rem; text-align: center; }
.secondary:hover, .square:hover { background: #e7efdf; }
.text-button { background: transparent; border: 0; padding: .42rem .35rem; color: #556459; }
.text-button:hover { color: #244232; background: #e7ece2; }
.square { min-width: 2.3rem; padding: .15rem; font-size: 1.2rem; border: 1px solid var(--soft); background: #fff; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.brand { display: flex; align-items: center; gap: .75rem; color: var(--green); font-size: 1.13rem; font-weight: 750; line-height: 1; }
.brand small { display: block; margin-top: .32rem; color: var(--muted); font-weight: 500; font-size: .78rem; }
.brand-mark { position: relative; display: block; width: 2.35rem; height: 2.35rem; border-radius: .6rem; background: var(--green); flex: none; }
.brand-mark::before, .brand-mark::after { position: absolute; content: ""; width: .87rem; height: .69rem; border: 1.5px solid #cfdca5; border-radius: .15rem; transform: rotate(-15deg); }
.brand-mark::before { top: .65rem; left: .63rem; }
.brand-mark::after { top: .93rem; left: .87rem; }
.topbar { display: grid; grid-template-columns: 11rem minmax(8rem, 1fr) auto; background: var(--paper); border-bottom: 1px solid var(--soft); gap: 1.1rem; align-items: center; padding: .9rem 1.35rem; }
.project-name { max-width: 29rem; }
.project-name input { font-weight: 650; border: 1px solid transparent; background: transparent; }
.project-name input:hover { border-color: var(--soft); }
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: .75rem; }
.save-state { font-size: .8rem; color: var(--muted); }
.workspace { display: grid; grid-template-columns: 11rem minmax(21rem, 1fr) minmax(17.5rem, 21rem); min-height: calc(100vh - 4.55rem); }
.slides-panel, .photo-panel { min-width: 0; background: var(--paper); padding: 1.2rem .9rem; }
.slides-panel { border-right: 1px solid var(--soft); }
.photo-panel { border-left: 1px solid var(--soft); }
.section-head { min-height: 2.15rem; display: flex; gap: .35rem; align-items: center; justify-content: space-between; }
.section-head h2 { margin: 0; font-size: 1rem; }
.slide-list { display: grid; gap: .56rem; margin-top: .9rem; max-height: min(60vh, 48rem); overflow: auto; padding: .16rem; }
.slide-list button { display: grid; grid-template-columns: 1rem 1fr; gap: .3rem; align-items: center; border-radius: .52rem; padding: .38rem .42rem; background: transparent; border: 1px solid transparent; text-align: left; }
.slide-list button.active { background: var(--active); border-color: #b8cdb0; }
.slide-index { font-size: .76rem; color: var(--muted); }
.thumb-slide { overflow: hidden; position: relative; width: 100%; aspect-ratio: 16 / 9; display: flex; padding: .48rem; border-radius: .2rem; color: var(--deck-ink); background: var(--deck-bg); border: 1px solid var(--deck-border); }
.thumb-slide span { z-index: 1; overflow: hidden; font-family: var(--serif); font-size: .57rem; font-weight: 700; line-height: 1.12; }
.thumb-slide img { align-self: stretch; width: 45%; margin-left: .22rem; object-fit: cover; }
.slide-actions { display: flex; gap: .24rem; justify-content: space-between; margin-top: .65rem; }

.stage { padding: 1.1rem clamp(1rem, 3vw, 3rem) 1.5rem; min-width: 0; }
.stage-header { max-width: 58rem; margin: 0 auto .85rem; display: flex; justify-content: space-between; align-items: center; gap: .8rem; color: #435747; font-size: .88rem; }
.stage select { padding: .46rem .71rem; }
.stage-center, .edit-fields { max-width: 58rem; margin: 0 auto; }
.deck-slide { container-type: inline-size; position: relative; overflow: hidden; aspect-ratio: 16/9; background: var(--deck-bg); color: var(--deck-ink); box-shadow: 0 6px 22px #23362b1e, 0 0 0 1px #31472b13; }
.theme-editorial { --deck-bg: #f4f1e9; --deck-ink: #152b23; --deck-accent: #b95c39; --deck-border: #d8d5c8; }
.theme-night { --deck-bg: #172d29; --deck-ink: #f6f2df; --deck-accent: #d6e690; --deck-border: #476459; }
.theme-clear { --deck-bg: #ecf2f5; --deck-ink: #122a47; --deck-accent: #305db6; --deck-border: #cad7e7; }
.slide-text { display: flex; flex-direction: column; position: absolute; inset: 11% 5.3% 11%; }
.has-photo .slide-text { right: 51%; }
.slide-accent { width: 6.2cqw; background: var(--deck-accent); height: .47cqw; margin: .3cqw 0 2.7cqw; }
#preview-title { font-family: var(--serif); font-size: 5.1cqw; line-height: 1.04; font-weight: 700; overflow-wrap: anywhere; }
.has-photo #preview-title { font-size: 4.65cqw; }
.long-title #preview-title { font-size: 3.6cqw; }
#preview-body { margin-top: 2.1cqw; font-size: 2.25cqw; line-height: 1.45; max-height: 52%; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; }
.long-body #preview-body { font-size: 1.55cqw; }
#preview-image { position: absolute; width: 42.1%; height: 80.6%; right: 5.25%; top: 9.3%; object-fit: cover; }
.slide-footer { display: flex; justify-content: space-between; position: absolute; bottom: 1.75%; right: 5.25%; left: 5.25%; padding-top: .6cqw; border-top: 1px solid var(--deck-border); font-size: 1.1cqw; }
.edit-fields { display: grid; gap: .7rem; margin-top: 1rem; border: 1px solid #d5dcd0; background: #f4f6ef; border-radius: .7rem; padding: .9rem; }
.edit-fields label { gap: .3rem; }
.edit-fields input, .edit-fields textarea { font-size: .95rem; font-weight: 400; padding: .53rem .65rem; }

.photo-panel { display: flex; flex-direction: column; gap: .75rem; }
.photo-panel .section-head { gap: .5rem; flex-wrap: wrap; }
.photo-panel .section-head button { font-size: .76rem; min-height: 2rem; }
.photo-tabs { display: grid; grid-template-columns: 1fr 1fr; border-radius: .6rem; padding: .22rem; background: #ecf0e7; }
.photo-tabs button { min-height: 2.1rem; border-radius: .44rem; border: 1px solid transparent; background: transparent; font-weight: 650; font-size: .9rem; }
.photo-tabs button[aria-pressed="true"] { background: white; border-color: var(--soft); color: var(--green); }
.photo-filters { display: grid; gap: .45rem; }
.photo-filters input, .photo-filters select { font-size: .9rem; }
.photo-grid { display: grid; grid-template-columns: 1fr 1fr; align-content: start; gap: .55rem; padding: .15rem; max-height: max(18rem, calc(100vh - 22rem)); overflow: auto; }
.photo-card { display: grid; justify-items: stretch; gap: .32rem; text-align: left; padding: .28rem; min-width: 0; border-radius: .5rem; border: 1px solid transparent; background: transparent; font-size: .78rem; }
.photo-card:hover { background: #f0f3ea; }
.photo-card[aria-pressed="true"] { border-color: #63845f; background: var(--active); }
.photo-card img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: .33rem; background: #e8ece2; }
.photo-card span { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.photo-empty { grid-column: 1 / -1; margin: .6rem 0; color: var(--muted); font-size: .86rem; line-height: 1.5; }
.photo-toolbox { display: grid; gap: .6rem; border-top: 1px solid var(--soft); padding-top: .45rem; }
#status { margin: 0; color: #49634b; line-height: 1.3; font-size: .84rem; }
#status:empty { display: none; }
.upload-control { display: block; cursor: pointer; }
.add-to-library { font-size: .87rem; }
.add-to-library label { margin-top: .6rem; }
summary { cursor: pointer; font-weight: 650; }

.login-page { display: grid; min-height: 100vh; place-items: center; padding: 1.5rem; }
.login-layout { display: grid; grid-template-columns: 1.1fr 1fr; width: min(57rem, 100%); background: var(--paper); border-radius: 1.1rem; overflow: hidden; box-shadow: 0 14px 50px #30402c1b; }
.login-intro { background: #203d30; color: #f6f2df; padding: clamp(1.6rem,4vw,3.25rem); min-height: 21rem; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 1.4rem; }
.login-intro .brand-mark { border: 1px solid #738772; }
.login-intro h1 { font-family: var(--serif); margin: 0; font-size: clamp(2.9rem, 7vw, 5.3rem); font-weight: 700; line-height: .97; }
.login-intro p { margin: 0; }
.login-brand { color: #dbe7b8; margin-bottom: .6rem !important; }
.login-form { padding: clamp(1.6rem,4vw,3.25rem); }
.login-form h2 { margin: 0 0 1.4rem; font-family: var(--serif); font-size: 1.9rem; }
.login-form form, .login-form details[open] { display: grid; gap: .9rem; }
.login-form details[open] label { margin: .65rem 0; }
.error { color: #994034; }

@media (max-width: 1080px) {
  .workspace { grid-template-columns: 9rem minmax(17rem,1fr) 17.3rem; }
  .topbar { grid-template-columns: 9rem minmax(6rem,1fr) auto; }
  .stage { padding-inline: 1rem; }
}
@media (max-width: 840px) {
  .workspace { grid-template-columns: 7rem minmax(0,1fr); }
  .photo-panel { grid-column: 1 / -1; border-top: 1px solid var(--soft); }
  .photo-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); max-height: 28rem; }
  .photo-filters { grid-template-columns: 1fr 1fr; }
  .slides-panel { padding-inline: .55rem; }
  .slide-actions { flex-wrap: wrap; justify-content: flex-start; }
}
@media (max-width: 550px) {
  .topbar { grid-template-columns: 1fr auto; gap: .4rem; padding: .6rem .7rem; }
  .project-name { grid-column: 1 / -1; grid-row: 2; max-width: none; }
  .top-actions { gap: .36rem; }
  .save-state { display: none; }
  .workspace { grid-template-columns: minmax(0,1fr); }
  .slides-panel { border-bottom: 1px solid var(--soft); padding: .65rem .9rem; }
  .slide-list { display: flex; gap: .35rem; max-height: none; margin-top: .3rem; }
  .slide-list button { flex: 0 0 6rem; }
  .slide-actions { margin-top: .2rem; }
  .stage { padding: .75rem; }
  .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .login-layout { grid-template-columns: 1fr; }
  .login-intro { min-height: 13rem; }
}
