/* Logical Self OS · public edition.
   The same content as the home page, arranged as a small desktop.
   Phone: a home screen of apps; each window is a :target sheet with a real URL.
   Desktop: windows on a desktop, draggable with os.js, readable without it. */
:root {
  color-scheme:light;
  --paper:#f7f5ef;
  --ink:#292923;
  --muted:#646259;
  --line:#d9d6cc;
  --accent:#a3462c;
  --panel:#fbfaf6;
  --serif:Georgia,"Noto Serif CJK SC","Source Han Serif SC","Songti SC",serif;
  --sans:system-ui,"Microsoft YaHei","PingFang SC","Hiragino Sans",sans-serif;
  --bar:38px;
}

* { box-sizing:border-box; }

html { -webkit-text-size-adjust:100%; }

body {
  margin:0;
  min-height:100vh;
  background:var(--paper);
  background-image:radial-gradient(#d9d6cc 1px,transparent 1px);
  background-size:22px 22px;
  color:var(--ink);
  font-family:var(--sans);
  font-size:16px;
  line-height:1.7;
}

a { color:inherit; text-decoration:none; }
a:hover { color:var(--accent); }
a:focus-visible, summary:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }

.skip-link { position:fixed; left:12px; top:-60px; z-index:99; background:var(--ink); color:var(--paper); padding:8px 12px; }
.skip-link:focus { top:8px; }

/* Menu bar */
.menubar {
  position:sticky;
  top:0;
  z-index:50;
  height:var(--bar);
  display:flex;
  align-items:center;
  gap:16px;
  padding:0 max(14px,env(safe-area-inset-left));
  background:color-mix(in srgb,var(--paper) 88%,transparent);
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
  border-bottom:1px solid var(--line);
  font-size:13px;
}
.mb-home { display:flex; align-items:center; gap:8px; white-space:nowrap; }
.mb-home b { font-weight:600; }
.mb-home span { color:var(--muted); }
.mb-lang { display:flex; gap:10px; margin-left:auto; }
.mb-lang a { color:var(--muted); }
.mb-lang a[aria-current="page"] { color:var(--ink); font-weight:600; }
.mb-clock { font-variant-numeric:tabular-nums; color:var(--muted); min-width:3.2em; text-align:right; }
.mb-lang a { white-space:nowrap; }
/* Narrow phones: keep the bar on one line by dropping, as space runs out,
   the English edition label, then the clock, then any edition label. */
@media(max-width:429px) { html:lang(en) .mb-home span { display:none; } }
@media(max-width:374px) { .menubar { gap:12px; } .mb-clock { display:none; } }
@media(max-width:340px) { .mb-home span { display:none; } }

