/* ── Retro style ─────────────────────────────────────────────────────────────
   A 1990s skin layered over main.css. Only loaded when `style: retro` is set
   in _config.yml, and every rule is scoped to html[data-style="retro"], so
   main.css is untouched and setting `style: modern` restores the normal site.

   Light theme: a hand-written 1996 homepage (gray background, Times, blue
   underlined links, beveled rules and tables).
   Dark theme: an MS-DOS screen (black, gray Courier, CGA cyan links). */

/* IBM VGA 8x16 text-mode font, used by the DOS theme.
   From The Ultimate Oldschool PC Font Pack by VileR (https://int10h.org/oldschool-pc-fonts/),
   licensed CC BY-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0/). */
@font-face {
    font-family: "IBM VGA";
    src: url("../fonts/WebPlus_IBM_VGA_8x16.woff") format("woff");
    font-display: swap;
}

/* Palette: light = Windows 95 gray homepage */
html[data-style="retro"] {
    --bg-primary: #c0c0c0;
    --bg-secondary: #d4d0c8;
    --bg-tertiary: #c0c0c0;
    --bg-hover: transparent;
    --text-primary: #000;
    --text-secondary: #000;
    --text-tertiary: #303030;
    --text-muted: #303030;
    --accent-primary: #0000ee;
    --accent-secondary: #551a8b;
    --accent-hover: #ff0000;
    --accent: #0000ee;
    --accent-bg: transparent;
    --border-primary: #808080;
    --border-secondary: #808080;
    --border-tertiary: #808080;
    --border-light: #808080;
    --code-bg: #ffffff;
    --code-border: #808080;
    --code-text: #000;
    --shadow-sm: transparent;
    --shadow-md: transparent;
    --link-blue: #0000ee;
    --link-blue-hover: #ff0000;

    --retro-font: "Times New Roman", Times, serif;
    --retro-mono: "Courier New", Courier, monospace;
    --retro-bevel-light: #ffffff;
    --retro-bevel-dark: #808080;
    --retro-panel: #ffffff;
}

/* Palette: dark = MS-DOS screen */
html[data-style="retro"][data-theme="dark"] {
    --bg-primary: #000;
    --bg-secondary: #000;
    --bg-tertiary: #000;
    --text-primary: #c0c0c0;
    --text-secondary: #c0c0c0;
    --text-tertiary: #a8a8a8;
    --text-muted: #a8a8a8;
    --accent-primary: #55ffff;
    --accent-secondary: #ff55ff;
    --accent-hover: #ffff55;
    --accent: #55ffff;
    --border-primary: #c0c0c0;
    --border-secondary: #c0c0c0;
    --border-tertiary: #808080;
    --border-light: #808080;
    --code-bg: #000;
    --code-border: #c0c0c0;
    --code-text: #ffff55;
    --link-blue: #55ffff;
    --link-blue-hover: #ffff55;

    --retro-font: "IBM VGA", "Courier New", Courier, monospace;
    --retro-mono: "IBM VGA", "Courier New", Courier, monospace;
    --retro-bevel-light: #c0c0c0;
    --retro-bevel-dark: #c0c0c0;
    --retro-panel: #000;
}

/* No rounded corners, shadows or glow anywhere: 1996 didn't have them */
html[data-style="retro"] *,
html[data-style="retro"] *::before,
html[data-style="retro"] *::after {
    border-radius: 0 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    transition: none !important;
}

/* Base typography */
html[data-style="retro"] body {
    font-family: var(--retro-font);
    font-size: 12pt;
    font-weight: 400;
    line-height: 1.4;
    padding-top: 0;
}

html[data-style="retro"] h1,
html[data-style="retro"] h2,
html[data-style="retro"] h3 {
    font-family: var(--retro-font);
    font-weight: bold;
    color: var(--text-primary);
}

html[data-style="retro"][data-theme="dark"] h1,
html[data-style="retro"][data-theme="dark"] h2,
html[data-style="retro"][data-theme="dark"] h3 {
    color: #ffffff;
}

/* Links: blue, underlined, red while clicking */
html[data-style="retro"] a {
    color: var(--accent-primary);
    text-decoration: underline;
}

html[data-style="retro"] a:visited {
    color: var(--accent-secondary);
}

html[data-style="retro"] a:hover {
    background: none;
    color: var(--accent-primary);
}

html[data-style="retro"] a:active {
    color: var(--accent-hover);
}

html[data-style="retro"] .page-content a,
html[data-style="retro"] .home-links a {
    border-bottom: none;
    font-weight: inherit;
}

html[data-style="retro"] .home-featured li a {
    color: var(--accent-primary);
    text-decoration: underline;
}

