/* Page layout, responsive grids, flat paper hierarchy and navigation shells. */
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
  scrollbar-gutter: stable;
}
html:has(#reader[open]) { overflow: hidden; }
body {
  position: relative;
  isolation: isolate;
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font: var(--text-body)/1.85 var(--font);
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  /* taste-skill-ignore: Soft radial ambient glows are explicit brief requirements. */ background: radial-gradient(ellipse at 4% 8%, var(--ambient-pink), transparent 58%), radial-gradient(ellipse at 94% 90%, var(--ambient-blue), transparent 62%);
}
::selection { background: var(--pink-soft); color: var(--pink-ink); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: transparent; }
a { color: inherit; text-decoration: none; }
a, button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; line-height: 1.42; font-weight: 600; }
h1, h2, .feature-copy h3, .profile-signature, .footer-farewell, .reader-content h2, .reader-content blockquote, .stamp-badge {
  font-family: var(--font-display);
}
h1 { font-size: var(--text-display); letter-spacing: .02em; line-height: 1.32; }
h2 { font-size: var(--text-h2); letter-spacing: .02em; }
h3 { font-size: var(--text-h3); letter-spacing: .01em; }
img { display: block; max-width: 100%; object-fit: cover; }
.icon { width: 18px; height: 18px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.wrap { width: 100%; margin: auto; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
/* taste-skill-ignore: Skip link overlay elevation. */ .skip { position: fixed; left: 20px; top: -100px; z-index: 50; background: var(--surface); padding: 10px 16px; border-radius: var(--r-sm); box-shadow: var(--card-shadow); }
.skip:focus { top: 12px; }

/* Sidebar */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 228px;
  padding: 28px 18px 22px;
  display: flex;
  flex-direction: column;
  background: transparent;
  z-index: 6;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px; }
.site-logo { width: 44px; height: 44px; flex-shrink: 0; border-radius: var(--r-sm); object-fit: cover; }
.brand-name { display: block; font-family: var(--font-display); font-size: 22px; font-weight: 600; line-height: 1.25; white-space: nowrap; }
.brand-name > span { display: block; font-family: var(--font); font-size: var(--text-xs); font-weight: 400; color: var(--muted); margin-top: 3px; }
.sidebar nav { display: grid; gap: 8px; margin-top: 30px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  font-size: var(--text-sm);
  color: var(--muted);
}
.nav-link.active { color: var(--accent); font-weight: 600; }
.nav-badge {
  margin-left: auto;
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  background: var(--note-surface);
  color: var(--muted);
}
.nav-link.active .nav-badge { background: var(--surface); color: var(--accent); }
.sidebar-bottom {
  margin-top: auto;
  padding: 18px 10px 0;
  display: grid;
  gap: 12px;
}
.sidebar-theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--note-surface);
  color: var(--muted);
  font-size: var(--text-xs);
}
.sidebar-bottom p { font-size: var(--text-xs); color: var(--muted); line-height: 1.75; }

/* Sticky Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  margin-left: 228px;
  max-width: 1240px;
  height: 68px;
  padding: 0 36px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-size: var(--text-sm);
}
.topbar.is-scrolled {
  background: var(--sheet-glass);
  /* taste-skill-ignore: Scrolled sticky topbar frosted glass. */ backdrop-filter: blur(12px);
  /* taste-skill-ignore: Scrolled sticky topbar frosted glass. */ -webkit-backdrop-filter: blur(12px);
  /* taste-skill-ignore: Scrolled sticky topbar elevation. */ box-shadow: 0 6px 24px rgb(92 118 137 / .08);
}
.mobile-brand, .mobile-nav { display: none; }
.breadcrumb { display: flex; align-items: center; gap: 10px; color: var(--muted); min-width: 0; }
.crumb-root { color: var(--text); font-weight: 500; white-space: nowrap; }
.crumb-sep { opacity: .45; }
#crumb-location { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 12px; }

