@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #fcfcfc;
  --surface: #ffffff;
  --ink: #111111;
  --ink-muted: #6b6b6b;
  --border: #e5e5e5;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --touch-target: 44px;
  --radius: 4px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.5em;
  line-height: 1.2;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }

p { margin: 0 0 1em; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-lockup:hover {
  text-decoration: none;
  opacity: 0.85;
}

.brand-lockup img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.brand-lockup span {
  letter-spacing: -0.03em;
}

.header-search {
  flex: 1;
  min-width: 0;
}

.header-search form {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.header-search input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.9rem;
  min-width: 0;
}

.header-search input:focus {
  outline: none;
}

.header-search button {
  border: none;
  border-left: 1px solid var(--border);
  background: transparent;
  padding: 0 12px;
  min-height: var(--touch-target);
  cursor: pointer;
  color: var(--ink-muted);
  font-size: 1.1rem;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-target);
  height: var(--touch-target);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  font-size: 1.25rem;
  border: none;
  background: transparent;
  cursor: pointer;
}

.nav-icon:hover,
.nav-icon.active {
  background: var(--surface);
  text-decoration: none;
  box-shadow: inset 0 0 0 1px var(--border);
}

/* Legacy header (editorial pages) */
header:not(.site-header) {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

header:not(.site-header) .container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

header:not(.site-header) .logo a {
  font-weight: 700;
  font-size: 1.1rem;
}

header:not(.site-header) nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.9rem;
}

