/* Direction: outlined reef working editor. Energy 2, rhythm 1, motion 1.
   Sand keeps long forms readable; coral marks primary actions; hard edges follow yymaxxing. */
:root { color-scheme: light; --reef-ink:#092124; --reef-teal:#102f32; --reef-sand:#f4f0d8; --reef-foam:#a9dac2; --reef-coral:#ff835f; }
* { box-sizing:border-box; }
html { scroll-padding-top:1rem; background:var(--reef-sand); }
body.reef-editor { margin:0; background:var(--reef-sand); color:var(--reef-ink); font-family:Archivo,Arial,sans-serif; font-size:1rem; line-height:1.55; overflow-x:visible; }
body.reef-editor::before { content:none; }
[hidden] { display:none !important; }
.reef-editor a { color:var(--reef-teal); text-underline-offset:.2em; }
.reef-editor a:hover { text-decoration-thickness:3px; }
.reef-editor button,.reef-editor .button { display:inline-flex; align-items:center; justify-content:center; min-height:44px; padding:.6rem 1rem; border:3px solid var(--reef-ink); border-radius:999px; background:var(--reef-coral); color:var(--reef-ink); font:inherit; font-weight:750; cursor:pointer; text-decoration:none; box-shadow:3px 3px 0 var(--reef-ink); }
.reef-editor button.secondary,.reef-editor .button.secondary { background:var(--reef-sand); }
.reef-editor button.danger { background:var(--reef-sand); border-style:dashed; }
.reef-editor button:disabled { cursor:wait; opacity:.65; box-shadow:none; }
.reef-editor :is(a,button,input,textarea,select,summary):focus-visible { outline:3px solid var(--reef-teal); outline-offset:4px; }
.skip { position:fixed; top:-100px; left:1rem; z-index:5; padding:1rem; background:var(--reef-sand); border:3px solid var(--reef-ink); }
.skip:focus { top:1rem; }
.editor-header { display:flex; gap:1rem; justify-content:space-between; align-items:center; flex-wrap:wrap; padding:1rem clamp(1rem,4vw,3rem); border-bottom:3px solid var(--reef-ink); background:var(--reef-foam); }
.editor-header>div { display:flex; align-items:center; gap:1rem; flex-wrap:wrap; }
.reef-editor main { width:min(100% - 2rem,62rem); margin:clamp(1.5rem,4vw,3rem) auto; }
.reef-editor h1 { font-size:clamp(2.4rem,6vw,4rem); font-weight:900; font-stretch:125%; letter-spacing:-.035em; line-height:1.05; margin:0; }
.reef-editor h2 { font-size:1.45rem; line-height:1.2; margin:0 0 1rem; }
.reef-editor .lede { margin:.8rem 0 1.5rem; font-size:1.15rem; color:var(--reef-ink); max-width:48ch; }
.notice { padding:.8rem 1rem; border:3px solid var(--reef-ink); background:var(--reef-foam); overflow-wrap:anywhere; }
.notice:empty { display:none; }
.notice.error { background:#ffcfbf; }
/* Visible page tabs replace the accordion map. The active page gets the same
   ink/sand contrast as editor view switches. Wrapping keeps every destination discoverable. */
.editor-pages { display:flex; flex-wrap:wrap; gap:.4rem; margin:1.5rem 0; padding-bottom:.7rem; border-bottom:2px solid var(--reef-ink); }
.editor-pages a { display:flex; align-items:center; justify-content:center; min-height:44px; padding:.55rem .9rem; border:2px solid var(--reef-ink); border-radius:6px 6px 0 0; font-size:.95rem; line-height:1.35; font-weight:650; text-decoration:none; text-align:center; overflow-wrap:anywhere; }
.editor-pages a:hover { background:var(--reef-foam); }
.editor-pages a[aria-current=page] { background:var(--reef-teal); color:var(--reef-sand); font-weight:800; }
.editor-page { min-width:0; padding-top:.6rem; }
.editor-page>h2 { margin:.5rem 0 1rem; font-size:clamp(1.5rem,3vw,2rem); }
.editor-page>h2:focus-visible { outline:3px solid var(--reef-teal); outline-offset:4px; }
.record-workspace { display:grid; grid-template-columns:minmax(13rem,21rem) minmax(0,1fr); gap:2rem; align-items:start; }
.record-workspace>div { min-width:0; }
.record-workspace h3 { margin:0 0 .75rem; font-size:1rem; }
/* A bounded saved-record list keeps the edit form beside the records rather than
   below the entire inventory. Native scrolling remains keyboard accessible. */
.record-workspace .record-list { max-height:36rem; overflow-y:auto; scrollbar-gutter:stable; padding:.2rem .6rem .2rem 0; border-block:1px solid var(--reef-teal); }
.record-workspace .record { align-items:start; }
.record-workspace .record button { border-width:2px; border-radius:6px; box-shadow:none; padding:.4rem .65rem; }
.record-list[tabindex]:focus-visible { outline:3px solid var(--reef-teal); outline-offset:4px; }
.editor-utilities { display:flex; flex-wrap:wrap; gap:.75rem 1.5rem; align-items:center; justify-content:center; }
.editor-utilities a { display:inline-flex; align-items:center; min-height:44px; }
@media(max-width:39.99rem) { .editor-pages { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.4rem; } .editor-pages a { padding:.5rem .35rem; font-size:.9rem; } }
@media(max-width:55rem) { .record-workspace { grid-template-columns:minmax(0,1fr); gap:1.5rem; } .record-workspace .record-list { max-height:18rem; } }
.reef-editor details { border-top:3px solid var(--reef-ink); scroll-margin-top:1rem; }
.reef-editor details:last-child { border-bottom:3px solid var(--reef-ink); }
.reef-editor summary { padding:1.1rem .2rem; font-weight:850; font-size:clamp(1.2rem,3vw,1.6rem); cursor:pointer; }
.section-body { padding:.4rem 0 2rem; }
.section-body>p:first-child { margin-top:0; }
.reef-editor form { display:grid; gap:1rem; }
.reef-editor label { display:grid; gap:.35rem; font-weight:700; min-width:0; }
.reef-editor :is(input,textarea,select) { width:100%; min-height:44px; padding:.65rem; border:2px solid var(--reef-ink); border-radius:6px; background:#fffef5; color:var(--reef-ink); font:inherit; }
.reef-editor textarea { resize:vertical; min-height:7rem; }
.reef-editor input[type=checkbox] { width:1.4rem; height:1.4rem; min-height:0; margin:0; accent-color:var(--reef-teal); }
.reef-editor input[type=range] { padding:0; accent-color:var(--reef-teal); }
.reef-editor input[type=file] { padding:.5rem; }
.check { display:flex!important; align-items:center; gap:.7rem!important; min-height:44px; font-weight:600!important; }
.fields { display:grid; gap:1rem; min-width:0; }
.actions { display:flex; flex-wrap:wrap; gap:.8rem; align-items:center; }
.help { margin:0; font-size:.9rem; font-weight:400; }
.reef-editor fieldset { border:2px solid var(--reef-ink); padding:1rem; min-width:0; margin:0; }
.reef-editor legend { font-weight:800; padding:0 .3rem; }
.record-list { display:grid; margin:0 0 1.5rem; gap:.7rem; }
.record { display:flex; justify-content:space-between; align-items:center; gap:1rem; border-bottom:1px solid var(--reef-teal); padding:.75rem 0; min-width:0; }
.record p { margin:0; overflow-wrap:anywhere; white-space:pre-wrap; }
.record small { display:block; margin-top:.2rem; }
.record .actions { flex-shrink:0; }
.media-library,.media-picker { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(100%,9rem),1fr)); gap:1rem; margin:1rem 0; }
.media-item { min-width:0; border:2px solid var(--reef-ink); padding:.5rem; border-radius:8px; }
.media-item img,.media-item video { width:100%; aspect-ratio:4/3; object-fit:contain; background:var(--reef-teal); display:block; }
.media-item .check { font-size:.85rem; overflow-wrap:anywhere; align-items:start; padding:.5rem 0; }
.media-item p { margin:.4rem 0; overflow-wrap:anywhere; font-size:.85rem; }
.media-item button { font-size:.85rem; padding:.35rem .6rem; }
.nested-row { display:grid; gap:.75rem; padding-bottom:1rem; margin-bottom:1rem; border-bottom:1px solid var(--reef-teal); }
.nested-row:last-child { margin-bottom:0; }
.login-form { max-width:30rem; }
.reef-editor footer { border-top:3px solid var(--reef-ink); padding:1.3rem; text-align:center; }
.empty { font-style:italic; }
/* Writing direction: keep the reef palette and Archivo, with quiet paper panes.
   Energy 2 / rhythm 1 / motion 1. Coral is reserved for saving published writing.
   A wide reading pane and ordinary paragraph spacing serve long personal posts. */
.reef-editor main { width:min(100% - 2rem,94rem); }
.writing-workspace { display:grid; grid-template-columns:minmax(12rem,16rem) minmax(0,1fr); gap:2rem; align-items:start; }
.writing-workspace .record-list { margin:0; }
.writing-workspace .record { display:grid; gap:.5rem; align-items:start; }
.writing-workspace .record p { font-weight:650; line-height:1.4; white-space:normal; }
.writing-workspace .record small { font-size:.8rem; }
.writing-workspace .record button { min-height:44px; padding:.35rem .65rem; font-size:.9rem; border-width:2px; border-radius:5px; box-shadow:none; }
.writing-heading { display:flex; align-items:baseline; justify-content:space-between; gap:1rem; flex-wrap:wrap; }
.writing-heading h2,.writing-heading p { margin:0; }
.writing-heading p { font-size:.9rem; }
.writer { min-width:0; }
.writer-bar { display:flex; gap:1rem; flex-wrap:wrap; align-items:center; justify-content:space-between; position:sticky; top:0; z-index:2; background:var(--reef-sand); padding:.6rem 0; }
.writer-views { display:flex; flex-wrap:wrap; gap:.35rem; }
.writer-views button { border-width:2px; border-radius:5px; box-shadow:none; padding:.4rem .65rem; font-size:.9rem; }
.writer-views button[aria-pressed=true] { background:var(--reef-teal); color:var(--reef-sand); }
.writer-state { font-size:.85rem; }
.writer-panes { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:1.25rem; align-items:start; }
.writer-source { min-width:0; position:sticky; top:5rem; }
.writer-toolbar { display:flex; gap:.3rem; flex-wrap:wrap; margin-bottom:.65rem; }
.writer-toolbar button { min-height:44px; border-width:1px; border-radius:4px; box-shadow:none; padding:.25rem .55rem; font-size:.85rem; font-weight:650; }
.writer-toolbar button[data-format=bold] { font-weight:850; }
.writer-toolbar button[data-format=italic] { font-style:italic; }
.writer-label { margin-bottom:.35rem; }
.writer-source textarea { display:block; min-height:28rem; height:60vh; max-height:75vh; font:400 1rem/1.75 Archivo,Arial,sans-serif; padding:1rem; border-width:1px; border-radius:4px; tab-size:2; }
.writer-source .help { margin-top:.6rem; }
.writer-preview { min-width:0; padding:1.25rem; border:1px solid var(--reef-ink); border-radius:4px; background:#fffef5; min-height:28rem; }
.writer-preview h3 { margin:0 0 1.25rem; font-size:.9rem; font-weight:650; }
.writer-preview .reef-markdown { font-size:1rem; }
.writer-empty { opacity:.75; }
.writer[data-view=write] .writer-preview,.writer[data-view=preview] .writer-source { display:none; }
.writer:is([data-view=write],[data-view=preview]) .writer-panes { grid-template-columns:minmax(0,1fr); }
.writer[data-view=preview] .writer-preview .reef-markdown { max-width:70ch; margin:auto; }
.writer-actions { padding-top:.5rem; }
.writer-actions button { border-radius:6px; border-width:2px; box-shadow:2px 2px 0 var(--reef-ink); }
.writing-settings { border:1px solid var(--reef-ink)!important; border-radius:4px; padding:0 1rem; }
.writing-settings summary { font-size:1rem; padding:.8rem 0; }
.writing-settings[open] { padding-bottom:1rem; }
.writer-link-dialog { width:min(30rem,calc(100% - 2rem)); padding:1.5rem; border:2px solid var(--reef-ink); border-radius:6px; background:var(--reef-sand); color:var(--reef-ink); }
.writer-link-dialog::backdrop { background:rgb(9 33 36 / .55); }
.writer-link-dialog label { margin:.8rem 0; }
.writer-link-dialog h3 { margin-top:0; }
@media(max-width:74rem) { .writing-workspace { grid-template-columns:minmax(0,1fr); gap:1.5rem; } .writing-workspace .record-list { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,14rem),1fr)); gap:1rem; } }
@media(max-width:44rem) { .writer-panes { grid-template-columns:minmax(0,1fr); } .writer-source { position:static; } .writer-preview { padding:1rem; } .writer-bar { gap:.5rem; } .writer-source textarea { min-height:22rem; } }
@media(min-width:40rem) { .fields.two { grid-template-columns:repeat(2,minmax(0,1fr)); } .fields.three { grid-template-columns:repeat(3,minmax(0,1fr)); } .nested-row.reading { grid-template-columns:1.2fr .8fr .6fr 1.4fr auto; align-items:end; } .nested-row.alternative { grid-template-columns:1fr 1.7fr auto auto; align-items:end; } }
@media(max-width:39.99rem) { .record { align-items:start; flex-direction:column; gap:.6rem; } .reef-editor fieldset { padding:.75rem; } .editor-header { align-items:start; } }
@media(prefers-reduced-motion:reduce) { * { scroll-behavior:auto!important; transition:none!important; } }

