/* Garden site chrome: the home page, library and viewer. Dark and light, from Fiveable's tokens.
   The theme is html[data-theme]; app/theme.js sets it from the saved choice or the system setting. */
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans:wght@300;400;500;600;700&family=Tilt+Warp&family=IBM+Plex+Mono:wght@400;500;600&display=swap");

:root, [data-theme="dark"] {
  --bg: #111213; --raised: #1A1C1E; --line: #2A2D30; --line-strong: #3A3D40;
  --ink: #F3F2EE; --ink-2: #D6D8D9; --ink-3: #B9BCBE; --ink-faint: #8D9194;
  --invert-bg: #F3F2EE; --invert-ink: #111213;
  --link: #CCECF0; --page-tile: #CCECF0; --note-tile: #E1D1FA; --tile-ink: #111213;
  --good: #7FD9A0; --good-bg: #16301F; --warn: #EBBC2E; --warn-bg: #33290C; --bad: #FF9A82; --bad-bg: #3A1A14;
  --you: #E1D1FA; --you-line: #4A3F5E;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #FFFFFF; --raised: #F9F9F9; --line: #E3E3E3; --line-strong: #C9C9C9;
  --ink: #000000; --ink-2: #1F1F1F; --ink-3: #595959; --ink-faint: #767676;
  --invert-bg: #000000; --invert-ink: #FFFFFF;
  --link: #016575; --page-tile: #CCECF0; --note-tile: #E1D1FA; --tile-ink: #000000;
  --good: #1A8147; --good-bg: #D9F7E5; --warn: #7A5900; --warn-bg: #FBF0D5; --bad: #B3261E; --bad-bg: #FFDFDF;
  --you: #6B3FC0; --you-line: #D8C6F7;
  color-scheme: light;
}
:root {
  --display: "Tilt Warp", "Noto Sans", sans-serif;
  --body: "Noto Sans", "Open Sans", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
/* Display rules below would otherwise beat the hidden attribute. */
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--ink); min-height: 100vh; display: flex; flex-direction: column;
  font: 300 16px/1.6 var(--body); -webkit-font-smoothing: antialiased;
}
a { color: var(--link); }
h1, h2, h3 { font-family: var(--display); font-weight: 400; text-transform: lowercase; letter-spacing: -0.01em; line-height: 1.1; margin: 0; }
strong { font-weight: 600; }
code { font: 400 .88em/1.4 var(--mono); background: var(--raised); border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px; }
pre { font: 400 13px/1.6 var(--mono); background: var(--raised); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; overflow-x: auto; margin: 0; white-space: pre-wrap; word-break: break-all; }
pre code { background: none; border: 0; padding: 0; }
.mono { font-family: var(--mono); }

/* ---------- Bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; padding: 0 24px;
  background: var(--bg); border-bottom: 1px solid var(--line); font-size: 14px; height: 52px;
}
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font: 400 19px/1 var(--display); flex: none; }
.crumb { color: var(--ink-3); font-weight: 500; text-decoration: none; }
a.crumb:hover { color: var(--ink); }
.bar .spacer { flex: 1; }
.who { display: flex; gap: 12px; align-items: center; min-width: 0; }
.who-email { color: var(--ink-3); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 28ch; }
.theme { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 6px; }
.theme button { font: 500 12px/1 var(--mono); color: var(--ink-3); background: none; border: 0; padding: 5px 8px; border-radius: 4px; cursor: pointer; }
.theme button[aria-pressed=true] { background: var(--invert-bg); color: var(--invert-ink); }
@media (max-width: 600px) { .who-email, .crumb { display: none; } .bar { padding: 0 14px; } }

/* ---------- Buttons and inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  font: 600 14px/1 var(--body); color: var(--ink); background: var(--raised); border: 1px solid var(--line); border-radius: 8px;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--line-strong); }
.btn.primary { background: var(--invert-bg); color: var(--invert-ink); border-color: var(--invert-bg); }
.btn.primary:hover { opacity: .9; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.field { display: grid; gap: 6px; }
.field label { font: 600 14px/1.2 var(--body); color: var(--ink); }
input[type=email], input[type=search] {
  font: 400 15px/1.2 var(--body); height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--raised); color: var(--ink); width: 100%;
}
input::placeholder { color: var(--ink-faint); }
input:focus-visible, .btn:focus-visible, .seg button:focus-visible, .theme button:focus-visible, a.row:focus-visible { outline: 2px solid #9864E7; outline-offset: 2px; }
.msg { font-size: 14px; min-height: 1.4em; margin: 0; color: var(--ink-2); }

/* ---------- Signed out ---------- */
.wrap { width: 100%; max-width: 1000px; margin: 0 auto; padding: 0 24px; }
.hero { padding-block: 88px 56px; display: grid; grid-template-columns: 1.3fr 1fr; gap: 56px; align-items: center; }
.eyebrow { font: 500 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 18px; }
.hero h1 { font-size: clamp(40px, 6vw, 60px); margin-bottom: 18px; }
.hero p { font-size: 18px; line-height: 1.65; color: var(--ink-2); margin: 0 0 26px; max-width: 36ch; }
.hero .cta { display: flex; gap: 10px; flex-wrap: wrap; }
.panel { border: 1px solid var(--line); border-radius: 12px; padding: 24px; background: var(--raised); display: grid; gap: 14px; }
.panel h2 { font-size: 26px; }
.panel p { margin: 0; font-size: 15px; color: var(--ink-2); }
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; padding-block: 48px 32px; gap: 32px; } }

