/* Porch. Palette adapted from the Raycast recipe (ink-dark surfaces, hairlines, one white pill),
   warmed for a home screen: warm near-black, cream ink, a single amber accent. */
:root {
  --canvas: #0b0a09;
  --ink: #f6f1e9;
  --body: #d9d2c7;
  --mute: #a39b90;
  --hair: rgba(246, 241, 233, .14);
  --glass: rgba(20, 18, 16, .46);
  --glass-strong: rgba(18, 16, 14, .82);
  --accent: #f2b45a;
  --danger: #ff7a6b;
  --r-sm: 8px;
  --r: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --dim: .35;
  --blur: 0px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--canvas);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.bg {
  position: fixed; inset: -40px; z-index: -2;
  background: var(--bg, linear-gradient(160deg, #3b2a1c, #0b0a09 70%)) center / cover no-repeat;
  filter: blur(var(--blur));
  transition: filter .3s ease;
}
.veil {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(120% 70% at 50% 30%, rgba(0,0,0,0) 0%, rgba(0,0,0,.35) 100%),
    rgba(8, 7, 6, var(--dim));
}

/* top bar */
.bar {
  display: flex; align-items: center; gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) clamp(14px, 3vw, 28px) 0;
}
.mark { font: 600 17px/1 var(--serif); letter-spacing: .01em; opacity: .9; }
.bar-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.ghost {
  background: transparent; border: 1px solid transparent; border-radius: 999px;
  padding: 7px 12px; color: var(--body); cursor: pointer;
}
.ghost:hover { background: rgba(255,255,255,.08); color: var(--ink); }
.pill, .solid {
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  background: var(--ink); color: #15120f; border: 0; border-radius: 999px;
  padding: 8px 14px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.pill:hover, .solid:hover { background: #fff; }
.pill[hidden] { display: none; }

/* stage */
.stage {
  width: min(1040px, 100%); margin: 0 auto;
  padding: clamp(28px, 9vh, 96px) clamp(14px, 3vw, 28px) 48px;
  display: grid; gap: clamp(28px, 6vh, 56px);
}
.hello { display: grid; justify-items: center; text-align: center; gap: 6px; }
.clock {
  font: 400 clamp(76px, 15vw, 152px)/.95 var(--serif);
  letter-spacing: -.02em; font-variant-numeric: tabular-nums lining-nums;
  text-shadow: 0 2px 30px rgba(0,0,0,.35);
}
.clock small { font-size: .3em; letter-spacing: 0; margin-left: .2em; color: var(--body); }
.greet { margin: 4px 0 18px; color: var(--body); font-size: clamp(15px, 2vw, 18px); text-wrap: balance; }
.greet .dot { margin: 0 .5em; opacity: .5; }
.search {
  width: min(560px, 100%); display: flex; align-items: center; gap: 10px;
  padding: 0 16px; height: 50px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--hair);
  backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2);
}
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--mute); stroke-width: 2; stroke-linecap: round; flex: none; }
.search input { flex: 1; min-width: 0; height: 100%; min-height: 44px; background: none; border: 0; outline: 0; font-size: 16px; color: var(--ink); }
.search input::placeholder { color: var(--mute); }
.search:focus-within { border-color: rgba(242,180,90,.6); }