/* Main Sheet: single flat paper layer (no full-sheet backdrop-filter) */
.reading-sheet {
  margin: 0 24px 36px 228px;
  max-width: 1240px;
  padding: 44px 48px 36px;
  /* taste-skill-ignore: Subtle edge belongs to the Sakura reading sheet. */ border: 1px solid var(--edge);
  border-radius: var(--r-lg);
  background: var(--sheet-surface);
  /* taste-skill-ignore: Requested subtle Sakura panel elevation. */ box-shadow: var(--panel-shadow);
}
.profile-sheet { min-height: calc(100svh - 104px); }

/* Profile 7:5 Two-Column Layout (flattened directly onto reading-sheet) */
.profile-home {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(248px, .92fr);
  column-gap: 44px;
  align-items: start;
}
.profile-intro { grid-column: 1; grid-row: 1; }
.profile-intro .hello { font-size: 18px; color: var(--text); margin-top: 14px; line-height: 1.85; max-width: 36em; }
.profile-letter {
  grid-column: 1;
  grid-row: 2;
  max-width: 36em;
  margin-top: 32px;
  font-size: var(--text-body);
  line-height: 2;
  letter-spacing: .015em;
}
.profile-letter > p { margin: 0 0 22px; }
.profile-invitation { padding-top: 4px; }
.profile-invitation p { margin-bottom: 14px; }
.profile-signature { display: flex; align-items: center; gap: 16px; margin-top: 26px; font-weight: 600; font-size: 20px; }
.profile-signature .identity-thread { margin: 0; width: 72px; height: 4px; }

/* Sticky Identity Card */
.profile-aside {
  grid-column: 2;
  grid-row: 1 / span 2;
  position: sticky;
  top: 86px;
  display: grid;
  gap: 18px;
}
.avatar-box {
  display: grid;
  justify-items: center;
  gap: 16px;
  padding: 26px 22px 22px;
  border-radius: var(--r-md);
  background: var(--card-surface);
  /* taste-skill-ignore: Tinted surface card shadow replaces nested borders. */ box-shadow: var(--card-shadow);
}

