/* Base */
*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    font-size: 16px;
    --bg: #ffffff;
    --text: #333333;
    --text-muted: #666666;
    --border: #e0e0e0;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1a1a1a;
        --text: #e0e0e0;
        --text-muted: #999999;
        --border: #333333;
    }
}

:root[data-theme="light"] {
    --bg: #f5f5f5;
    --text: #1a1a1a;
    --text-muted: #666666;
    --border: #d9d9d9;
}

:root[data-theme="dark"] {
    --bg: #121212;
    --text: #e6e6e6;
    --text-muted: #999999;
    --border: #333333;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    transition: background 0.2s, color 0.2s;
}

/* Hide theme toggle inputs */
.theme-toggle {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* Typography */
h1,
h2,
h3,
h4 {
    margin: 2rem 0 1rem;
    line-height: 1.2;
    font-weight: 700;
}

h1 {
    font-size: 3rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

p {
    margin: 0 0 1rem;
}

small {
    font-size: 0.875rem;
}

a {
    color: inherit;
}

a:hover {
    color: color-mix(in srgb, currentColor 50%, white);
}

ul,
ol {
    margin: 0 0 1rem;
    padding-left: 2rem;
}

/* Layout */
.container {
    max-width: 700px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    flex-flow: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

section {
    margin-bottom: 3rem;
}

/* Header */
header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2rem 0;
}

.logo {
    font-weight: 700;
    text-decoration: none;
    font-size: 1.5rem;
}

.main-nav {
    display: flex;
    list-style-type: none;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
}

.main-nav a {
    text-decoration: none;
    font-weight: 600;
}

/* Theme Toggle */
.theme-btn {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    cursor: pointer;
    overflow: hidden;
    line-height: 1;
    border-radius: 0.5rem;
    color: var(--text);
    background: var(--border);
    transition: background 0.2s, color 0.2s, opacity 0.2s;
    user-select: none;
}

.theme-btn:hover {
    opacity: 0.8;
}

.theme-icon {
    grid-area: 1 / 1;
    transform-origin: 50% 140%;
    transition:
        opacity 0.42s ease,
        transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-icon-sun {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg);
}

.theme-icon-moon {
    opacity: 0;
    transform: translate(-0.75rem, 0.75rem) rotate(-80deg);
}

:root[data-theme="dark"] .theme-icon-sun {
    opacity: 0;
    transform: translate(0.75rem, -0.75rem) rotate(80deg);
}

:root[data-theme="dark"] .theme-icon-moon {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-icon-sun {
        opacity: 0;
        transform: translate(0.75rem, -0.75rem) rotate(80deg);
    }

    :root:not([data-theme="light"]) .theme-icon-moon {
        opacity: 1;
        transform: translate(0, 0) rotate(0deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .theme-icon {
        transition: opacity 0.15s ease;
        transform: none !important;
    }
}

/* Footer */
footer {
    padding: 2rem 0;
    margin-top: auto;
}

/* Media */
img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 2rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 2rem;
}

.block {
    display: block;
}

.contact {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1em;
}

.avatar {
    width: 150px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 100%;
}