/* groups */
.dial { display: grid; gap: 16px; }
.groups { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.chip {
  border: 1px solid var(--hair); background: var(--glass); color: var(--body);
  border-radius: 999px; padding: 6px 14px; cursor: pointer;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.chip:not(.edit)[aria-pressed="true"] { background: var(--ink); color: #15120f; border-color: var(--ink); font-weight: 600; }
.chip.add, .chip.edit { color: var(--mute); background: transparent; border-style: dashed; }
.chip.edit[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); border-style: solid; }

/* tiles */
.tiles {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
}
.tile { position: relative; }
.tile a, .tile .addtile {
  display: grid; justify-items: center; align-content: center; gap: 10px;
  height: 112px; padding: 12px 8px; border-radius: var(--r);
  background: var(--glass); border: 1px solid var(--hair);
  backdrop-filter: blur(16px) saturate(1.15); -webkit-backdrop-filter: blur(16px) saturate(1.15);
  color: var(--ink); text-decoration: none; width: 100%; cursor: pointer;
  transition: transform .18s ease, background-color .18s ease, border-color .18s ease;
}
.tile a:hover { transform: translateY(-2px); background: rgba(30,27,24,.6); border-color: rgba(246,241,233,.26); }
.tile .ico {
  width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center;
  font: 600 20px/1 var(--serif); color: #15120f; overflow: hidden; position: relative;
}
.tile .ico img { width: 28px; height: 28px; position: absolute; inset: 8px; border-radius: 4px; background: #fff; }
.tile .name { font-size: 13px; color: var(--body); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .addtile { border-style: dashed; color: var(--mute); background: transparent; font-size: 13px; }
.tile .addtile b { font: 300 30px/1 var(--sans); }
.tile .edit-btn {
  position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--hair); background: var(--glass-strong); color: var(--ink); cursor: pointer; display: none;
}
.editing .tile .edit-btn { display: grid; place-items: center; }
.editing .tile a { animation: wob .5s ease-in-out infinite alternate; }
.tile.drag-over a { border-color: var(--accent); }
@keyframes wob { from { transform: rotate(-.6deg); } to { transform: rotate(.6deg); } }
.hint { margin: 0; text-align: center; color: var(--mute); font-size: 13px; min-height: 1.5em; }
.hint button { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 6px 4px; min-height: 28px; font: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* notes */
.notes {
  position: fixed; right: 16px; top: 64px; bottom: 16px; width: min(360px, calc(100% - 32px));
  display: flex; flex-direction: column; border-radius: var(--r);
  background: var(--glass-strong); border: 1px solid var(--hair);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 20px 60px rgba(0,0,0,.45); z-index: 5;
}
.notes[hidden] { display: none; }
/* Wide screens: make room for open notes instead of covering the tiles. */
@media (min-width: 900px) { body.notes-open .stage { width: min(1040px, calc(100% - 392px)); margin: 0 392px 0 0; transition: none; } }
.notes-head { display: flex; align-items: baseline; gap: 10px; padding: 14px 10px 6px 18px; }
.notes h2 { margin: 0; font: 600 20px/1.2 var(--serif); }
.saved { font-size: 12px; color: var(--mute); }
.close { margin-left: auto; }
.notes textarea {
  flex: 1; resize: none; border: 0; outline: 0; background: transparent; color: var(--ink);
  padding: 8px 18px 18px; font: 16px/1.6 var(--serif);
}

/* dialogs */
dialog.sheet {
  width: min(440px, calc(100% - 24px)); max-height: calc(100dvh - 24px);
  border: 1px solid var(--hair); border-radius: 18px; padding: 22px;
  background: #171411; color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
dialog.wide { width: min(560px, calc(100% - 24px)); }
dialog::backdrop { background: rgba(5,4,3,.55); backdrop-filter: blur(3px); }
dialog h2 { margin: 0 0 14px; font: 600 22px/1.2 var(--serif); }
dialog h3 { margin: 22px 0 8px; font-size: 13px; font-weight: 600; color: var(--accent); }
dialog label { display: grid; gap: 6px; margin: 0 0 12px; color: var(--body); font-size: 14px; }
dialog input[type=text], dialog select {
  width: 100%; height: 42px; padding: 0 12px; border-radius: var(--r-sm);
  border: 1px solid var(--hair); background: #0f0d0b; color: var(--ink); font-size: 16px;
}
dialog label.check { display: flex; align-items: center; gap: 10px; }
dialog label.check input { width: 18px; height: 18px; accent-color: var(--accent); }
dialog label.slider { grid-template-columns: 70px 1fr; align-items: center; }
dialog input[type=range] { accent-color: var(--accent); width: 100%; }
.row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.row.head { margin: 0; } .row.head h2 { margin: 0; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.danger { background: none; border: 0; color: var(--danger); cursor: pointer; padding: 7px 0; }
.small { font-size: 13px; color: var(--mute); margin: 0 0 8px; }
.filebtn {
  display: inline-flex !important; align-items: center; gap: 6px; margin: 0 !important; cursor: pointer; position: relative;
  background: var(--ink); color: #15120f !important; border-radius: 999px; padding: 8px 14px; font-weight: 600;
}
.filebtn.ghosty { background: transparent; color: var(--body) !important; border: 1px solid var(--hair); font-weight: 400; }
.filebtn input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.tag { font-style: normal; font-size: 11px; color: var(--accent); border: 1px solid currentColor; border-radius: 999px; padding: 0 6px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.sw {
  width: 52px; height: 36px; border-radius: 9px; border: 2px solid transparent; cursor: pointer;
  background-size: cover; background-position: center;
}
.sw[aria-pressed="true"] { border-color: var(--accent); }
.lede { color: var(--body); margin: 0 0 12px; }
.gets { margin: 0 0 18px; padding-left: 0; list-style: none; display: grid; gap: 8px; }
.gets li { padding-left: 22px; position: relative; color: var(--ink); }
.gets li::before { content: ""; position: absolute; left: 2px; top: .55em; width: 10px; height: 6px; border: solid var(--accent); border-width: 0 0 2px 2px; transform: rotate(-45deg); }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); opacity: 0;
  background: var(--ink); color: #15120f; padding: 10px 16px; border-radius: 999px; font-weight: 500;
  transition: opacity .2s, transform .2s; pointer-events: none; max-width: calc(100% - 32px); text-align: center; z-index: 20;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* FAQ + legal footer */
.faq { width: min(640px, 100%); margin: 0 auto; padding: 14px 18px; border-radius: var(--r); background: var(--glass-strong); border: 1px solid var(--hair); }
.faq h2 { margin: 0 0 6px; font: 600 18px/1.2 var(--serif); }
.faq summary { cursor: pointer; padding: 8px 0; color: var(--ink); }
.faq .privacy { margin: 0 0 4px; color: var(--body); font-size: 14px; }
.faq p { margin: 0 0 10px; color: var(--body); font-size: 14px; }
.legal { margin: 0 auto; padding: 8px clamp(14px, 3vw, 28px) 24px; max-width: 900px; text-align: center; font-size: 12px; line-height: 1.5; color: var(--body); text-shadow: 0 1px 2px #000; }
.legal a { color: inherit; display: inline-block; padding: 5px 2px; }
.restore { font-size: 13px; }
@media (max-width: 560px) {
  .lg { display: none; }
  .bar { gap: 8px; }
  .bar-actions { gap: 2px; }
  .bar .ghost { font-size: 14px; padding: 7px 8px; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .tile a, .tile .addtile { height: 96px; gap: 8px; }
  .tile .ico { width: 38px; height: 38px; }
  .tile .ico img { width: 24px; height: 24px; inset: 7px; }
  .bar .ghost { padding: 7px 9px; }
  .pill { padding: 7px 12px; font-size: 14px; }
  .notes { left: 8px; right: 8px; width: auto; top: auto; height: 62dvh; bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