/* Block links (a whole list entry is one <a>): underline only the title */
html[data-style="retro"] a.course-note-entry {
    text-decoration: none;
}

html[data-style="retro"] a.course-note-entry .course-note-title {
    color: var(--accent-primary);
    text-decoration: underline;
}

html[data-style="retro"] a.course-note-entry .course-note-desc,
html[data-style="retro"] a.course-note-entry .note-order {
    color: var(--text-tertiary);
}

/* DOS has no hover color, so invert the cell instead */
html[data-style="retro"][data-theme="dark"] a:hover {
    background: var(--accent-primary);
    color: #000;
}

/* Header: not fixed, centered title, [ About | Projects | ... ] nav */
html[data-style="retro"] header {
    position: static;
    background: transparent;
    padding: 12px 16px 0;
}

html[data-style="retro"] .header-content {
    flex-direction: column;
    align-items: center;
    gap: 4px;
    max-width: 900px;
}

html[data-style="retro"] .site-name {
    font-size: 2em;
    font-weight: bold;
    color: var(--text-primary);
    text-decoration: none;
}

html[data-style="retro"] header nav {
    overflow: visible;
}

html[data-style="retro"] header nav ul {
    gap: 0;
    flex-wrap: wrap;
    justify-content: center;
}

html[data-style="retro"] header nav ul::before { content: "[\00a0"; }
html[data-style="retro"] header nav ul::after  { content: "\00a0]"; }
html[data-style="retro"] header nav li + li::before { content: "\00a0|\00a0"; }

html[data-style="retro"] header nav a {
    display: inline;
    padding: 0;
    color: var(--accent-primary);
    text-decoration: underline;
}

html[data-style="retro"] header nav a::after { display: none; }

html[data-style="retro"] header nav a:hover {
    transform: none;
    background: none;
}

html[data-style="retro"][data-theme="dark"] header nav a:hover {
    background: var(--accent-primary);
    color: #000;
}

/* Horizontal rules: the classic engraved groove */
html[data-style="retro"] hr,
html[data-style="retro"] header hr,
html[data-style="retro"] footer hr,
html[data-style="retro"] .page-content hr {
    height: 0;
    border: 0;
    border-top: 1px solid var(--retro-bevel-dark);
    border-bottom: 1px solid var(--retro-bevel-light);
    background: none;
    opacity: 1;
    margin: 1em 0;
}

html[data-style="retro"][data-theme="dark"] hr,
html[data-style="retro"][data-theme="dark"] header hr,
html[data-style="retro"][data-theme="dark"] footer hr,
html[data-style="retro"][data-theme="dark"] .page-content hr {
    border-top: 1px dashed #c0c0c0;
    border-bottom: 0;
}

html[data-style="retro"] main {
    max-width: 900px;
    padding: 16px;
}

/* Tables: border=1 */
html[data-style="retro"] table {
    border-collapse: separate;
    border-spacing: 2px;
    border: 2px outset var(--retro-bevel-light);
    background: var(--retro-panel);
    width: auto;
    max-width: 100%;
}

html[data-style="retro"] table th,
html[data-style="retro"] table td {
    border: 1px inset var(--retro-bevel-dark);
    padding: 3px 6px;
}

html[data-style="retro"] table thead tr,
html[data-style="retro"] table tbody tr {
    border: 0;
}

html[data-style="retro"][data-theme="dark"] table {
    border: 3px double #c0c0c0;
}

html[data-style="retro"][data-theme="dark"] table th,
html[data-style="retro"][data-theme="dark"] table td {
    border: 1px solid #808080;
}

/* Code: plain Courier, sunken white box for blocks */
html[data-style="retro"] code {
    font-family: var(--retro-mono);
    font-size: 0.95em;
    background: none;
    border: 0;
    padding: 0;
    color: var(--code-text);
}

html[data-style="retro"] pre {
    background: var(--code-bg);
    border: 2px inset var(--retro-bevel-dark);
    font-family: var(--retro-mono);
}

html[data-style="retro"][data-theme="dark"] pre {
    border: 3px double #c0c0c0;
}

/* Buttons and inputs: Windows 95 bevels in light, boxed in DOS */
html[data-style="retro"] button,
html[data-style="retro"] .form-submit,
html[data-style="retro"] .page-link-button,
html[data-style="retro"] .corner-palette-hint,
html[data-style="retro"] .corner-presence {
    font-family: Tahoma, "MS Sans Serif", Geneva, sans-serif;
    font-size: 12px;
    font-weight: normal;
    color: #000;
    background: #c0c0c0;
    border: 2px outset #ffffff;
    padding: 3px 10px;
    text-decoration: none;
    transform: none;
}