/* Articles Section */
.folder { margin-top: 68px; }
.section-top { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-note { font-size: var(--text-sm); color: var(--muted); }
.article-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 18px;
  margin-bottom: 24px;
}
.tabs-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.search-wrap { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.mobile-search-btn { display: none; }
.list-heading { display: flex; justify-content: space-between; align-items: baseline; margin: 32px 0 16px; }
.list-heading h3 { font-size: 18px; font-weight: 600; }
.list-heading > span { font-size: var(--text-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
#post-list { display: grid; gap: 14px; }
#post-list.post-list--daily { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
#post-list.post-list--whispers { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }

/* Footer */
footer { padding-top: 56px; }
.footer-sheet { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: start; }
.footer-farewell { font-size: 20px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.footer-sheet p { color: var(--muted); font-size: var(--text-sm); }
.footer-sheet .identity-thread { width: 84px; margin-top: 18px; transform-origin: center; }
.back-top { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm); color: var(--muted); min-height: 40px; padding: 6px 12px; border-radius: var(--r-pill); }
.footer-bottom {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding-top: 20px;
  /* taste-skill-ignore: Subtle section divider above copyright. */ border-top: 1px solid var(--line);
  font-size: var(--text-xs);
  color: var(--muted);
}

/* Large Screens */
@media (min-width: 1540px) {
  .reading-sheet { margin-right: auto; }
}
@media (min-width: 1600px) {
  .reading-sheet { padding-inline: 58px; }
}

/* Tablet & Small Laptop */
@media (max-width: 1150px) {
  .sidebar { width: 200px; padding-inline: 14px; }
  .topbar { margin-left: 200px; padding-inline: 28px; }
  .reading-sheet { margin: 0 18px 28px 200px; padding: 34px 32px; }
  .profile-home { column-gap: 30px; grid-template-columns: minmax(0, 1.35fr) minmax(228px, .9fr); }
}

/* Narrow Tablet: Collapse Sidebar & Show Floating Mobile Nav */
@media (max-width: 1023px) {
  .sidebar { display: none; }
  .topbar { margin: 0; padding: 0 22px; height: 68px; }
  .breadcrumb { display: none; }
  .mobile-brand { display: flex; align-items: center; gap: 10px; }
  .mobile-brand .site-logo { width: 38px; height: 38px; }
  .mobile-brand .brand-name { font-size: 19px; }
  .reading-sheet { margin: 0 14px 18px; padding: 30px 26px 34px; }
  body { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .mobile-nav, .mobile-nav.liquid-group {
    display: flex;
    position: fixed;
    left: 50%;
    right: auto;
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 10;
    width: min(390px, calc(100% - 24px));
    translate: -50% 0;
    padding: 5px;
    gap: 2px;
    justify-content: space-between;
    align-items: center;
    border-radius: var(--r-pill);
    /* taste-skill-ignore: Floating mobile pill glass belongs to the Sakura design brief. */ border: 1px solid var(--edge);
    background: var(--sheet-glass);
    /* taste-skill-ignore: Floating mobile pill glass belongs to the Sakura design brief. */ backdrop-filter: blur(14px);
    /* taste-skill-ignore: Floating mobile pill glass belongs to the Sakura design brief. */ -webkit-backdrop-filter: blur(14px);
    /* taste-skill-ignore: Floating mobile pill elevation. */ box-shadow: var(--pill-shadow);
  }
  .mobile-nav a, .mobile-nav button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 0;
    flex: 1;
    min-height: 44px;
    padding: 6px 10px;
    border-radius: var(--r-pill);
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
  }
  .mobile-nav .active { color: var(--accent); font-weight: 600; }
  #toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
}

@media (max-width: 959px) {
  .profile-home { grid-template-columns: 1fr; }
  .profile-intro { grid-column: 1; grid-row: auto; }
  .profile-aside {
    grid-column: 1;
    grid-row: auto;
    position: static;
    margin-top: 26px;
    grid-template-columns: minmax(220px, .9fr) minmax(0, 1.1fr);
    align-items: stretch;
  }
  .profile-letter { grid-column: 1; grid-row: auto; margin-top: 28px; max-width: none; }
}

/* Mobile */
@media (max-width: 767px) {
  html { scroll-padding-top: 66px; }
  .topbar { height: 64px; padding-inline: 16px; }
  .topbar.is-scrolled { height: 54px; }
  .search-trigger { display: none; }
  .reading-sheet { margin: 0 8px 10px; padding: 24px 16px 28px; border-radius: var(--r-md); }
  .profile-home { display: flex; flex-direction: column; gap: 0; }
  .profile-aside { display: contents; }
  .avatar-box { order: 1; padding: 18px 16px; margin-bottom: 22px; }
  .profile-intro { order: 2; }
  .profile-intro .hello { font-size: 16px; margin-top: 12px; }
  .becoming { order: 3; margin-top: 24px; }
  .profile-letter { order: 4; margin-top: 24px; line-height: 1.95; }
  .folder { margin-top: 48px; }
  .section-top { align-items: center; margin-bottom: 14px; }
  .section-note { display: none; }
  .article-toolbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-bottom: 20px; }
  .tabs-wrap { order: 2; width: 100%; }
  .search-wrap { order: 1; width: 100%; margin-left: 0; }
  .mobile-search-btn { display: grid; }
  .search-wrap:not(.is-open) { display: none; }
  .search-wrap.is-open .search { width: 100%; }
  #post-list.post-list--daily, #post-list.post-list--whispers { grid-template-columns: 1fr; }
  footer { padding-top: 40px; }
  .footer-sheet { grid-template-columns: 1fr; gap: 16px; }
  .back-top { justify-self: start; }
}

@media (max-width: 359px) {
  h1 { font-size: 26px; }
  .reading-sheet { margin-inline: 6px; padding: 20px 12px 24px; }
  .topbar { padding-inline: 12px; }
  .mobile-nav a, .mobile-nav button { padding: 6px 6px; font-size: 12px; }
}

/* taste-skill-ignore: Fallback for unsupported backdrop-filter. */ @supports not (backdrop-filter: blur(12px)) {
  .topbar.is-scrolled, .mobile-nav, .reader-controls { background: var(--surface); }
}