.plan-current { display:flex; align-items:start; justify-content:space-between; gap:1.5rem; padding:1.25rem; background:var(--reef-foam); border:2px solid var(--reef-ink); }
.plan-current h3 { margin:.2rem 0 .7rem; font-size:clamp(1.2rem,3vw,1.7rem); line-height:1.35; }
.plan-current p:last-child { margin-bottom:0; }
.plan-kicker { margin:0; font-size:.85rem; font-weight:750; }
.plan-current>button { flex-shrink:0; }
.plan-notice { padding:.75rem 1rem; border:2px solid var(--reef-ink); background:var(--reef-foam); overflow-wrap:anywhere; }
.plan-notice:empty { display:none; }
.plan-notice.error { background:#ffcfbf; }
.plan-new { grid-template-columns:minmax(10rem,16rem) auto; align-items:end; justify-content:start; margin:1.5rem 0 2rem; }
.plan-table-wrap { overflow-x:auto; margin-bottom:2rem; }
.plan-history { width:100%; border-collapse:collapse; text-align:left; }
.plan-history caption { text-align:left; font-size:.85rem; margin-bottom:.5rem; }
.plan-history :is(th,td) { vertical-align:top; padding:.75rem; border-bottom:1px solid var(--reef-teal); overflow-wrap:anywhere; }
.plan-history thead { background:var(--reef-foam); }
.plan-history th span { display:block; font-size:.85rem; font-weight:450; max-width:44ch; }
.plan-history [aria-current=true] { background:#fffef5; }
.plan-history button { border-width:2px; border-radius:5px; box-shadow:none; padding:.4rem .65rem; white-space:nowrap; }
.plan-version-heading h3 { font-size:1.45rem; margin:1.5rem 0 .75rem; overflow-wrap:anywhere; scroll-margin-top:1.5rem; }
.plan-status { margin:0 0 1rem; }
.plan-metadata { display:flex; flex-wrap:wrap; gap:.75rem 2rem; margin:0 0 1rem; font-size:.9rem; }
.plan-metadata div { min-width:8rem; }
.plan-metadata dt { font-weight:700; }
.plan-metadata dd { margin:0; }
.plan-summary { max-width:85ch; font-size:1.1rem; }
.plan-changelog p { white-space:pre-wrap; }
.plan-related ul,.plan-warnings ul { padding-left:1.4rem; }
.plan-related li { margin:.35rem 0; }
.reef-editor button.plan-link { min-height:44px; background:transparent; padding:.2rem 0; border:0; border-radius:0; box-shadow:none; text-decoration:underline; text-underline-offset:.2em; text-align:left; justify-content:start; font-size:1rem; font-weight:600; }
.plan-document { margin:1rem 0 1.5rem; border:1px solid var(--reef-ink)!important; border-radius:4px; padding:0 1rem; background:#fffef5; }
.plan-document summary { font-size:1rem; }
.plan-document article { max-width:90ch; margin:1rem auto 2rem; }
.plan-hash { overflow-wrap:anywhere; padding-bottom:1rem; }
.plan-editor { margin:1.5rem 0; padding:1rem; border:1px solid var(--reef-ink); background:#fffef5; }
.plan-editor h4 { margin:0; }
.plan-editor .plan-body-input { min-height:28rem; font:400 1rem/1.7 Archivo,Arial,sans-serif; }
.plan-compare { margin-top:2rem; }
.plan-compare>form { max-width:55rem; }
.plan-compare>form>button { justify-self:start; }
.plan-section-diff { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:1rem; }
.plan-section-diff section { border-top:1px solid var(--reef-ink); }
.plan-section-diff :is(h5,p) { margin:.7rem 0; }
.plan-section-diff ul { padding-left:1.2rem; overflow-wrap:anywhere; }
.plan-diff { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:1rem; }
.plan-diff section { min-width:0; }
.plan-diff h5 { font-size:.95rem; margin:.5rem 0; }
.plan-diff pre { font:400 .9rem/1.7 ui-monospace,monospace; white-space:pre-wrap; overflow-wrap:anywhere; padding:.75rem; border:1px solid var(--reef-ink); border-radius:4px; background:#fffef5; max-height:42rem; overflow-y:auto; }
.plan-diff-added { background:#d7efde; text-decoration:underline; text-decoration-thickness:2px; }
.plan-diff-removed { background:#f8dcd1; text-decoration:line-through; }
.plan-activation-history { margin-top:2rem; }
.plan-activation-history summary { font-size:1rem; }
@media(max-width:44rem) { .plan-current { flex-direction:column; } .plan-new { grid-template-columns:minmax(0,1fr); } .plan-new button { justify-self:start; } .plan-diff,.plan-section-diff { grid-template-columns:minmax(0,1fr); } .plan-history :is(th,td) { padding:.6rem .35rem; } .plan-history { font-size:.85rem; } .plan-history button { white-space:normal; font-size:.85rem; } }
