:root {
  --navy: #15343c;
  --navy-deep: #102a31;
  --cream: #eee7d8;
  --paper: #f8f4eb;
  --rust: #b95636;
  --ink: #252a29;
  --muted: #626966;
  --line: #b7ae9d;
  --green: #2f6b50;
  --red: #a33d30;
  --font: "Barlow", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 92px; }
body { margin: 0; background: #f1ede4; color: var(--ink); font-family: var(--font); line-height: 1.5; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.skip-link { position: fixed; left: 14px; top: 10px; z-index: 100; padding: 9px 13px; background: white; border: 2px solid var(--navy); transform: translateY(-160%); }
.skip-link:focus { transform: none; }
.eyebrow { margin: 0 0 9px; color: var(--rust); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }

.admin-header { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 30px; position: sticky; top: 0; z-index: 30; background: rgba(248,244,235,.98); border-bottom: 1px solid var(--line); }
.admin-brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.admin-brand > span { width: 42px; height: 42px; display: grid; place-items: center; background: var(--navy); border-bottom: 4px solid var(--rust); color: white; font-weight: 800; }
.admin-brand strong { font-size: 15px; line-height: 1; }
.admin-brand small { display: block; margin-top: 5px; color: var(--rust); font-size: 9px; letter-spacing: .09em; text-transform: uppercase; }
.view-site { color: var(--navy); font-size: 12px; font-weight: 800; text-underline-offset: 4px; }

.login-panel { min-height: calc(100vh - 74px); display: grid; place-items: center; padding: 40px 20px; background: var(--cream); }
.login-card { width: min(100%, 460px); padding: 42px; background: var(--paper); border: 1px solid var(--navy); box-shadow: 0 24px 60px rgba(16,42,49,.13); }
.login-card h1 { margin: 0; font-size: clamp(2.7rem, 7vw, 4.3rem); letter-spacing: -.055em; line-height: .92; }
.login-card > p:not(.eyebrow) { margin: 20px 0 0; color: var(--muted); }
.login-card form { margin-top: 29px; }
.login-card label, .security-card label { display: grid; gap: 7px; font-size: 11px; font-weight: 700; }
.login-card label { margin-top: 14px; }
.login-card label:first-child { margin-top: 0; }
.login-card input, .security-card input { width: 100%; min-height: 50px; padding: 0 13px; border: 1px solid var(--line); background: white; outline: none; }
.login-card input:focus, .security-card input:focus, .field-control:focus { border-color: var(--rust); box-shadow: 0 0 0 3px rgba(185,86,54,.13); }
.login-card button, .security-card button, .save-bar button { min-height: 50px; padding: 0 22px; border: 1px solid var(--navy); background: var(--navy); color: white; font-weight: 800; }
.login-card button { width: 100%; margin-top: 14px; }
.form-message { min-height: 20px; margin: 12px 0 0; color: var(--red); font-size: 12px; }
.form-message.success { color: var(--green); }

.editor-shell { width: min(1460px, 100%); display: grid; grid-template-columns: 270px 1fr; margin: 0 auto; }
.editor-sidebar { min-height: calc(100vh - 74px); display: flex; flex-direction: column; padding: 38px 28px 110px; position: sticky; top: 74px; align-self: start; background: var(--navy); color: white; }
.editor-sidebar h2 { margin: 0; font-size: 26px; line-height: 1; }
.editor-sidebar > div > p:not(.eyebrow) { color: #bdc8c8; font-size: 12px; }
.editor-sidebar nav { display: grid; gap: 6px; margin-top: 25px; }
.editor-sidebar nav button { width: 100%; padding: 11px 12px; border: 1px solid rgba(255,255,255,.14); background: transparent; color: #d4dcdc; font-size: 12px; text-align: left; }
.editor-sidebar nav button:hover { border-color: rgba(255,255,255,.45); color: white; }
.editor-sidebar nav button.active { background: var(--paper); border-color: var(--paper); color: var(--navy-deep); font-weight: 800; }
.quiet-button { margin-top: auto; padding: 10px 0; border: 0; border-bottom: 1px solid rgba(255,255,255,.45); background: transparent; color: white; font-size: 12px; font-weight: 700; text-align: left; }

.editor-content { min-width: 0; padding: 54px clamp(24px, 5vw, 72px) 150px; }
.editor-intro { display: grid; grid-template-columns: 1fr 360px; gap: 45px; align-items: end; max-width: 980px; margin: 0 auto 32px; }
.editor-intro h1 { margin: 0; font-size: clamp(2.7rem, 5vw, 4.7rem); letter-spacing: -.055em; line-height: .92; }
.editor-intro > p { margin: 0; color: var(--muted); }
#field-groups { display: grid; gap: 25px; max-width: 980px; margin: 0 auto; }
.field-group { scroll-margin-top: 95px; background: var(--paper); border: 1px solid var(--line); box-shadow: 0 18px 50px rgba(16,42,49,.06); }
.group-heading { padding: 28px 30px 22px; border-bottom: 1px solid var(--line); }
.group-heading h2 { margin: 0; font-size: 27px; letter-spacing: -.025em; }
.group-heading p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 24px; padding: 28px 30px 34px; }
.field { display: grid; align-content: start; gap: 7px; }
.field.wide { grid-column: 1/-1; }
.field label { display: flex; justify-content: space-between; gap: 20px; font-size: 11px; font-weight: 800; }
.field label span { color: var(--muted); font-size: 9px; font-weight: 500; }
.field-control { width: 100%; min-height: 47px; padding: 10px 12px; border: 1px solid #c9c0b0; background: #fffefa; color: var(--ink); outline: none; resize: vertical; }
textarea.field-control { min-height: 92px; }
.field small { color: var(--muted); font-size: 10px; }
.panel-list { display: grid; grid-template-columns: 1fr; gap: 10px; background: #f0eadf; }
.field-panel { background: var(--paper); border: 1px solid var(--line); }
.field-panel summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 17px 19px; cursor: pointer; list-style: none; }
.field-panel summary::-webkit-details-marker { display: none; }
.field-panel summary::after { content: '+'; order: 3; color: var(--rust); font-size: 21px; line-height: 1; }
.field-panel[open] summary::after { content: '−'; }
.field-panel summary strong { font-size: 14px; }
.field-panel summary span { margin-left: auto; color: var(--muted); font-size: 10px; }
.panel-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 24px; padding: 4px 19px 23px; border-top: 1px solid #ddd4c5; }
.panel-fields .field { padding-top: 17px; }
.palette-field { padding-bottom: 4px; }
.palette-field > label { justify-content: flex-start; font-size: 12px; }
.palette-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.palette-option { min-width: 0; display: grid; grid-template-columns: 76px 1fr; gap: 14px; align-items: center; padding: 13px; border: 1px solid var(--line); background: white; color: var(--ink); text-align: left; }
.palette-option:hover { border-color: var(--navy); }
.palette-option:focus-visible { outline: 3px solid color-mix(in srgb, var(--rust) 28%, transparent); outline-offset: 2px; }
.palette-option.selected { border: 2px solid var(--rust); padding: 12px; box-shadow: 0 0 0 2px color-mix(in srgb, var(--rust) 14%, transparent); }
.palette-swatches { height: 56px; display: grid; grid-template-columns: repeat(4, 1fr); overflow: hidden; border: 1px solid rgba(0,0,0,.14); }
.palette-swatches i { display: block; }
.palette-copy { min-width: 0; display: grid; gap: 5px; }
.palette-copy strong { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; font-size: 14px; }
.palette-copy strong em { padding: 3px 6px; background: var(--rust); color: white; font-size: 8px; font-style: normal; letter-spacing: .06em; text-transform: uppercase; }
.palette-copy small { color: var(--muted); font-size: 10px; line-height: 1.35; }

.photo-field { padding-top: 23px; border-top: 1px solid var(--line); }
.photo-field > label { font-size: 15px; }
.photo-control { display: grid; grid-template-columns: minmax(220px, .8fr) 1.2fr; gap: 25px; align-items: start; padding: 16px; background: var(--cream); }
.photo-control > img { width: 100%; height: 235px; object-fit: cover; background: #d5cebf; }
.photo-control-copy { min-width: 0; display: grid; gap: 14px; padding: 7px 5px 5px 0; }
.photo-control-copy > p { margin: 0; color: var(--muted); font-size: 13px; }
.photo-control-copy > label { display: block; font-size: 11px; font-weight: 800; }
.photo-buttons { display: flex; flex-wrap: wrap; gap: 9px; }
.upload-button, .secondary-button { min-height: 43px; display: inline-flex; align-items: center; justify-content: center; padding: 0 16px; font-size: 12px; font-weight: 800; }
.field .upload-button { justify-content: center; background: var(--navy); color: white; cursor: pointer; }
.upload-button input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.upload-button.busy { pointer-events: none; cursor: wait; opacity: .65; }
.secondary-button { border: 1px solid var(--navy); background: transparent; color: var(--navy); }
.photo-status { min-height: 18px; margin: 0; color: var(--muted); font-size: 11px; }
.photo-status.success { color: var(--green); font-weight: 700; }
.photo-status.error { color: var(--red); font-weight: 700; }

.security-card { max-width: 980px; display: grid; grid-template-columns: .8fr 1.2fr; gap: 55px; margin: 25px auto 0; padding: 32px; scroll-margin-top: 95px; background: var(--cream); border: 1px solid var(--line); }
.security-card h2 { margin: 0; font-size: 28px; line-height: 1.05; }
.security-card > div > p:not(.eyebrow) { color: var(--muted); font-size: 12px; }
.security-card form { display: grid; gap: 13px; }
.security-card button { justify-self: start; }

.save-bar { min-height: 76px; display: flex; align-items: center; justify-content: flex-end; gap: 24px; padding: 12px max(24px, calc((100vw - 1460px) / 2 + 40px)); position: fixed; z-index: 40; right: 0; bottom: 0; left: 270px; background: rgba(248,244,235,.98); border-top: 1px solid var(--navy); box-shadow: 0 -8px 28px rgba(16,42,49,.08); }
.save-bar p { margin: 0; color: var(--muted); font-size: 12px; }
.save-bar p.dirty { color: var(--rust); font-weight: 700; }
.save-bar p.success { color: var(--green); font-weight: 700; }
.save-bar button:disabled { cursor: not-allowed; opacity: .55; }

@media (max-width: 900px) {
  .editor-shell { grid-template-columns: 1fr; }
  .editor-sidebar { min-height: 0; display: block; padding: 24px; position: static; }
  .editor-sidebar nav { grid-template-columns: repeat(3, 1fr); }
  .editor-sidebar nav button { min-height: 50px; }
  .quiet-button { margin-top: 20px; }
  .editor-intro { grid-template-columns: 1fr; gap: 16px; }
  .save-bar { left: 0; }
}

@media (max-width: 620px) {
  .admin-header { padding: 0 15px; }
  .admin-brand strong { display: none; }
  .login-card { padding: 30px 22px; }
  .editor-content { padding: 36px 15px 130px; }
  .editor-sidebar nav { grid-template-columns: 1fr 1fr; }
  .group-heading, .security-card { grid-template-columns: 1fr; gap: 12px; }
  .group-heading { padding: 22px 18px; }
  .fields { grid-template-columns: 1fr; }
  .fields { gap: 20px; padding: 22px 18px 28px; }
  .field, .field.wide { grid-column: 1; }
  .palette-options { grid-template-columns: 1fr; }
  .photo-control { grid-template-columns: 1fr; padding: 12px; }
  .panel-fields { grid-template-columns: 1fr; }
  .photo-control > img { height: 220px; }
  .photo-control-copy { padding: 2px; }
  .security-card { padding: 24px 18px; }
  .save-bar { align-items: stretch; flex-direction: column; gap: 7px; padding: 10px 15px; }
  .save-bar button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