.agents { border-top: 1px solid var(--line); padding-block: 48px 72px; display: grid; grid-template-columns: 1fr 1.4fr; gap: 40px; }
.agents h2 { font-size: 28px; margin-bottom: 12px; }
.agents p { margin: 0 0 12px; color: var(--ink-2); }
.agents ol { margin: 0; padding-left: 20px; display: grid; gap: 14px; color: var(--ink-2); }
@media (max-width: 820px) { .agents { grid-template-columns: 1fr; } }

footer.site { border-top: 1px solid var(--line); padding: 18px 0 28px; font-size: 13px; margin-top: auto; color: var(--ink-3); }
footer.site .wrap { display: flex; gap: 18px; flex-wrap: wrap; }

/* ---------- Library ---------- */
.lib { padding-block: 56px 96px; }
.lib-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.lib-head h1 { font-size: 52px; }
.lib-head .count { font: 500 13px/1 var(--mono); color: var(--ink-3); padding-bottom: 8px; }
.lib-tools { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.lib-tools .search { flex: 1 1 320px; position: relative; }
.lib-tools .search input { padding-left: 38px; }
.lib-tools .search svg { position: absolute; left: 13px; top: 13px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--raised); border: 1px solid var(--line); border-radius: 8px; }
.seg button { font: 600 14px/1 var(--body); padding: 0 14px; height: 34px; border: 0; border-radius: 6px; background: none; color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed=true] { background: var(--invert-bg); color: var(--invert-ink); }