/* Apps */
.app { display:flex; flex-direction:column; align-items:center; gap:6px; text-align:center; }
.app-icon {
  position:relative;
  display:grid;
  place-items:center;
  width:62px;
  height:62px;
  border-radius:16px;
  overflow:hidden;
  background:var(--bg,#fff);
  box-shadow:0 1px 0 #fff8 inset,0 4px 14px #29292322;
  transition:transform .2s ease;
}
.app-icon img, .app-icon video { width:100%; height:100%; object-fit:cover; }
.app-icon video { position:absolute; inset:0; opacity:0; transition:opacity .4s; }
.app.is-live .app-icon video { opacity:1; }
.app:hover .app-icon { transform:translateY(-2px); }
.app-name { font-size:12px; line-height:1.3; max-width:84px; }

.glyph { background:var(--panel); color:var(--ink); font-size:26px; }
.glyph::before { line-height:1; }
.glyph-about::before { content:"◐"; color:var(--accent); }
.glyph-works::before { content:"▦"; }
.glyph-shipped::before { content:"↗"; color:var(--accent); }
.glyph-notes::before { content:"≡"; }
.glyph-contact::before { content:"✉"; }

/* Windows */
.win {
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:12px;
  box-shadow:0 18px 50px #29292324,0 2px 6px #2929231a;
  overflow:hidden;
}
.win-bar {
  display:flex;
  align-items:center;
  gap:10px;
  height:36px;
  padding:0 12px;
  border-bottom:1px solid var(--line);
  background:#f1efe7;
  user-select:none;
}
.win-bar h2 { margin:0; font-size:13px; font-weight:600; letter-spacing:.3px; }
.win-close { width:12px; height:12px; border-radius:50%; background:var(--accent); opacity:.85; flex:none; }
.win-close:hover { opacity:1; }
.win-body { padding:18px 20px 22px; }
.win-body > :first-child { margin-top:0; }
.win-body p { margin:0 0 12px; }
.eyebrow { color:var(--muted); font-size:13px; }
.hello { font-family:var(--serif); font-size:28px; line-height:1.35; margin:0 0 10px; }
.hello span { color:var(--accent); }
.lede { font-family:var(--serif); font-size:18px; }
.email { color:var(--accent); border-bottom:1px solid var(--accent); }

.work-list, .note-list, .win-body ol { list-style:none; margin:0; padding:0; }
.work-list li { display:grid; grid-template-columns:62px 1fr; gap:16px; padding:14px 0; border-bottom:1px solid var(--line); }
.work-list li:first-child { padding-top:0; }
.work-list li:last-child { border-bottom:0; }
.work-list .app-name { display:none; }
.work-list h3 { margin:0 0 4px; font-size:16px; }
.work-list h3 span { font-weight:400; color:var(--muted); font-size:14px; }
.work-list p { font-size:14px; color:#4d4c45; margin:0; }
.work-list .kind { font-size:12px; color:var(--muted); margin-bottom:2px; }
.note-list li { padding:12px 0; border-bottom:1px solid var(--line); }
.note-list li:last-child { border-bottom:0; }
.note-list span { color:var(--accent); font-family:var(--serif); font-style:italic; font-size:13px; }
.note-list h3 { margin:2px 0 4px; font-family:var(--serif); font-weight:400; font-size:18px; }
.note-list p { font-size:14px; color:#4d4c45; margin:0; }
.win-body ol:not(.note-list) li, .widget li { display:grid; grid-template-columns:80px 1fr; gap:10px; padding:6px 0; font-size:14px; }
.win-body time, .widget time { color:var(--muted); font-size:12px; padding-top:2px; font-variant-numeric:tabular-nums; }

/* Dock */
.dock {
  position:fixed;
  left:50%;
  bottom:max(14px,env(safe-area-inset-bottom));
  transform:translateX(-50%);
  z-index:40;
  display:flex;
  gap:4px;
  padding:6px;
  background:color-mix(in srgb,var(--panel) 85%,transparent);
  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);
  border:1px solid var(--line);
  border-radius:16px;
  box-shadow:0 10px 30px #29292320;
}
.dock a { display:flex; flex-direction:column; align-items:center; gap:2px; padding:6px 10px; border-radius:10px; font-size:11px; color:var(--muted); }
.dock a:hover, .dock a.is-front { background:#ece9df; color:var(--ink); }
.dock .glyph { width:28px; height:28px; display:grid; place-items:center; font-size:18px; background:none; }
.dock-home img { width:28px; height:28px; padding:3px; }

.os-foot { position:fixed; right:16px; bottom:16px; z-index:30; background:var(--panel); border:1px solid var(--line); border-radius:10px; padding:8px 12px 0; }
.os-foot .entrances { --ink:#292923; --muted:#646259; }

/* ---------- Desktop ---------- */
@media(min-width:900px) {
  body { overflow-x:hidden; }
  .desktop { position:relative; height:calc(100vh - var(--bar)); min-height:640px; }
  .screen { position:absolute; left:24px; top:24px; width:200px; }
  .widget { display:none; }
  .grid { display:grid; grid-template-columns:repeat(2,1fr); gap:22px 12px; }
  .grid .app.sys { display:none; }
  .windows { position:absolute; inset:0; pointer-events:none; }
  .win { position:absolute; pointer-events:auto; max-height:calc(100% - 110px); display:flex; flex-direction:column; }
  .win-body { overflow:auto; }
  .win-bar { cursor:grab; }
  .win.is-dragging .win-bar { cursor:grabbing; }
  .win.is-closed { display:none; }
  .win:target, .win.is-front { box-shadow:0 24px 64px #2929233a,0 0 0 1px var(--accent); }
  #about { left:250px; top:32px; width:400px; z-index:3; }
  #works { left:max(470px,36vw); top:86px; width:min(520px,40vw); height:min(560px,calc(100% - 140px)); z-index:4; }
  #shipped { right:24px; top:28px; width:320px; z-index:2; }
  #notes { left:280px; top:360px; width:420px; max-height:max(200px,calc(100% - 460px)); z-index:1; }
  #contact { right:60px; top:330px; width:320px; z-index:1; }
}

@media(min-width:900px) and (max-width:1180px) {
  #works { left:44vw; width:52vw; }
  #shipped { top:auto; bottom:110px; right:auto; left:250px; }
}

/* ---------- Phone ---------- */
@media(max-width:899px) {
  .desktop { padding:18px 16px 140px; }
  .widget {
    background:var(--panel);
    border:1px solid var(--line);
    border-radius:18px;
    padding:14px 16px 10px;
    margin:0 0 24px;
    box-shadow:0 6px 20px #2929231a;
  }
  .widget-t { margin:0 0 4px; font-size:12px; color:var(--muted); letter-spacing:.4px; }
  .widget ol { list-style:none; margin:0; padding:0; }
  .widget-more { display:block; text-align:right; font-size:13px; color:var(--accent); padding:4px 0; }
  .grid { display:grid; grid-template-columns:repeat(4,1fr); gap:20px 6px; justify-items:center; }
  .windows .win { display:none; }
  .windows .win:target {
    display:flex;
    flex-direction:column;
    position:fixed;
    inset:var(--bar) 0 0 0;
    z-index:60;
    border-radius:0;
    border:0;
    animation:sheet .22s ease-out;
  }
  .win-bar { height:46px; padding:0 16px; }
  .win-close { width:auto; height:auto; border-radius:0; background:none; opacity:1; color:var(--accent); font-size:15px; }
  .win-close::before { content:"‹  "; }
  .win-close::after { content:attr(aria-label); font-size:14px; }
  .win-bar h2 { margin-left:auto; }
  .win-body { overflow:auto; flex:1; padding-bottom:40px; }
  .dock { display:none; }
  .os-foot { position:static; margin:0 16px 40px; }
}

@keyframes sheet { from { transform:translateY(24px); opacity:0; } to { transform:none; opacity:1; } }

@media(prefers-reduced-motion:reduce) {
  .windows .win:target { animation:none; }
  .app-icon, .app-icon video { transition:none; }
}
