/* ============================================
   Phosphor Icon Font
   ============================================ */
@font-face {
  font-family: "Phosphor";
  src:
    url("./fonts/Phosphor.woff2") format("woff2"),
    url("./fonts/Phosphor.woff") format("woff"),
    url("./fonts/Phosphor.ttf") format("truetype"),
    url("./fonts/Phosphor.svg#Phosphor") format("svg");
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

.ph {
  /* use !important to prevent issues with browser extensions that change fonts */
  font-family: "Phosphor" !important;
  speak: never;
  font-style: normal;
  font-weight: normal;
  font-variant: normal;
  text-transform: none;
  line-height: 1;

  /* Enable Ligatures ================ */
  letter-spacing: 0;
  -webkit-font-feature-settings: "liga";
  -moz-font-feature-settings: "liga=1";
  -moz-font-feature-settings: "liga";
  -ms-font-feature-settings: "liga" 1;
  font-feature-settings: "liga";
  -webkit-font-variant-ligatures: discretionary-ligatures;
  font-variant-ligatures: discretionary-ligatures;

  /* Better Font Rendering =========== */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Phosphor Icon Classes */
.ph.ph-moon:before { content: "\e330"; }
.ph.ph-sun:before { content: "\e472"; }
.ph.ph-heart:before { content: "\e2a8"; }
.ph.ph-star:before { content: "\e46a"; }
.ph.ph-user:before { content: "\e4c2"; }
.ph.ph-check:before { content: "\e182"; }
.ph.ph-x:before { content: "\e4f6"; }
.ph.ph-arrow-right:before { content: "\e06c"; }
.ph.ph-arrow-left:before { content: "\e058"; }
.ph.ph-arrow-up:before { content: "\e08e"; }
.ph.ph-arrow-down:before { content: "\e03e"; }
.ph.ph-envelope:before { content: "\e214"; }
.ph.ph-github-logo:before { content: "\e576"; }
.ph.ph-linkedin-logo:before { content: "\e2ee"; }
.ph.ph-twitter-logo:before { content: "\e4ba"; }
.ph.ph-link:before { content: "\e2e2"; }
.ph.ph-calendar:before { content: "\e108"; }
.ph.ph-clock:before { content: "\e19a"; }
.ph.ph-map-pin:before { content: "\e316"; }
.ph.ph-book:before { content: "\e0e2"; }
.ph.ph-code:before { content: "\e1bc"; }
.ph.ph-file:before { content: "\e230"; }
.ph.ph-folder:before { content: "\e24a"; }
.ph.ph-list:before { content: "\e2f0"; }
.ph.ph-magnifying-glass:before { content: "\e30c"; }
.ph.ph-download:before { content: "\e20a"; }
.ph.ph-upload:before { content: "\e4be"; }
.ph.ph-gear:before { content: "\e270"; }
.ph.ph-warning:before { content: "\e4e0"; }
.ph.ph-info:before { content: "\e2ce"; }
.ph.ph-question:before { content: "\e3e8"; }
.ph.ph-plus:before { content: "\e3d4"; }
.ph.ph-minus:before { content: "\e32a"; }
.ph.ph-pencil:before { content: "\e3ae"; }
.ph.ph-trash:before { content: "\e4a6"; }
.ph.ph-chat:before { content: "\e15c"; }
.ph.ph-bell:before { content: "\e0ce"; }
.ph.ph-house:before { content: "\e2c2"; }
.ph.ph-briefcase:before { content: "\e0ee"; }
.ph.ph-graduation-cap:before { content: "\e62c"; }

/* Add more Phosphor icons as needed - the full set contains 1000+ icons */

/* ============================================
   CSS Custom Properties (CSS Variables)
   ============================================ */
:root {
    --colors--background: #F0EEE6;
    --colors--text: #2c2c2c;
    --colors--link: #3d3d3d;
    --colors--link-visited: #5a5a5a;
    --colors--link-active: #1a1a1a;
    --colors--link-hover: #1a1a1a;
    --colors--primary-accent: #0064ff;
    --colors--footnote-background: rgba(0, 100, 255, 0.1);
    --_layout---grid--gap-md: 2rem;
    --_layout---grid--gap-sm: 1rem;
}

/* Dark mode color scheme */
.u-mode-invert {
    --colors--background: #1a1a1a;
    --colors--text: #e0e0e0;
    --colors--link: #d4d4d4;
    --colors--link-visited: #b8b8b8;
    --colors--link-active: #ffffff;
    --colors--link-hover: #ffffff;
    --colors--footnote-background: rgba(107, 158, 255, 0.1);
}

/* ============================================
   Global Resets & Base Styles
   ============================================ */
* {
    box-sizing: border-box;
}

body {
    font-family: "Lora", "Georgia", "Times New Roman", serif;
    font-weight: 400;
    line-height: 1.7;
    color: var(--colors--text);
    background-color: var(--colors--background);
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,.01) 2px, rgba(0,0,0,.01) 4px),
        repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(0,0,0,.01) 2px, rgba(0,0,0,.01) 4px);
    margin: 0;
    padding: 20px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.u-mode-invert {
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,.008) 2px, rgba(255,255,255,.008) 4px),
        repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(255,255,255,.008) 2px, rgba(255,255,255,.008) 4px);
}