html[data-style="retro"] .page-link-button::before { display: none; }

html[data-style="retro"] button:hover,
html[data-style="retro"] .form-submit:hover,
html[data-style="retro"] .page-link-button:hover,
html[data-style="retro"] .corner-palette-hint:hover {
    color: #000 !important;
    background: #c0c0c0;
    border-color: #ffffff;
    transform: none;
}

html[data-style="retro"] button:active,
html[data-style="retro"] .form-submit:active,
html[data-style="retro"] .page-link-button:active,
html[data-style="retro"] .corner-palette-hint:active {
    border-style: inset;
}

html[data-style="retro"][data-theme="dark"] button,
html[data-style="retro"][data-theme="dark"] .form-submit,
html[data-style="retro"][data-theme="dark"] .page-link-button,
html[data-style="retro"][data-theme="dark"] .corner-palette-hint,
html[data-style="retro"][data-theme="dark"] .corner-presence {
    font-family: var(--retro-mono);
    color: #c0c0c0;
    background: #000;
    border: 1px solid #c0c0c0;
}

html[data-style="retro"][data-theme="dark"] button:hover,
html[data-style="retro"][data-theme="dark"] .form-submit:hover,
html[data-style="retro"][data-theme="dark"] .page-link-button:hover,
html[data-style="retro"][data-theme="dark"] .corner-palette-hint:hover {
    color: #000 !important;
    background: #c0c0c0;
    border-color: #c0c0c0;
}

html[data-style="retro"] input,
html[data-style="retro"] textarea,
html[data-style="retro"] select,
html[data-style="retro"] .search-input-wrapper {
    font-family: var(--retro-font);
    background: var(--retro-panel);
    color: var(--text-primary);
    border: 2px inset var(--retro-bevel-dark);
}

html[data-style="retro"][data-theme="dark"] input,
html[data-style="retro"][data-theme="dark"] textarea,
html[data-style="retro"][data-theme="dark"] select,
html[data-style="retro"][data-theme="dark"] .search-input-wrapper {
    border: 1px solid #c0c0c0;
}

/* Theme toggle: "MS-DOS Prompt" opens the DOS screen, "C:\>win" goes back
   to Windows. The emoji set by dark-mode.js is hidden (font-size: 0) and
   the label drawn by ::after; the button's aria-label is left as is. */
html[data-style="retro"] .dark-mode-toggle {
    width: auto;
    height: auto;
    padding: 4px 10px;
    font-size: 0;
}

html[data-style="retro"] .dark-mode-toggle::after {
    content: "MS-DOS Prompt";
    font-size: 12px;
    line-height: 1.2;
}

html[data-style="retro"][data-theme="dark"] .dark-mode-toggle::after {
    content: "C:\\>win";
}

html[data-style="retro"] .dark-mode-toggle:hover,
html[data-style="retro"] .dark-mode-toggle:active {
    transform: none;
}

/* VGA font renders crisp only at its native 16px with smoothing off */
html[data-style="retro"][data-theme="dark"] body {
    font-size: 16px;
    line-height: 1.25;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: unset;
}

/* ── Netscape on Windows 95 window (light theme) ────────────────────────── */

html[data-style="retro"] body {
    background-color: #008080;          /* the Windows 95 desktop */
}

html[data-style="retro"] .retro-window {
    max-width: 1040px;
    margin: 16px auto 40px;
    padding: 2px;
    background: #c0c0c0;
    border: 2px outset #ffffff;
    font-family: Tahoma, "MS Sans Serif", Geneva, sans-serif;
}

html[data-style="retro"] .retro-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 2px 3px 2px 6px;
    background: #000080;
    color: #ffffff;
    font-size: 12px;
    font-weight: bold;
}

