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

html {
  font-size: var(--ss-font-size);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--ss-font-mono);
  background: var(--ss-bg);
  color: var(--ss-text);
  line-height: var(--ss-line-height);
  height: 100vh;
  overflow: hidden;
}

a {
  color: var(--ss-link);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  color: var(--ss-link-hover);
  text-decoration: underline;
}

/* ── Terminal Window ──────────────────────────────────── */

.terminal {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--ss-bg);
}

.terminal__titlebar {
  position: relative;
  background: var(--ss-chrome-bg);
  border-bottom: 1px solid var(--ss-chrome-border);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  user-select: none;
  -webkit-user-select: none;
}

.theme-toggle {
  display: flex;
  gap: 2px;
  background: var(--ss-bg-tertiary);
  border-radius: 6px;
  padding: 2px;
}

.theme-toggle__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 24px;
  border: none;
  border-radius: 4px;
  background: none;
  color: var(--ss-text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.theme-toggle__btn:hover {
  color: var(--ss-text);
}

.theme-toggle__btn--active {
  background: var(--ss-bg-secondary);
  color: var(--ss-accent);
}

.terminal__title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8rem;
  color: var(--ss-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.terminal__nav {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.terminal__nav-link {
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--ss-text-muted);
  transition: all 0.15s;
  text-decoration: none;
}

.terminal__nav-link:hover {
  background: var(--ss-bg-tertiary);
  color: var(--ss-text);
  text-decoration: none;
}

.terminal__nav-link--active {
  background: var(--ss-bg-tertiary);
  color: var(--ss-accent);
}

/* ── Terminal Body ────────────────────────────────────── */

.terminal__body {
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: var(--ss-font-size);
  line-height: var(--ss-line-height);
}

.terminal__output::-webkit-scrollbar {
  width: 8px;
}

.terminal__output::-webkit-scrollbar-track {
  background: var(--ss-scrollbar-track);
}

.terminal__output::-webkit-scrollbar-thumb {
  background: var(--ss-scrollbar-thumb);
  border-radius: 4px;
}

/* ── Terminal Output ──────────────────────────────────── */

.terminal__output {
  padding: 1.5rem;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--ss-scrollbar-thumb) var(--ss-scrollbar-track);
}

.terminal__line {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.terminal__line--ascii {
  color: var(--ss-accent);
  line-height: 1.2;
  text-align: center;
}

.banner,
.post-banner {
  white-space: pre;
  font-family: inherit;
  line-height: 1.15;
  text-align: center;
  padding: 0.5rem 0;
  background: none;
  border: none;
  overflow-x: auto;
}

.terminal__line--system {
  color: var(--ss-text-muted);
  text-align: center;
}

.terminal__line--error {
  color: var(--ss-red);
}

/* ── Prompt ───────────────────────────────────────────── */

.terminal__prompt-line {
  display: flex;
  align-items: center;
  padding: 4px 1.5rem;
}

.terminal__prompt {
  color: var(--ss-prompt-user);
  white-space: nowrap;
  flex-shrink: 0;
}

.terminal__prompt-separator {
  color: var(--ss-prompt-separator);
  margin: 0 2px;
}

.terminal__prompt-path {
  color: var(--ss-prompt-path);
  margin-right: 8px;
}

.terminal__input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--ss-text);
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  caret-color: var(--ss-cursor);
  padding: 0;
}

/* ── Content Styling ──────────────────────────────────── */

.content {
  padding: 1.5rem;
}

.content h1, .content h2, .content h3,
.content h4, .content h5, .content h6 {
  color: var(--ss-text-bright);
  margin: 1.5em 0 0.5em 0;
  line-height: 1.3;
}

.content h1:first-child, .content h2:first-child {
  margin-top: 0;
}

.content h1 { font-size: 1.6rem; }
.content h2 { font-size: 1.3rem; }
.content h3 { font-size: 1.1rem; }

.content p {
  margin: 0.8em 0;
}

.content ul, .content ol {
  margin: 0.8em 0;
  padding-left: 1.5em;
}