/* Reset apple form styles */
input, textarea, select, button {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 0;
    background-image: none;
}

/* Change selection color */
::selection {
    background-color: rgba(0, 100, 255, 0.26);
    color: inherit;
}

::-moz-selection {
    background-color: rgba(0, 100, 255, 0.26);
    color: inherit;
}

/* Adjust input autofill to brand colors */
input:-webkit-autofill,
input:-webkit-autofill:focus {
    background-color: var(--colors--background) !important;
    color: var(--colors--text) !important;
    border-color: var(--colors--text) !important;
    -webkit-box-shadow: 0 0 0 50px var(--colors--background) inset;
    -webkit-text-fill-color: var(--colors--text);
}

/* ============================================
   Layout
   ============================================ */
.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 25px 40px 80px;
    position: relative;
}

/* Row/col gap modifiers */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -1rem;
}

.row.row-gap-0 .col {
    margin: 0;
    padding: 0;
}

.row.row-gap-md .col {
    padding-left: calc(var(--_layout---grid--gap-md) / 2);
    padding-right: calc(var(--_layout---grid--gap-md) / 2);
}

.row.row-gap-sm .col {
    padding-left: calc(var(--_layout---grid--gap-sm) / 2);
    padding-right: calc(var(--_layout---grid--gap-sm) / 2);
}

.col {
    flex: 1;
    padding: 0 1rem;
}

/* ============================================
   Header
   ============================================ */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 50px;
}

.site-header h1 {
    margin: 0;
}

.site-title {
    text-decoration: none;
    border: none;
    color: var(--colors--text);
    padding-bottom: 0;
}

.site-title:visited {
    color: var(--colors--text);
}

.site-title:hover {
    border: none;
    opacity: 0.7;
    color: var(--colors--text);
}

.post-header {
    margin-bottom: 40px;
}

.back-link {
    text-decoration: none;
    border: none;
    opacity: 0.7;
    font-size: 0.95em;
    transition: opacity 0.2s ease;
}

.back-link:hover {
    opacity: 1;
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4 {
    text-wrap: balance;
}

h1 {
    font-size: 2.75em;
    font-weight: 600;
    letter-spacing: -0.04em;
    line-height: 1.1;
}

h2 {
    font-size: 24px;
    font-weight: 700;
    margin-top: 60px;
    margin-bottom: 20px;
    letter-spacing: -0.01em;
}

h2 a {
    color: var(--colors--text);
    text-decoration: none;
    border: none;
    padding-bottom: 0;
}

h2 a:visited {
    color: var(--colors--text);
}

h2 a:hover {
    border: none;
    opacity: 0.7;
    color: var(--colors--text);
}

h3 {
    font-size: 1.1em;
    font-weight: 500;
    margin-top: 30px;
    margin-bottom: 10px;
}

h4 {
    font-size: 1em;
    font-weight: 500;
    margin-top: 20px;
    margin-bottom: 10px;
}

p {
    margin-bottom: 20px;
    font-size: 18px;
    line-height: 1.75;
    font-weight: 300;
}

.bio {
    margin-bottom: 40px;
}

.bio p {
    margin-bottom: 20px;
    font-weight: 400;
    font-size: 18px;
}

.bio-extended {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease;
}

.bio-extended.expanded {
    max-height: 1000px;
    opacity: 1;
}

/* Loading states */
.loading-state {
    opacity: 0.6;
    font-style: italic;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.3; }
}