html[data-style="retro"] .retro-title {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

html[data-style="retro"] .retro-winbtns {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

html[data-style="retro"] .retro-winbtns span {
    width: 16px;
    height: 14px;
    background: #c0c0c0;
    color: #000;
    border: 2px outset #ffffff;
    font-size: 10px;
    line-height: 9px;
    text-align: center;
}

html[data-style="retro"] .retro-winbtns span:last-child {
    margin-left: 2px;
}

html[data-style="retro"] .retro-menubar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 14px;
    padding: 3px 6px;
    font-size: 12px;
    cursor: default;
}

html[data-style="retro"] .retro-location {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 6px 4px;
    font-size: 12px;
    border-top: 1px solid #808080;
    box-shadow: inset 0 1px #ffffff;
}

html[data-style="retro"] .retro-location-field {
    flex: 1;
    min-width: 0;
    padding: 1px 4px;
    background: #ffffff;
    border: 2px inset #808080;
    font-family: "Courier New", Courier, monospace;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

html[data-style="retro"] .retro-viewport {
    background: var(--bg-primary);
    border: 2px inset #808080;
    font-family: var(--retro-font);
}

html[data-style="retro"] .retro-viewport main {
    min-height: 0;
}

/* ── DOS screen (dark theme): no window, just the prompt ────────────────── */

html[data-style="retro"][data-theme="dark"] body {
    background-color: #000;
}

html[data-style="retro"][data-theme="dark"] .retro-window {
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: #000;
    font-family: var(--retro-font);
}

html[data-style="retro"][data-theme="dark"] .retro-titlebar,
html[data-style="retro"][data-theme="dark"] .retro-menubar,
html[data-style="retro"][data-theme="dark"] .retro-location {
    display: none;
}

html[data-style="retro"][data-theme="dark"] .retro-viewport {
    border: 0;
}

html[data-style="retro"] .retro-prompt {
    display: none;
}

html[data-style="retro"][data-theme="dark"] .retro-prompt {
    display: block;
    max-width: 900px;
    margin: 0 auto;
    padding: 8px 16px 0;
    color: #c0c0c0;
    overflow-wrap: anywhere;
}

html[data-style="retro"] .retro-caret {
    display: inline-block;
    width: 0.6em;
    height: 0.15em;
    margin-left: 1px;
    background: #c0c0c0;
    vertical-align: baseline;
    animation: retro-blink 1.06s steps(1) infinite;
}

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

/* ── Footer: webring box, 88x31 buttons, last updated ───────────────────── */

html[data-style="retro"] .retro-webring {
    display: inline-block;
    margin: 0 auto 12px;
    padding: 8px 14px;
    background: var(--bg-secondary);
    border: 2px outset var(--retro-bevel-light);
    text-align: center;
}

html[data-style="retro"] .retro-webring-nav {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
}

html[data-style="retro"] a.retro-btn {
    display: inline-block;
    padding: 2px 10px;
    font-family: Tahoma, "MS Sans Serif", Geneva, sans-serif;
    font-size: 12px;
    color: #000;
    background: #c0c0c0;
    border: 2px outset #ffffff;
    text-decoration: none;
}

html[data-style="retro"] a.retro-btn:active {
    border-style: inset;
}

html[data-style="retro"][data-theme="dark"] .retro-webring {
    background: #000;
    border: 3px double #c0c0c0;
}

html[data-style="retro"][data-theme="dark"] a.retro-btn {
    font-family: var(--retro-font);
    font-size: 16px;
    color: #c0c0c0;
    background: #000;
    border: 0;
    text-decoration: underline;
}

html[data-style="retro"][data-theme="dark"] a.retro-btn:hover {
    color: #000;
    background: #c0c0c0;
}

html[data-style="retro"] .retro-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin: 12px 0 6px;
}

html[data-style="retro"] .retro-88 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 88px;
    height: 31px;
    border: 1px solid #000;
    font: bold 9px/1.05 Verdana, Tahoma, sans-serif;
    text-align: center;
    text-transform: uppercase;
    overflow: hidden;
}

html[data-style="retro"] .retro-88-netscape { background: linear-gradient(#22307a, #000020); color: #ffde59; }
html[data-style="retro"] .retro-88-jekyll   { background: #cc0000; color: #ffffff; }
html[data-style="retro"] .retro-88-res      { background: #ffffff; color: #000080; }
html[data-style="retro"] .retro-88-y2k      { background: #000000; color: #33ff33; }

html[data-style="retro"] .retro-updated {
    margin: 4px 0 0;
    font-size: 0.9em;
    font-style: italic;
}

/* The ⌘K and presence chips sit under the footer instead of floating at its
   left edge, which would collide with the taller retro footer */
html[data-style="retro"] .corner-controls {
    position: static;
    transform: none;
    justify-content: center;
    margin-top: 10px;
}

/* Footer: plain centered text */
html[data-style="retro"] footer {
    font-size: 10pt;
    margin-top: 24px;
}

html[data-style="retro"] .footer-uptime-dot {
    animation: none;
}

@media (prefers-reduced-motion: reduce) {
    html[data-style="retro"] .retro-caret { animation: none; }
}

@media (max-width: 768px) {
    html[data-style="retro"] body { padding-top: 0; }
    html[data-style="retro"] .retro-window { margin: 0; }
    html[data-style="retro"] .retro-menubar { display: none; }
    html[data-style="retro"] header nav { overflow: visible; }
    html[data-style="retro"] .dark-mode-toggle { width: auto; height: auto; font-size: 0; }
}
