@import url("https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,300..500&display=swap");

/* Butter's portal: a quiet sidebar and the page side by side in the middle, split by one hairline.
   Cream paper, flat sky, sage and butter blocks taken from the welcome scene, soft type, nothing bold.
   The portal is set in Inter Light; the welcome screen keeps its own fonts (welcome.css). */
:root {
  --paper: #faf6e6;
  --paper-2: #f3eed8;
  --line: #e1dabf;
  --line-soft: #ebe5cd;
  --ink: #343a22;
  --heading: #2f3a22;
  --muted: #7b7860;
  --faint: #a9a488;
  --butter: #f2e3a3;
  --butter-edge: #e6d07a;
  --sky: #c9dbef;
  --sky-ink: #2c4462;
  --sage: #c4cfb2;
  --sage-ink: #33462a;
  --leaf: #6f8f4e;
  --serif: "Inter", "Helvetica Neue", Arial, sans-serif;
  --sans: "Inter", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); }

.skip-link { position: fixed; top: .75rem; left: 1rem; z-index: 20; padding: .6rem 1rem; background: #fff; color: var(--ink); transform: translateY(-180%); }
.skip-link:focus { transform: none; }

.portal { display: grid; grid-template-columns: 220px minmax(0, 640px); justify-content: center; min-height: 100vh; color: var(--ink); font: 400 15px/1.6 var(--sans); font-variation-settings: "opsz" 14; -webkit-font-smoothing: antialiased; }
.portal :is(h1, h2, p, ul) { margin: 0; }
.portal a { color: inherit; text-decoration: none; }
.portal :is(button, input) { font: inherit; color: inherit; }
.portal :focus-visible { outline: 2px solid var(--sky-ink); outline-offset: 3px; border-radius: 6px; }
.portal .label { font: 500 11px/1.4 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }

/* Sidebar. */
.portal .side { display: flex; flex-direction: column; min-height: 100vh; padding: 64px 36px 36px 0; border-right: 1px solid var(--line); }
.portal .brand { font: 400 54px/.9 var(--serif); letter-spacing: -0.055em; color: var(--heading); }

/* A little postcard of the welcome scene, with the number to text. */
.portal .postcard { position: relative; display: block; overflow: hidden; height: 132px; margin-top: 28px; border-radius: 14px; isolation: isolate; cursor: pointer; transition: transform .25s ease, box-shadow .25s ease; }
.portal .postcard:hover, .portal .postcard:focus-visible { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(44, 68, 98, .18); }
.portal .postcard-go { position: absolute; z-index: 2; right: 12px; bottom: 10px; padding: 4px 10px; border-radius: 999px; background: rgba(250, 246, 230, .9); font: 500 11px/1.4 var(--sans); font-style: normal; color: var(--heading); opacity: 0; transform: translateY(4px); transition: opacity .2s ease, transform .2s ease; }
.portal .postcard:hover .postcard-go, .portal .postcard:focus-visible .postcard-go { opacity: 1; transform: none; }
@media (hover: none) { .portal .postcard-go { opacity: 1; transform: none; } }
.portal .postcard canvas { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); filter: url(#impasto); }
/* The postcard's own little sky: two small clouds drifting slowly across, and a few birds now and then.
   They travel by the card's width (left %), not the window's, so they stay in view long enough to notice. */
.portal .postcard .cloud { position: absolute; left: 0; z-index: 1; opacity: .75; filter: url(#impasto); animation: butter-card-drift linear infinite; pointer-events: none; }
@keyframes butter-card-drift { from { left: -55%; } to { left: 105%; } }
.portal .postcard .flock { position: absolute; left: 0; z-index: 1; transform: scale(.55); transform-origin: 0 0; animation: butter-card-fly linear infinite; pointer-events: none; }
.portal .postcard .flock svg { position: absolute; overflow: visible; }
.portal .postcard .flock path { fill: none; stroke: #2e2a1c; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@keyframes butter-card-fly { 0% { left: -30%; margin-top: 0; } 50% { left: 45%; margin-top: -6px; } 100% { left: 115%; margin-top: 2px; } }
.portal .postcard p { position: absolute; z-index: 2; left: 16px; top: 34px; right: 12px; color: var(--sky-ink); }
.portal .postcard span { display: block; font: 500 10px/1.4 var(--sans); letter-spacing: .14em; text-transform: uppercase; opacity: .75; }
.portal .postcard strong { display: block; margin-top: 2px; font: 400 17px/1.2 var(--serif); white-space: nowrap; letter-spacing: -0.01em; color: var(--heading); }
@keyframes butter-drift { from { transform: translateX(-30vw); } to { transform: translateX(130vw); } }

.portal .nav { position: relative; margin-top: 36px; display: grid; gap: 2px; }
.portal .nav a { position: relative; padding: 6px 0 6px 18px; font-size: 15px; color: var(--muted); transition: color .2s; }
.portal .nav a:hover, .portal .nav a[aria-current] { color: var(--heading); }
/* One butter square that rolls to the current page (app.js moves it). */
.portal .nav-mark { position: absolute; left: 0; top: 0; width: 7px; height: 7px; border-radius: 2px; background: var(--butter); box-shadow: 0 0 0 1px var(--butter-edge) inset; pointer-events: none; transition: transform .55s cubic-bezier(.65, 0, .25, 1); }


.portal .side-foot { margin-top: auto; padding-top: 32px; }
.portal .side-foot button { padding: 0; border: 0; background: none; font-size: 14px; color: var(--muted); cursor: pointer; }
.portal .side-foot button:hover { color: var(--heading); }

/* The page. */
.portal .content { padding: 64px 0 96px 64px; min-width: 0; }
.portal .content:focus { outline: none; }
.portal .page { animation: portal-in .35s ease both; }
@keyframes portal-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.portal h1 { font: 300 42px/1.1 var(--serif); letter-spacing: -0.035em; color: var(--heading); }
.portal .intro { margin-top: 12px; max-width: 30rem; font-size: 16px; color: var(--muted); }

/* Flat colour blocks, like the welcome scene's sky and grass. */
.portal .block { position: relative; isolation: isolate; overflow: hidden; margin-top: 36px; padding: 26px 28px 28px; border-radius: 18px; }
.portal .block > canvas.texture { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; }
/* The painted paper behind the whole portal. */
.portal > canvas.paper { position: fixed; inset: 0; z-index: -1; width: 100vw; height: 100vh; pointer-events: none; }
.portal { position: relative; isolation: isolate; }
.portal .block.sky { background: var(--sky); color: var(--sky-ink); }
.portal .block.sage { background: var(--sage); color: var(--sage-ink); }
.portal .block.butter { background: #f6ebbd; color: #5b4b12; }
.portal .block .label { color: inherit; opacity: .7; }
.portal .block-line { margin-top: 8px; font: 300 27px/1.25 var(--serif); letter-spacing: -0.03em; }

.portal .section { margin-top: 44px; }
.portal .section-head { display: flex; align-items: baseline; justify-content: space-between; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.portal .rows { list-style: none; padding: 0; }
.portal .row { display: flex; align-items: center; gap: 16px; min-height: 70px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.portal .mark { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; font: 400 14px/1 var(--serif); color: var(--heading); background: var(--paper-2); }
.portal .mark.sky { background: var(--sky); color: var(--sky-ink); }
.portal .mark.sage { background: var(--sage); color: var(--sage-ink); }
.portal .mark.butter { background: var(--butter); color: #5b4b12; font-family: var(--sans); font-size: 12px; }
.portal .mark.logo { background: #fff; border: 1px solid var(--line-soft); }
.portal .mark.logo svg { width: 22px; height: 22px; object-fit: contain; }
.portal .mark.logo svg[viewBox="52 42 88 66"] { height: 17px; }
.portal .what { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.portal .what .name { font-size: 16px; color: var(--ink); }
.portal .what p:not(.name) { font-size: 14px; color: var(--muted); }
.portal .what p.on { color: var(--sage-ink); }
.portal .on::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 8px; border-radius: 50%; background: var(--leaf); vertical-align: 1px; }
.portal .empty { padding: 18px 0; color: var(--muted); border-bottom: 1px solid var(--line-soft); }
.portal .status:not(:empty) { margin-top: 12px; font-size: 14px; color: var(--sage-ink); }

/* Pill buttons, like the welcome scene's butter. Soft, never bold. */
.portal .pill { flex: none; display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 18px; border: 1px solid var(--butter-edge); border-radius: 999px; background: var(--butter); font: 500 11.5px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: #4a3f10; cursor: pointer; transition: background .2s, border-color .2s, transform .15s; }
.portal .pill:hover { background: #efd98a; }
.portal .pill:active { transform: translateY(1px); }
.portal .pill:disabled { opacity: .5; cursor: default; }
.portal .pill.quiet, .portal .row[data-connected] .pill { background: transparent; border-color: var(--line); color: var(--ink); }
.portal .pill.quiet:hover, .portal .row[data-connected] .pill:hover { background: var(--paper-2); }

/* Forms. */
.portal .field { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 16px; min-height: 56px; border-bottom: 1px solid var(--line-soft); font-size: 14px; color: var(--muted); }
.portal .field input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid transparent; border-radius: 8px; background: transparent; font-size: 16px; color: var(--ink); outline: none; transition: background .2s, border-color .2s; }
.portal .field input:hover { background: var(--paper-2); }
.portal .field input:focus, .portal .add input:focus, .portal .inline-form input:focus { background: #fff; border-color: var(--butter-edge); box-shadow: 0 0 0 3px rgba(242, 227, 163, .55); }
.portal input::placeholder { color: var(--faint); }
.portal .form-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 22px; }
.portal .form-foot p { font-size: 14px; color: var(--muted); }
.portal .inline-form { display: grid; gap: 14px; margin-top: 18px; padding: 22px; border: 1px solid var(--line); border-radius: 14px; }
.portal .inline-form label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.portal .inline-form input, .portal .add input { height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: #fffdf4; font-size: 15px; color: var(--ink); outline: none; }
.portal .inline-form .form-foot { margin-top: 4px; }
.portal .add { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; margin-top: 18px; }
.portal .add .pill { height: 42px; }
.portal .note { margin-top: 10px; font-size: 13px; color: var(--faint); }

.portal .card-list { list-style: none; padding: 0; margin-top: 10px; }
.portal .card-list li { display: flex; gap: 14px; padding: 10px 0; font: 300 18px/1.45 var(--serif); letter-spacing: -0.01em; border-bottom: 1px solid rgba(91, 75, 18, .14); }
.portal .card-list li:last-child { border-bottom: 0; }
.portal .card-list li::before { content: ""; flex: none; width: 12px; margin-top: 13px; border-top: 1px solid currentColor; opacity: .4; }
.portal #profile-other { margin-top: 48px; }

/* Routines: each one with its own Pause/Resume and Delete. */
.portal .routine-actions { display: flex; gap: 8px; flex: none; }
.portal .row[data-paused] .what { opacity: .55; }

/* Repeatable rows: phones, emails and addresses, each with a short name. */
.portal .multi .item { display: grid; grid-template-columns: 150px 1fr 32px; align-items: center; gap: 16px; min-height: 56px; border-bottom: 1px solid var(--line-soft); }
.portal .multi input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid transparent; border-radius: 8px; background: transparent; font-size: 16px; color: var(--ink); outline: none; transition: background .2s, border-color .2s; }
.portal .multi input.tag { margin-left: -12px; font-size: 14px; color: var(--muted); }
.portal .multi input:hover { background: var(--paper-2); }
.portal .multi input:focus { background: #fff; border-color: var(--butter-edge); box-shadow: 0 0 0 3px rgba(242, 227, 163, .55); }
.portal .remove { width: 30px; height: 30px; padding: 0; border: 1px solid transparent; border-radius: 50%; background: transparent; color: var(--faint); font-size: 18px; line-height: 1; cursor: pointer; transition: background .2s, color .2s; }
.portal .remove:hover { background: var(--paper-2); color: var(--ink); }
.portal .section-note { margin: 12px 0 2px; font-size: 14px; color: var(--muted); }
.portal .multi[data-kind="detail"] input.tag { color: var(--ink); }
.portal .multi[data-kind="detail"] .item { grid-template-columns: 220px 1fr 32px; }
.portal .add-more { margin-top: 10px; padding: 8px 0; border: 0; background: none; font-size: 14px; color: var(--muted); cursor: pointer; }
.portal .add-more:hover { color: var(--heading); }
.portal .multi:empty + .add-more { margin-top: 14px; }

@media (max-width: 900px) {
  .portal { grid-template-columns: 1fr; padding: 0 20px; }
  .portal .side { min-height: 0; padding: 28px 0 18px; border-right: 0; border-bottom: 1px solid var(--line); }
  .portal .postcard { height: 96px; }
  .portal .nav { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 20px; }
  .portal .side-foot { margin-top: 14px; padding-top: 0; }
  .portal .content { padding: 32px 0 64px; }
  .portal h1 { font-size: 36px; }
  .portal .brand { font-size: 44px; }
  .portal .field { grid-template-columns: 1fr; gap: 0; padding: 10px 0; }
  .portal .multi .item { grid-template-columns: 1fr 32px; gap: 0 8px; padding: 8px 0; }
  .portal .multi input.tag { grid-column: 1; margin-left: -12px; }
  .portal .multi input.value { grid-column: 1; }
  .portal .remove { grid-column: 2; grid-row: 1 / span 2; }
  .portal .add { grid-template-columns: 1fr; }
  .portal .block-line { font-size: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  .portal *, .portal *::before, .portal *::after { animation: none !important; transition: none !important; }
}