.key-statement {
    padding: 24px 0;
    margin: 32px 0 !important;
    border-left: 3px solid var(--colors--text);
    padding-left: 28px;
    font-size: 19px;
    font-weight: 400;
}

.key-statement em {
    font-style: italic;
    font-weight: 600;
    font-size: 1.05em;
}

/* Rich text modifiers */
.w-richtext > :first-child,
.rich-text > :first-child {
    margin-top: 0;
}

.w-richtext > :last-child,
.w-richtext ol li:last-child,
.w-richtext ul li:last-child,
.rich-text > :last-child,
.rich-text ol li:last-child,
.rich-text ul li:last-child {
    margin-bottom: 0;
}

/* Line clamp modifiers */
.u-text-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.u-text-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.u-text-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================
   Sections
   ============================================ */
section {
    margin-bottom: 50px;
}

section:last-child {
    margin-bottom: 120px;
}

/* Built/Building section with subtle background */
.projects-section {
    background-color: rgba(0, 0, 0, 0.015);
    padding: 40px;
    margin-left: -40px;
    margin-right: -40px;
    border-radius: 4px;
}

.u-mode-invert .projects-section {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Links section spacing */
.links-list a {
    margin-right: 24px;
}

.links-list a:last-child {
    margin-right: 0;
}

/* ============================================
   Lists
   ============================================ */
ul {
    list-style-type: square;
    padding-left: 25px;
    margin-top: 10px;
    margin-bottom: 20px;
}

ol {
    padding-left: 25px;
    margin-top: 10px;
}

li {
    margin-bottom: 12px;
    font-size: 18px;
    line-height: 1.8;
    font-weight: 300;
}

/* Custom bullet list */
.bullet-list {
    list-style: none;
    padding-left: 0;
}

.bullet-list_item::before {
    content: "•";
    font-size: 1em;
    margin-right: 0.3em;
    margin-left: -0.7em;
    display: inline-block;
}

/* ============================================
   Links
   ============================================ */
a {
    color: var(--colors--link);
    text-decoration: none;
    border-bottom: 1px solid var(--colors--link);
    transition: all 0.25s ease;
    padding-bottom: 1px;
}

a:visited {
    color: var(--colors--link-visited);
    border-bottom-color: var(--colors--link-visited);
}

a:hover {
    color: var(--colors--link-hover);
    border-bottom-color: var(--colors--link-hover);
    border-bottom-width: 2px;
    padding-bottom: 0px;
    opacity: 0.85;
}

a:active {
    color: var(--colors--link-active);
}

/* ============================================
   Dark/Light Mode Toggle
   ============================================ */
.theme-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    border: none;
    outline: none;
}

.toggle-switch:focus,
.toggle-switch:focus-visible {
    outline: none;
    box-shadow: none;
}

.toggle-checkbox {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-label {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--colors--background);
    border: 1.5px solid var(--colors--text);
    border-radius: 100px;
    transition: background-color 0.3s, border-color 0.3s;
}

.toggle-label:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 2px;
    background-color: var(--colors--text);
    transition: 0.2s;
    border-radius: 50%;
}

.toggle-label.has-transition:before {
    transition: 0.2s;
}

.toggle-checkbox:checked + .toggle-label {
    background-color: var(--colors--text);
    border-color: var(--colors--text);
}

.toggle-checkbox:checked + .toggle-label:before {
    transform: translateX(20px);
    background-color: var(--colors--background);
}

.toggle-switch:focus-within {
    outline: none;
    box-shadow: none;
}

.toggle-checkbox:focus {
    outline: none;
    box-shadow: none;
}

.toggle-checkbox:focus-visible {
    outline: none;
    box-shadow: none;
}

.toggle-checkbox:focus-visible + .toggle-label {
    outline: none;
    box-shadow: none;
}

/* Theme toggle icons */
.theme-icon {
    font-size: 1.2em;
    color: var(--colors--text);
    transition: opacity 0.3s ease;
}

.theme-icon.hidden {
    opacity: 0.3;
}

/* ============================================
   Custom Elements
   ============================================ */
/* Custom hr */
hr {
    border: none;
    height: auto;
    margin: 2em 0;
}

