@font-face {
    font-family: "Atkinson Hyperlegible Next";
    src: url("/static/fonts/atkinson-hyperlegible-next/AtkinsonHyperlegibleNext-Regular.woff2")
        format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Atkinson Hyperlegible Next";
    src: url("/static/fonts/atkinson-hyperlegible-next/AtkinsonHyperlegibleNext-RegularItalic.woff2")
        format("woff2");
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: "Atkinson Hyperlegible Next";
    src: url("/static/fonts/atkinson-hyperlegible-next/AtkinsonHyperlegibleNext-Bold.woff2")
        format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Atkinson Hyperlegible Next";
    src: url("/static/fonts/atkinson-hyperlegible-next/AtkinsonHyperlegibleNext-BoldItalic.woff2")
        format("woff2");
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}

:root {
    --bg-primary: #f5f5f5;
    --bg-secondary: #e8e8e8;
    --text-primary: #333;
    --text-secondary: #666;
    --accent: #ff6b35;
    --accent-hover: #ff8555;
    --accent-active: #e55525;
    --border: #ddd;
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2a2a2a;
    --text-primary: #e0e0e0;
    --text-secondary: #aaa;
    --accent: #ff8555;
    --accent-hover: #ff9f75;
    --accent-active: #ff6b35;
    --border: #444;
}

html {
    overflow-y: scroll;
}

body {
    font-family: "Atkinson Hyperlegible Next", Verdana, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    transition:
        background-color 0.3s ease,
        color 0.3s ease;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 10px 20px;
}

header {
    display: table;
    margin-bottom: 20px;
}

#interactive-portrait {
    display: inline-block;
    width: 82px;
    height: 73px;
}

header > * {
    display: table-cell;
    vertical-align: middle;
}

header h1 {
    font-size: 2.5rem;
    font-weight: normal;
    line-height: 1;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: 0.5px;
    padding-left: 0.6em;
}

nav {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 10px 0 10px 0;
    padding: 0 0;
}

.nav-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 1rem;
    position: relative;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-link::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--accent);
    transform: translateX(-50%);
    transition: width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-link:hover {
    color: var(--accent-hover);
    transform: translateY(-2px);
    background-color: rgba(255, 107, 53, 0.1);
}

.nav-link:hover::after {
    width: 80%;
}

.nav-link:active {
    color: var(--accent-active);
    transform: translateY(0);
}

/* Currently active navigation section */
.nav-current {
    color: var(--text-primary);
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    position: relative;
    display: inline-block;
    background-color: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .nav-current {
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-current::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 100%;
    height: 2px;
    background-color: var(--text-primary);
    transform: translateX(-50%);
}

.nav-separator {
    color: var(--text-secondary);
    font-size: 1.1rem;
    user-select: none;
}

main {
    margin: 40px 0;
    font-size: 1.1rem;
}

main img {
    max-width: 100%;
    height: auto;
}

footer {
    margin-top: 60px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

footer p {
    margin: 4px 0;
}

.fortune {
    font-style: italic;
}

footer a {
    color: var(--accent);
    text-decoration: underline;
    transition: all 0.2s ease;
}

.footer-link:hover {
    color: var(--accent-hover);
    text-decoration-thickness: 2px;
}

/* General link styles */
a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: all 0.2s ease;
}

a:hover {
    color: var(--accent-hover);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

a:active {
    color: var(--accent-active);
}

/* Dark mode toggle */
.theme-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.7rem;
    font-family: "Atkinson Hyperlegible Next", Verdana, sans-serif;
    letter-spacing: 0.05em;
    text-transform: lowercase;
    transition: all 0.15s ease;
    z-index: 1000;
    padding: 3px 8px;
    color: var(--text-secondary);
    border-radius: 3px;
}

.theme-toggle:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.theme-toggle:active {
    opacity: 0.6;
}

/* Writings */
.writings-group {
    margin-bottom: 32px;
    padding-left: 20px;
    border-left: 2px solid var(--border);
}

.writings-group h3 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.writings-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.writings-list li {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.writings-list li:last-child {
    border-bottom: none;
}

.writings-list li a {
    font-weight: 700;
    font-size: 1rem;
    display: block;
    line-height: 1.4;
}

.writings-meta {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.writings-desc {
    display: block;
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.5;
}

/* Portrait styles */
.portrait-tiles {
    background-color: #e8e8e8 !important;
    border-color: #999 !important;
}

/* Portrait tiles in light mode */
.portrait-tile {
    background-color: rgb(
        calc(var(--tile-brightness) * 255),
        calc(var(--tile-brightness) * 255),
        calc(var(--tile-brightness) * 255)
    ) !important;
}

/* Portrait tiles in dark mode - invert brightness */
[data-theme="dark"] .portrait-tiles {
    background-color: #2a2a2a !important;
    border-color: #666 !important;
}

[data-theme="dark"] .portrait-tile {
    background-color: rgb(
        calc((1 - var(--tile-brightness)) * 220 + 35),
        calc((1 - var(--tile-brightness)) * 220 + 35),
        calc((1 - var(--tile-brightness)) * 220 + 35)
    ) !important;
}