.group { font: 500 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 28px 0 10px; margin: 0; }
.items { list-style: none; margin: 0; padding: 0; }
.items li { border-top: 1px solid var(--line); }
.items li:last-child { border-bottom: 1px solid var(--line); }
.items a.row { display: grid; grid-template-columns: 1fr 120px; gap: 18px; align-items: start; padding: 16px 12px; color: var(--ink); text-decoration: none; border-radius: 8px; }
.items a.row:hover { background: var(--raised); }
.tile { width: 44px; height: 44px; border-radius: 8px; display: grid; place-items: center; font: 600 11px/1 var(--mono); color: var(--tile-ink); background: var(--page-tile); }
.tile.text { background: var(--note-tile); }
.row .title { font: 600 16px/1.35 var(--body); display: block; }
.row .desc { font-size: 14px; line-height: 1.5; color: var(--ink-2); display: block; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.row .when { font: 500 12px/22px var(--mono); color: var(--ink-3); text-align: right; white-space: nowrap; }
.tag { display: inline-flex; align-items: center; font: 500 11px/1 var(--mono); padding: 4px 7px; border-radius: 4px; border: 1px solid var(--line-strong); color: var(--ink-3); white-space: nowrap; }
.tag.team { border-color: transparent; background: var(--good-bg); color: var(--good); }
.tag.public_link { border-color: transparent; background: var(--warn-bg); color: var(--warn); }
.tag.from { border-color: var(--you-line); color: var(--you); }
.empty { border: 1px dashed var(--line-strong); border-radius: 12px; padding: 40px 24px; text-align: center; margin-top: 16px; }
.empty h2 { font-size: 24px; margin-bottom: 8px; }
.empty p { margin: 0 auto; max-width: 46ch; color: var(--ink-2); }
@media (max-width: 600px) {
  .items a.row { grid-template-columns: 1fr; padding: 14px 4px; gap: 6px; }
  .row .when { text-align: left; }
  .lib-head h1 { font-size: 40px; }
}

/* ---------- Viewer ---------- */
.view-meta { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.view-meta .title { font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-meta .from { font-size: 13px; color: var(--ink-3); white-space: nowrap; }
@media (max-width: 700px) { .view-meta .from, .view-meta .tag { display: none; } }

main.viewer { width: 100%; max-width: 760px; margin: 0 auto; padding: 56px 24px 96px; }
main.viewer:has(~ .frame:not([hidden])) { display: none; }
.status { font-size: 16px; color: var(--ink-2); }
.gate { max-width: 420px; margin: 24px auto; }

.note { color: var(--ink-2); }
.note h1, .note h2, .note h3 { margin: 1.4em 0 .5em; color: var(--ink); }
.note h1 { font-size: 44px; margin-top: 0; }
.note h2 { font-size: 28px; }
.note h3 { font-size: 21px; }
.note strong { color: var(--ink); }
.note p, .note ul, .note ol { margin: 0 0 14px; }
.note li { margin-bottom: 6px; }
.note img { max-width: 100%; }
.note pre { margin: 0 0 16px; }
.note table { border-collapse: collapse; display: block; overflow-x: auto; margin: 0 0 16px; font-size: 14px; }
.note th { text-align: left; font-weight: 500; color: var(--ink-3); border-bottom: 1px solid var(--line-strong); }
.note th, .note td { padding: 10px 14px 10px 0; }
.note td { border-bottom: 1px solid var(--line); color: var(--ink); }
.note blockquote { margin: 0 0 14px; padding: 12px 16px; border-left: 3px solid var(--line-strong); background: var(--raised); border-radius: 0 8px 8px 0; }
.note hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }

/* Pages get the whole window under the bar. They set their own background. */
/* White behind pages that set no background of their own; kit pages paint their theme. */
.frame { flex: 1; width: 100%; border: 0; background: #fff; min-height: calc(100vh - 52px); }

/* ---------- Library: view switch, links, collections ---------- */
.lib-head .seg { margin-left: 8px; align-self: center; }
.lib-head .spacer { flex: 1; }
.lib-head .btn { align-self: center; }
.lib-head .count { align-self: center; padding: 0; }

select {
  font: 500 14px/1.2 var(--body); height: 42px; padding: 0 34px 0 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--raised) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--ink); appearance: none; max-width: 100%;
}
textarea { font: 400 13px/1.5 var(--mono); width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--raised); color: var(--ink); resize: vertical; }
input[type=text], input[type=url] {
  font: 400 15px/1.2 var(--body); height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--raised); color: var(--ink); width: 100%;
}