hr::after {
    content: "\2042";
    display: block;
    font-family: serif;
    font-weight: 200;
    font-size: 1.5em;
    margin: 0 auto;
    text-align: center;
    color: var(--colors--text);
}

/* ============================================
   Modal Dialogs
   ============================================ */
dialog.modal {
    border: 1px solid var(--colors--text);
    background-color: var(--colors--background);
    color: var(--colors--text);
    border-radius: 8px;
    padding: 2rem;
    max-width: 600px;
}

dialog.modal[open] {
    animation: fadein 400ms ease-out forwards;
}

dialog.modal::backdrop {
    background: color-mix(in srgb, var(--colors--text) 80%, transparent);
}

@keyframes fadein {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* ============================================
   Footnotes
   ============================================ */
[data-footnotes="body"] h1 sup:not(:has(.footnote-ref)) {
    top: -2em;
}

[data-footnotes="body"] h1 .footnote-tooltip sup {
    top: -0.5em;
}

[data-footnotes="body"] sup:not(:has(.footnote-ref)) {
    z-index: 1;
    background-color: var(--colors--footnote-background);
    border-radius: 4px;
    margin-left: 2px;
    margin-right: 2px;
    padding: 3px 3px 1px;
    font-size: 0.75rem;
    font-weight: 500;
    text-decoration: none;
    position: relative;
}

[data-footnotes="body"] .footnote-tooltip sup {
    background-color: transparent;
    border-radius: 0;
    margin: 0;
    padding: 0;
    font-size: 0.75rem;
    top: -0.5em;
}

/* ============================================
   Responsive Design
   ============================================ */
/* TOC Container Width Mods on Desktop */
@media screen and (min-width: 1230px) and (max-width: 1330px) {
    .toc-container {
        width: 25%;
    }
}

@media screen and (min-width: 992px) and (max-width: 1229px) {
    .toc-container {
        width: 20%;
    }
}

@media screen and (max-width: 768px) {
    body {
        font-size: 16px;
        padding: 16px;
    }

    .container {
        padding: 20px 20px 30px;
        max-width: 100%;
    }

    .projects-section {
        margin-left: -20px;
        margin-right: -20px;
        padding: 30px 20px;
    }

    .site-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 0;
        margin-bottom: 25px;
    }

    .post-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 0;
    }

    h1 {
        font-size: 2.2em;
        font-weight: 600;
        letter-spacing: -0.03em;
        line-height: 1.15;
    }

    h2 {
        font-size: 1.35em;
        font-weight: 700;
        margin-top: 40px;
        margin-bottom: 12px;
    }

    h3 {
        font-size: 1.05em;
    }

    p {
        font-size: 17px;
        line-height: 1.7;
    }

    li {
        font-size: 17px;
        line-height: 1.75;
    }

    ul, ol {
        padding-left: 22px;
        margin-top: 8px;
    }

    section {
        margin-bottom: 40px;
    }

    section:first-of-type {
        margin-top: 0;
    }

    .bio + section h2 {
        margin-top: 35px;
    }

    .toggle-switch {
        width: 42px;
        height: 22px;
    }

    .toggle-label:before {
        height: 16px;
        width: 16px;
        left: 2px;
        bottom: 2px;
    }

    .toggle-checkbox:checked + .toggle-label:before {
        transform: translateX(20px);
    }

    .theme-icon {
        display: none;
    }
}

@media screen and (max-width: 480px) {
    body {
        padding: 14px;
    }

    .container {
        padding: 16px 16px 24px;
    }

    .projects-section {
        margin-left: -16px;
        margin-right: -16px;
        padding: 24px 16px;
    }

    .site-header {
        margin-bottom: 20px;
    }

    h1 {
        font-size: 2em;
        font-weight: 600;
        letter-spacing: -0.025em;
        line-height: 1.2;
    }

    h2 {
        font-size: 1.3em;
        font-weight: 700;
        margin-top: 35px;
        margin-bottom: 10px;
    }

    p {
        font-size: 17px;
        line-height: 1.7;
    }

    li {
        font-size: 17px;
        line-height: 1.75;
        margin-bottom: 6px;
    }

    section {
        margin-bottom: 35px;
    }

    .bio + section h2 {
        margin-top: 30px;
    }

    .bio p {
        font-size: 17px;
    }
}
