/* ---------- reset (minimal) ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img { max-width: 100%; display: block; }

/* ---------- palette (AfterStep / X11 classic) ---------- */
:root {
  color-scheme: dark light;

  /* desktop (behind the window) — classic X11 slate */
  --desktop:     #3c526a;
  --desktop-2:   #4a617a;

  /* window frame — AfterStep steel gray */
  --frame:       #a8a8a8;
  --frame-hi:    #e6e6e6;   /* top/left highlight */
  --frame-lo:    #4a4a4a;   /* bottom/right shadow */
  --frame-fg:    #000000;

  /* titlebar — AfterStep "focused" steel blue */
  --title-bg:    #4a6a96;
  --title-hi:    #7a9ac0;
  --title-lo:    #24395a;
  --title-fg:    #ffffff;

  /* terminal screen */
  --bg:          #0a0a0a;
  --fg:          #ffd787;   /* bright amber, ~14:1 contrast */
  --muted:       #c8a96b;
  --rule:        #ffd787;
  --accent:      #ffcc00;
  --accent-soft: rgba(255, 204, 0, 0.12);

  --mono: ui-monospace, "SF Mono", "Menlo", "Consolas", "DejaVu Sans Mono", monospace;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

html, body {
  min-height: 100vh;
}

body {
  font-family: var(--mono);
  font-size: 14.5px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  background-color: var(--desktop);
  /* classic X11 "gray50" stipple pattern */
  background-image:
    linear-gradient(45deg, var(--desktop-2) 25%, transparent 25%, transparent 75%, var(--desktop-2) 75%),
    linear-gradient(45deg, var(--desktop-2) 25%, transparent 25%, transparent 75%, var(--desktop-2) 75%);
  background-size: 4px 4px;
  background-position: 0 0, 2px 2px;
  margin: 0;
  padding: 2.5rem 1rem 4rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* ---------- terminal window (AfterStep chrome) ---------- */
.terminal-window {
  width: 100%;
  max-width: 86ch;
  background: var(--frame);
  border-radius: 0;
  padding: 3px;
  /* outer 3D bevel: raised outset frame */
  box-shadow:
    inset  2px  2px 0 var(--frame-hi),
    inset -2px -2px 0 var(--frame-lo),
    0 8px 0 rgba(0, 0, 0, 0.35),
    0 18px 40px rgba(0, 0, 0, 0.55);
}

/* ---------- titlebar ---------- */
.titlebar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px;
  background: linear-gradient(var(--title-hi), var(--title-bg) 30%, var(--title-lo));
  color: var(--title-fg);
  user-select: none;
  /* inner bevel on the titlebar itself */
  box-shadow:
    inset  1px  1px 0 rgba(255, 255, 255, 0.25),
    inset -1px -1px 0 rgba(0, 0, 0, 0.45);
}

.titlebar .controls {
  display: flex;
  gap: 3px;
  flex: 0 0 auto;
}

.titlebar .control {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--frame);
  color: var(--frame-fg);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: default;
  /* beveled button */
  box-shadow:
    inset  1px  1px 0 var(--frame-hi),
    inset -1px -1px 0 var(--frame-lo);
}
.titlebar .control.close::before { content: "×"; font-size: 14px; }
.titlebar .control.min::before   { content: "_"; transform: translateY(-3px); }
.titlebar .control.max::before   { content: "▢"; font-size: 12px; }

.titlebar .title {
  flex: 1 1 auto;
  text-align: center;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- screen (the terminal well inside the frame) ---------- */
.screen {
  margin-top: 3px;
  padding: 1.6em 2.5ch 2.2em;
  background: var(--bg);
  /* inset bevel: the screen is recessed into the frame */
  box-shadow:
    inset  1px  1px 0 var(--frame-lo),
    inset -1px -1px 0 var(--frame-hi);
}

/* ---------- links ---------- */
a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
}
a:hover {
  background: var(--accent);
  color: var(--bg);
  border-bottom-color: transparent;
}

/* ---------- shared: terminal prompt ---------- */
.prompt {
  color: var(--muted);
  white-space: pre-wrap;
}
.prompt::before {
  content: "$ ";
  color: var(--accent);
}
.prompt .cmd { color: var(--fg); }

/* blinking block cursor */
.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1em;
  background: var(--fg);
  vertical-align: text-bottom;
  animation: blink 1.1s steps(2, start) infinite;
  margin-left: 0.2ch;
}
@keyframes blink { to { visibility: hidden; } }

/* ---------- finger(1) output (index.html) ---------- */
.finger .fields {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 2ch;
  row-gap: 0.15em;
  margin: 0.4em 0 0.9em;
}
.finger .fields dt {
  color: var(--muted);
}
.finger .fields dd {
  margin: 0;
  color: var(--fg);
}
.finger .section-label {
  color: var(--accent);
  font-weight: 600;
  margin-top: 0.9em;
}
.finger p {
  margin: 0.35em 0;
}
.finger .indent {
  padding-left: 2ch;
  margin-top: 0.1em;
}
.finger .see-also p {
  margin: 0.1em 0;
}
.finger .see-also a {
  color: var(--fg);
  border-bottom: 1px dotted var(--muted);
}
.finger .see-also a:hover {
  color: var(--bg);
  background: var(--accent);
  border-bottom-color: transparent;
}
.finger .see-also .comment { color: var(--muted); }

/* ---------- man(1) page (resume.html) ---------- */
.man {
  white-space: normal;
}