.addlink { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.addlink input { flex: 1 1 320px; }
.addlink select { flex: 0 1 220px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 8px; }
.chip { font: 500 12px/1 var(--mono); padding: 6px 9px; border-radius: 6px; border: 1px solid var(--line-strong); background: none; color: var(--ink-3); cursor: pointer; }
.chip:hover { color: var(--ink); border-color: var(--ink-3); }
.chip.on { background: var(--invert-bg); color: var(--invert-ink); border-color: var(--invert-bg); }
.chip.big { display: inline-flex; gap: 8px; align-items: center; font: 600 14px/1 var(--body); padding: 9px 12px; border-radius: 8px; color: var(--ink-2); }
.chip.big .n { font: 500 12px/1 var(--mono); color: var(--ink-3); }
.chip.big.shared { border-color: var(--good-bg); background: var(--good-bg); color: var(--good); }
.chip.big.shared .n { color: var(--good); }
.chip.big[aria-pressed=true] { background: var(--invert-bg); color: var(--invert-ink); border-color: var(--invert-bg); }
.chip.big[aria-pressed=true] .n { color: var(--invert-ink); opacity: .7; }

.items .row.link { display: grid; grid-template-columns: 1fr 120px; gap: 18px; align-items: start; padding: 16px 12px; }
.items .row.link a.title { color: var(--ink); text-decoration: none; }
.items .row.link a.title:hover { text-decoration: underline; }
.items .row.link.composted { opacity: .5; }
.tile.link { background: #D9F7E5; text-transform: lowercase; }
.row .acts { display: flex; gap: 6px; margin-top: 10px; }
@media (max-width: 600px) { .items .row.link { grid-template-columns: 1fr; padding: 14px 4px; gap: 6px; } }

/* ---------- Dialogs ---------- */
dialog.modal { padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--ink); width: min(560px, calc(100vw - 32px)); box-shadow: 0 24px 64px rgba(0,0,0,.35); }
dialog.modal::backdrop { background: rgba(0,0,0,.45); }
.modal-body { display: grid; gap: 14px; padding: 24px; }
.modal-body h2 { font-size: 28px; }
.modal-body > p { margin: 0; color: var(--ink-2); font-size: 15px; }
.modal-foot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.modal-foot .spacer { flex: 1; }
.field.inline { display: flex; gap: 8px; align-items: center; }
.field.inline span { font: 500 13px/1 var(--body); color: var(--ink-3); }
.field.inline select { height: 36px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--ink-2); line-height: 1.45; }
.check input { margin-top: 3px; }
.btn.danger { color: var(--bad); background: none; border-color: var(--line); }
.btn.danger:hover { border-color: var(--bad); }

.drop { display: grid; place-items: center; gap: 4px; padding: 28px 16px; border: 1.5px dashed var(--line-strong); border-radius: 12px; cursor: pointer; text-align: center; color: var(--ink-2); }
.drop:hover, .drop.over { border-color: var(--ink-3); background: var(--raised); }
.drop input { display: none; }
.drop strong { color: var(--ink); font-weight: 600; }
.drop span { font-size: 13px; color: var(--ink-3); }
.paste summary { cursor: pointer; font-size: 14px; color: var(--ink-3); }
.paste textarea { margin-top: 8px; }
.import-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.import-list:empty { display: none; }
.import-list li { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--raised); }
.import-list li.bad { border-color: var(--bad-bg); }
.import-list .title-input { height: 34px; flex: 1; min-width: 0; font: 500 14px/1.2 var(--body); padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); }
.import-list .name { font: 500 13px/1.3 var(--mono); color: var(--ink); }
.import-list .why { flex: 1; font-size: 13px; color: var(--bad); }
.import-list .x { background: none; border: 0; color: var(--ink-3); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 4px; }

/* ---------- Viewer actions and share ---------- */
.view-acts { display: flex; gap: 8px; align-items: center; flex: none; }
.choices { display: grid; gap: 8px; }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--ink-3); background: var(--raised); }
.choice input { margin-top: 4px; }
.choice strong { display: block; font-weight: 600; }
.choice em { display: block; font-style: normal; font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.linkbox { display: grid; gap: 6px; }
.linkbox .small { margin: 6px 0 0; font-size: 13px; color: var(--ink-3); }
.linkrow { display: flex; gap: 8px; align-items: center; }
.linkrow code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 8px 10px; }
@media (max-width: 700px) { .view-acts .btn:not(.primary) { display: none; } }

/* ---------- Pinned pages ---------- */
.pins { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-bottom: 8px; }
.pin-card { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; background: var(--raised); border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; min-height: 132px; }
.pin-card:hover { border-color: var(--line-strong); }
.pin-card .title { font: 400 24px/1.1 var(--display); text-transform: lowercase; }
.pin-card .desc { font-size: 14px; line-height: 1.5; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pin-card .when { margin-top: auto; font: 500 12px/1 var(--mono); color: var(--ink-3); }
.view-acts .btn[aria-pressed=true] { background: var(--invert-bg); color: var(--invert-ink); border-color: var(--invert-bg); }