header:not(.site-header) .search-bar {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

header:not(.site-header) .search-bar input {
  border: none;
  padding: 8px 12px;
  font: inherit;
  background: var(--surface);
}

/* Main layouts */
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

main.wide {
  max-width: 1100px;
}

main.with-sidebar {
  max-width: 1200px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

@media (min-width: 992px) {
  main.with-sidebar {
    grid-template-columns: 1fr 300px;
    padding: 24px 16px 48px;
  }
}

.content-aside {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Feed grid */
.feed-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.feed-card {
  position: relative;
  aspect-ratio: 1;
  background: #e8e8e8;
  overflow: hidden;
  border: none;
  padding: 0;
  cursor: pointer;
  display: block;
  width: 100%;
  text-align: left;
}

.feed-card img,
.feed-card .placeholder-tile {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(100%);
  display: block;
}

.feed-card .placeholder-tile {
  background: linear-gradient(135deg, #ddd 0%, #aaa 100%);
}

.feed-card:hover img {
  opacity: 0.92;
}

.feed-card-meta {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
  color: #fff;
  font-size: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.feed-card-meta .likes {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Post detail */
.post-detail {
  max-width: 480px;
  margin: 0 auto;
}

.post-detail-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  filter: grayscale(100%);
  background: #e8e8e8;
  display: block;
}

.post-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 8px;
  border-bottom: 1px solid var(--border);
}

.post-detail-user {
  font-weight: 600;
  font-size: 0.95rem;
}

.post-detail-user span {
  color: var(--ink-muted);
  font-weight: 400;
}

.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 8px 14px;
  border-radius: 999px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  min-height: var(--touch-target);
}

.like-btn.liked {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.post-detail-caption {
  padding: 12px 0;
  font-size: 0.95rem;
}

.post-detail-date {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: var(--ink-muted);
}

/* Profile */
.profile-header {
  text-align: center;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.profile-header h1 {
  font-size: 1.25rem;
  margin-bottom: 4px;
}

.profile-header p {
  color: var(--ink-muted);
  font-size: 0.9rem;
  margin: 0;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.profile-grid .feed-card {
  aspect-ratio: 1;
}

/* Forms */
.search-bar {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.search-bar input {
  flex: 1;
  border: none;
  padding: 10px 12px;
  font: inherit;
  background: transparent;
}

.search-bar input:focus {
  outline: none;
}

.search-bar button {
  border: none;
  border-left: 1px solid var(--border);
  background: var(--ink);
  color: var(--bg);
  padding: 0 16px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.app-form {
  border: 1px solid var(--border);
  padding: 24px;
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 420px;
  margin: 0 auto;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink-muted);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  background: var(--bg);
}

.btn-primary {
  background: var(--ink);
  color: var(--bg);
  border: none;
  padding: 12px 20px;
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  width: 100%;
}

.btn-primary:hover {
  opacity: 0.9;
}

.demo-notice {
  font-size: 0.85rem;
  color: var(--ink-muted);
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

/* Editorial */
.article-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

article {
  border-bottom: 1px solid var(--border);
  padding-bottom: 2rem;
}

article img {
  width: 100%;
  height: auto;
  filter: grayscale(100%);
  margin-bottom: 12px;
}

article .meta {
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin-bottom: 12px;
}

.breadcrumb {
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin-bottom: 16px;
}

.breadcrumb a {
  color: var(--ink-muted);
}

.widget {
  border: 1px solid var(--border);
  padding: 16px;
  background: var(--surface);
  border-radius: var(--radius);
}

.widget h3 {
  margin-top: 0;
  font-size: 0.95rem;
}

.widget ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.widget li {
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.ai-summary {
  font-size: 0.9rem;
  color: var(--ink-muted);
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--ink);
  background: var(--surface);
  border-radius: var(--radius);
  margin: 0 0 24px;
}

.ai-summary strong {
  color: var(--ink);
}

.author-bio {
  border: 1px solid var(--border);
  padding: 16px;
  margin-top: 32px;
  border-radius: var(--radius);
  background: var(--surface);
}

.text-center { text-align: center; }

.alert-message {
  padding: 12px 16px;
  border: 1px solid var(--ink);
  background: var(--surface);
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.app-view[hidden] {
  display: none !important;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 32px 0 12px;
  color: var(--ink-muted);
}

.editorial-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.editorial-links a {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.editorial-links a:hover {
  border-color: var(--ink);
  text-decoration: none;
}

/* Footer */
footer,
.footer {
  border-top: 1px solid var(--border);
  background: var(--ink);
  color: #f0f0f0;
  padding: 32px 16px;
  margin-top: 48px;
}

.footer-container {
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
}

.compliance-quad {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 24px;
  margin-bottom: 16px;
}

.compliance-quad a {
  color: #ccc;
  font-size: 0.85rem;
}

.compliance-quad a:hover {
  color: #fff;
}

.copyright,
.disclaimer {
  font-size: 0.8rem;
  color: #999;
  margin: 8px 0 0;
}

/* Ads (EXEC-PROTOCOL CLS) */
.ad-top-banner {
  width: 100%;
  max-width: 970px;
  margin: 0 auto;
  min-height: 90px;
  background: #f5f5f5;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

@media (min-width: 768px) {
  .ad-top-banner {
    min-height: 250px;
  }
}

.ad-mid-article,
.ad-container {
  width: 100%;
  max-width: 336px;
  margin: 24px auto;
  min-height: 280px;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}

.ad-sticky-sidebar {
  display: none;
}

@media (min-width: 992px) {
  .ad-sticky-sidebar {
    display: block;
    position: sticky;
    top: 72px;
    width: 100%;
    min-height: 600px;
    background: #f5f5f5;
    border: 1px solid var(--border);
  }
}

.paypal-store {
  padding: 16px;
  border: 1px solid var(--border);
  text-align: center;
  border-radius: var(--radius);
  background: var(--surface);
}

/* Feed app shell (index) */
.feed-app {
  padding-bottom: var(--bottom-nav-h, 56px);
}

.feed-app .feed-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 12px 24px;
}

.feed-app .content-with-sidebar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 992px) {
  .feed-app .content-with-sidebar {
    grid-template-columns: 1fr 300px;
  }
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.app-header-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-title {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.app-header .header-search {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-target);
  height: var(--touch-target);
  color: var(--ink);
  flex: none;
}

.app-header .header-search:hover {
  opacity: 0.7;
  text-decoration: none;
}

.feed-tagline {
  text-align: center;
  font-size: 0.9rem;
  color: var(--ink-muted);
  margin: 0 0 16px;
}

.section-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-muted);
  margin: 28px 0 12px;
}

.editorial-links ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.view-title {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.view-sub {
  color: var(--ink-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.feed-empty {
  text-align: center;
  color: var(--ink-muted);
  padding: 32px 16px;
}

.feed-card {
  cursor: default;
}

.feed-card-media {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  background: #e8e8e8;
}

.feed-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(100%);
  display: block;
}

.feed-card-meta {
  position: static;
  background: transparent;
  color: var(--ink);
  padding: 8px 2px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.feed-username {
  font-size: 0.8rem;
  font-weight: 600;
}

.feed-username:hover {
  text-decoration: underline;
}

.feed-like-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--ink);
}

.feed-like-btn.liked {
  color: var(--ink);
  font-weight: 600;
}

.post-detail img {
  width: 100%;
  max-width: 480px;
  aspect-ratio: 1;
  object-fit: cover;
  filter: grayscale(100%);
  display: block;
  margin: 0 auto;
}

.post-detail figcaption {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 0;
}

.post-caption {
  margin: 12px 0;
  font-size: 0.95rem;
  line-height: 1.5;
}

.post-editorial {
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  filter: grayscale(100%);
  border: 1px solid var(--border);
}

.profile-bio,
.profile-stats,
.profile-note {
  font-size: 0.9rem;
  color: var(--ink-muted);
}

.profile-hub {
  text-align: center;
  padding: 24px 0;
}

.profile-hub .btn-primary {
  width: auto;
  display: inline-block;
  margin-top: 12px;
}

.btn-small {
  width: auto;
  padding: 8px 16px;
  font-size: 0.85rem;
}

.widget-copy {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-bottom: 12px;
}

.widget-fine {
  font-size: 0.65rem;
  color: var(--ink-muted);
}

.display-name {
  display: block;
  font-size: 0.8rem;
  color: var(--ink-muted);
  font-weight: 400;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 56px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.65rem;
  color: var(--ink-muted);
  padding: 6px 12px;
  min-width: var(--touch-target);
  text-decoration: none;
}

.bottom-nav a:hover {
  text-decoration: none;
  color: var(--ink);
}

.bottom-nav a.active {
  color: var(--ink);
  font-weight: 600;
}

.bottom-nav svg {
  display: block;
}

/* Legacy aliases */
.retro-btn,
button.retro-btn {
  background: var(--ink);
  color: var(--bg);
  border: none;
  padding: 12px 20px;
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
}

.panel-form,
.retro-form {
  border: 1px solid var(--border);
  padding: 24px;
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 420px;
  margin: 0 auto;
}

/* Remove legacy effects */
.screen-scanlines,
.newspaper-divider,
.stamp-classified,
.stamp-received {
  display: none !important;
}