.man-header,
.man-footer {
  display: flex;
  justify-content: space-between;
  gap: 2ch;
  color: var(--fg);
  font-weight: 600;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.3em;
  margin-bottom: 1.2em;
}
.man-footer {
  border-bottom: none;
  border-top: 1px solid var(--rule);
  padding: 0.3em 0 0;
  margin: 2em 0 0;
  font-weight: 500;
}
.man-header .middle,
.man-footer .middle {
  color: var(--muted);
  font-weight: 500;
  text-align: center;
  flex: 1;
}

.man h2 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin: 1.6em 0 0.4em;
  color: var(--fg);
}

.man .body {
  padding-left: 5ch;   /* classic man-page indent */
  margin: 0;
}
.man .body p {
  margin: 0.5em 0;
}

/* tagged paragraph: a left-column tag, a right-column body */
.man dl.tagged {
  margin: 0;
  padding-left: 5ch;
}
.man dl.tagged dt {
  color: var(--fg);
  font-weight: 600;
  margin-top: 0.9em;
}
.man dl.tagged dd {
  margin: 0.1em 0 0 5ch;
  color: var(--fg);
}
.man dl.tagged dd .sub {
  color: var(--muted);
  font-style: normal;
}

/* option-style listing (used for certifications) */
.man dl.options {
  margin: 0;
  padding-left: 5ch;
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 3ch;
  row-gap: 0.1em;
}
.man dl.options dt {
  color: var(--accent);
  font-weight: 700;
}
.man dl.options dd {
  margin: 0;
  color: var(--fg);
}
.man dl.options dd .note { color: var(--muted); }

/* dmesg-style HISTORY block */
.man .dmesg-caption {
  color: var(--muted);
  margin: 0.4em 0 0.2em;
}
.man .dmesg-caption::before {
  content: "$ ";
  color: var(--accent);
}
pre.dmesg {
  margin: 0.4em 0 0.2em;
  padding: 0.2em 0 0.4em;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 0.92em;
  line-height: 1.45;
  white-space: pre;
  overflow-x: auto;
  tab-size: 4;
}
pre.dmesg .ts      { color: var(--muted); }
pre.dmesg .mod     { color: var(--accent); font-weight: 700; }
pre.dmesg .arr     { color: var(--muted); }
pre.dmesg .ttl     { color: var(--fg); font-weight: 600; }
pre.dmesg .loc     { color: var(--muted); }
pre.dmesg .current { color: var(--accent); font-weight: 700; }

/* apropos(1) page */
.apropos {
  white-space: normal;
}
.apropos dl.whatis {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 3ch;
  row-gap: 0.2em;
  margin: 0.6em 0 0.2em;
  padding-left: 2ch;
}
.apropos dl.whatis dt {
  color: var(--accent);
  font-weight: 700;
}
.apropos dl.whatis dd {
  margin: 0;
  color: var(--fg);
}
.apropos dl.whatis dd::before {
  content: "- ";
  color: var(--muted);
}

/* write(1) contact page */
.write-banner {
  color: var(--muted);
  font-style: italic;
}

/* SEE ALSO listing */
.man .seealso {
  padding-left: 5ch;
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 3ch;
  row-gap: 0.15em;
}
.man .seealso .ref { color: var(--accent); font-weight: 600; }
.man .seealso .desc { color: var(--muted); }
.man .seealso a {
  color: var(--fg);
  border-bottom: 1px dotted var(--muted);
}
.man .seealso a:hover {
  background: var(--accent);
  color: var(--bg);
  border-bottom-color: transparent;
}

/* ---------- AfterStep Wharf dock ---------- */
.wharf {
  position: fixed;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  z-index: 0;
  gap: 0;
}
.terminal-window {
  position: relative;
  z-index: 1;
}
.wharf-tile {
  width: 64px;
  height: 64px;
  background: var(--frame);
  box-shadow:
    inset  2px  2px 0 var(--frame-hi),
    inset -2px -2px 0 var(--frame-lo);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}
.wharf-tile:active {
  box-shadow:
    inset -2px -2px 0 var(--frame-hi),
    inset  2px  2px 0 var(--frame-lo);
}
.wharf-tile img {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
  -ms-interpolation-mode: nearest-neighbor;
}
.wharf-label {
  display: none;
  position: absolute;
  right: 68px;
  background: #ffffcc;
  color: #000;
  font-family: var(--sans);
  font-size: 11px;
  padding: 2px 6px;
  white-space: nowrap;
  border: 1px solid #999;
  box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}
.wharf-tile:hover .wharf-label {
  display: block;
}
.wharf-tile {
  position: relative;
}

/* hide Wharf on narrow screens where terminal fills viewport */
@media (max-width: 960px) {
  .wharf { display: none; }
}

/* ---------- print (resume -> PDF) ---------- */
@media print {
  .wharf { display: none; }
  :root {
    --desktop: #fff;
    --bg: #fff;
    --fg: #000;
    --muted: #444;
    --rule: #000;
    --accent: #000;
    --accent-soft: transparent;
  }
  body {
    display: block;
    background: #fff;
    padding: 0.5in 0.6in;
    font-size: 10pt;
    line-height: 1.4;
  }
  .terminal-window {
    box-shadow: none;
    border-radius: 0;
    max-width: none;
    background: #fff;
    padding: 0;
  }
  .titlebar { display: none; }
  .screen { padding: 0; background: #fff; box-shadow: none; margin: 0; }
  a { text-decoration: none; color: inherit; border-bottom: none; }
  .cursor { display: none; }
  .man dl.tagged dt { page-break-after: avoid; }
  .man dl.tagged dd { page-break-before: avoid; }
  pre.dmesg {
    font-size: 8pt;
    overflow: visible;
    white-space: pre-wrap;
    page-break-inside: auto;
  }
  pre.dmesg .ts,
  pre.dmesg .mod,
  pre.dmesg .loc,
  pre.dmesg .current { color: #000; }
}