.content li {
  margin: 0.3em 0;
}

.content strong {
  color: var(--ss-text-bright);
}

.content code {
  background: var(--ss-code-bg);
  border: 1px solid var(--ss-code-border);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

.content pre {
  background: var(--ss-code-bg);
  border: 1px solid var(--ss-code-border);
  border-radius: 6px;
  padding: 1rem;
  margin: 1em 0;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--ss-scrollbar-thumb) var(--ss-code-bg);
}

.content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
}

.content blockquote {
  border-left: 3px solid var(--ss-accent);
  padding-left: 1rem;
  color: var(--ss-text-muted);
  margin: 1em 0;
}

.content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 1em 0;
}

.content hr {
  border: none;
  border-top: 1px solid var(--ss-chrome-border);
  margin: 2em 0;
}

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
}

.content th, .content td {
  border: 1px solid var(--ss-chrome-border);
  padding: 8px 12px;
  text-align: left;
}

.content th {
  background: var(--ss-bg-secondary);
  color: var(--ss-text-bright);
}

/* ── Blog List ────────────────────────────────────────── */

.post-list {
  list-style: none;
  padding: 0;
}

.post-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--ss-bg-tertiary);
}

.post-item:last-child {
  border-bottom: none;
}

.post-item__header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.post-item__date {
  color: var(--ss-green);
  font-size: 0.85rem;
  white-space: nowrap;
}

.post-item__title {
  font-size: 1.1rem;
}

.post-item__title a {
  color: var(--ss-text-bright);
}

.post-item__meta {
  display: flex;
  gap: 0.8rem;
  margin-top: 0.3rem;
  font-size: 0.8rem;
  color: var(--ss-text-muted);
}

.post-item__description {
  margin-top: 0.3rem;
  color: var(--ss-text-muted);
  font-size: 0.9rem;
}

/* ── Tags ─────────────────────────────────────────────── */

.tag {
  display: inline-block;
  background: var(--ss-tag-bg);
  color: var(--ss-tag-text);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  text-decoration: none;
  transition: opacity 0.15s;
}

.tag:hover {
  opacity: 0.8;
  text-decoration: none;
  color: var(--ss-tag-text);
}

.tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ── Post Header ──────────────────────────────────────── */

.post-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--ss-bg-tertiary);
}

.post-header__title {
  font-size: 1.6rem;
  color: var(--ss-text-bright);
  margin: 0 0 0.5rem 0;
}

.post-header__meta {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  color: var(--ss-text-muted);
  font-size: 0.85rem;
}

/* ── Footer ───────────────────────────────────────────── */

.footer {
  padding: 1.5rem;
  text-align: center;
  color: var(--ss-text-muted);
  font-size: 0.75rem;
  border-top: 1px solid var(--ss-chrome-border);
  margin-top: auto;
}

.footer a {
  color: var(--ss-text-muted);
}

.footer a:hover {
  color: var(--ss-text);
}

.footer__links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 0.5rem;
}

/* ── LS Output ────────────────────────────────────────── */

.ls-output {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--ls-col-width, 180px), 1fr));
  gap: 2px 1rem;
}

.ls-item {
  cursor: pointer;
  color: var(--ss-accent);
  text-decoration: none;
}

.ls-item:hover {
  text-decoration: underline;
}

.ls-item--dir {
  color: var(--ss-accent);
  font-weight: bold;
}

.ls-item--dir::after {
  content: '/';
}

.ls-item--file {
  color: var(--ss-text);
}

/* ── Responsive ───────────────────────────────────────── */

@media (max-width: 768px) {
  .terminal__nav {
    display: none;
  }

  .post-item__header {
    flex-direction: column;
    gap: 0.2rem;
  }
}

/* ── Cursor Blink ─────────────────────────────────────── */

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.terminal__input:focus {
  outline: none;
}

.terminal__input::placeholder {
  color: var(--ss-text-muted);
  opacity: 0.5;
}

/* ── Selection ────────────────────────────────────────── */

::selection {
  background: var(--ss-accent);
  color: var(--ss-bg);
}
