/* === Window Chrome === */

.window-chrome {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg);
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot--close { background: var(--red); }
.dot--minimize { background: var(--yellow); }
.dot--maximize { background: var(--green); }

/* === Shell === */

/* Pin the page to the viewport on desktop so the only thing that can
   scroll is the paper itself. Mobile overrides this back to a normal
   scrolling document in responsive.css. */
html, body {
  height: 100vh;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-shell);
  font-size: 19px;
  /* Column flex so .shell can grow to fill the viewport without us
     having to hand-calc header + padding (the magic-number approach
     used to overshoot by ~70px and made the page scroll a little). */
  display: flex;
  flex-direction: column;
}

.shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px var(--space-xl) var(--space-2xl);
  flex: 1 1 auto;
  min-height: 0;
}

/* === Header === */

.shell__header {
  margin-bottom: var(--space-xl);
}

.shell__title {
  font-family: var(--font-shell);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg);
}

/* Blinking cursor */
.cursor::after {
  content: '\2588'; /* full block character */
  font-weight: 400;
  margin-left: 2px;
  animation: blink 1.3s step-end infinite;
  color: var(--fg-muted);
}

/* Hide cursor when a section is active */
.shell--active .cursor::after {
  display: none;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* === Body Layout === */

.shell__body {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  /* Fill the remaining vertical space inside .shell, after the header. */
  flex: 1 1 auto;
  min-height: 0;
  transition: grid-template-columns var(--duration-layout) var(--ease-out);
}

.shell--active .shell__body {
  grid-template-columns: 240px 1fr;
}

/* === Grid of Blocks === */

.shell__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
  gap: var(--space-lg);
  align-content: start;
  max-width: 720px;
}

.shell--active .shell__grid {
  grid-template-columns: 1fr;
  max-width: none;
  align-content: start;
  overflow-y: auto;
}

/* === Blocks === */

.block {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-xl) var(--space-lg);
  min-height: 200px;
  border: var(--border-width) solid var(--block-color, var(--fg-muted));
  background: transparent;
  cursor: pointer;
  transition:
    opacity var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
  opacity: var(--border-idle-opacity);
  position: relative;
}

.block:hover {
  opacity: 1;
}

.block:active {
  transform: scale(0.985);
}

/* Block-specific border colors */
.block--about   { --block-color: var(--red); }
.block--blog    { --block-color: var(--yellow); }
.block--potd    { --block-color: var(--purple); }
.block--lifecal { --block-color: var(--cyan); }

/* Active block — blinking border, keeps its own color */
.block--active {
  opacity: 1;
  animation: border-blink 1.3s step-end infinite;
}

@keyframes border-blink {
  50% { opacity: 0.25; }
}

.block__title {
  font-family: var(--font-shell);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}


/* In active sidebar mode — fixed small size, independent of content */
.shell--active .block {
  padding: var(--space-md);
  min-height: 0;
}


/* === Content Pane === */

.content-pane {
  display: none;
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-out) 0.1s;
}

.shell--active .content-pane {
  display: block;
  opacity: 1;
  /* Outer pane no longer scrolls — the inner paper does. Otherwise the
     scrollbar lands in the dead margin between the pane edge and the
     paper edge, outside the visual paper rectangle. */
  overflow: hidden;
  height: 100%;
  min-height: 0;
}

.content-pane__inner {
  /* The paper. Lighten the texture image with a translucent white wash
     so the grain reads soft beige rather than gray against the bg. */
  background-color: var(--bg-content);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0.45)),
    url('../assets/paper-texture.jpg');
  background-repeat: repeat;
  padding: var(--space-2xl);
  height: 100%;
  min-height: 0;
  /* Scroll inside the paper. x: hidden so wide content (figures, etc.)
     never produces a horizontal scrollbar. Thin styled scrollbar so it
     doesn't land as a heavy OS bar against the textured bg. */
  overflow: hidden auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(44, 37, 37, 0.25) transparent;
  box-shadow:
    /* soft ambient shadow */
    0 4px 40px rgba(44, 37, 37, 0.12),
    /* tighter drop shadow for depth */
    0 12px 28px -4px rgba(44, 37, 37, 0.18),
    /* subtle edge highlight (top/left) for paper lift */
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(44, 37, 37, 0.06);
  border-radius: 1px;
  position: relative;
}

/* All content sits above the texture */
.content-pane__inner > * {
  position: relative;
  z-index: 1;
}

/* Content typography (Cardo) */
.content-pane__inner {
  font-family: var(--font-content);
  font-size: 1.25rem;
  line-height: 1.7;
  color: var(--fg);
  max-width: 65ch;

  /* Hyphenation */
  hyphens: auto;
  -webkit-hyphens: auto;

  /* Microtypography */
  hanging-punctuation: first last;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  font-variant-numeric: oldstyle-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  /* Paragraph control */
  widows: 2;
  orphans: 2;
}

.content-pane__inner h1,
.content-pane__inner h2,
.content-pane__inner h3 {
  font-family: var(--font-content);
  font-weight: 700;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  line-height: 1.3;
}

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

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

.content-pane__inner p {
  margin-bottom: 1em;
}

.content-pane__inner a {
  color: var(--red);
  text-decoration: none;
  transition: color var(--duration-fast);
}

.content-pane__inner a:hover {
  color: var(--orange);
}

.content-pane__inner blockquote {
  margin: 1.5em 0;
  padding-left: var(--space-lg);
  border-left: 3px solid var(--fg-faint);
  font-style: italic;
  color: var(--fg-muted);
}

.content-pane__inner ul,
.content-pane__inner ol {
  margin-bottom: 1em;
  padding-left: 1.5em;
}

.content-pane__inner li {
  margin-bottom: 0.35em;
}

/* === About portrait === */

.about-portrait {
  float: right;
  margin: 0 0 var(--space-lg) var(--space-xl);
  max-width: 200px;
  height: auto;
  box-shadow:
    0 1px 1px rgba(44, 37, 37, 0.08),
    0 6px 10px rgba(44, 37, 37, 0.18),
    0 18px 28px -8px rgba(44, 37, 37, 0.28);
}
