/* ========================================
   RESET & BASE STYLES
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Ensure all elements use Times New Roman */
*, *::before, *::after {
    font-family: 'Times New Roman', Times, serif;
}

html {
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
    overflow-y: scroll;
}

/* ========================================
   TYPOGRAPHY & LAYOUT
   ======================================== */

body {
    font-family: 'Times New Roman', Times, serif;
    line-height: 1.65;
    background: #dfe8df;
    color: #1a1a1a;
    padding: 4rem 3rem;
    max-width: 1400px;
    margin: auto;
    font-size: 17px;
    font-weight: 400;
    letter-spacing: -0.011em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========================================
   HEADINGS - Standardized Margins
   ======================================== */

h1 {
    font-size: 1.625rem;
    margin-bottom: 1rem;
    font-weight: 600;
    color: #0a0a0a;
    letter-spacing: -0.035em;
    text-align: left;
    line-height: 1.15;
}

h2 {
    font-size: 1.1875rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-top: 3rem;
    margin-bottom: 2rem;
    color: #0a0a0a;
}

/* Page title (h2 immediately after header) */
body > h2:first-of-type,
header + h2 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-top: 0;
    margin-bottom: 0rem;
    color: #0a0a0a;
    text-align: left;
}

/* ========================================
   PARAGRAPH & TEXT
   ======================================== */

p {
    margin-bottom: 1.5rem;
    line-height: 1.75;
    font-size: 1.0625rem;
    color: #262626;
}

strong {
    font-weight: 600;
    color: #0a0a0a;
}

/* ========================================
   HEADER - Consistent Positioning
   ======================================== */

header {
    margin: 0 0 3rem 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: baseline;
    text-align: left;
    border-bottom: none;
    position: relative;
    width: 100%;
}

header h1 {
    font-size: 1.5rem;
    margin: 0;
    letter-spacing: -0.02em;
    font-weight: 600;
    text-align: left;
    view-transition-name: site-title;
}

/* Ensure h1 inside header div (writing posts) also matches */
header > div h1 {
    margin: 0;
    text-align: left;
}

/* Header wrapper for writing posts with title and date */
header > div {
    display: flex;
    flex-direction: column;
    gap: 0;
}

header nav {
    margin: 0;
    display: flex;
    justify-content: flex-end;
    align-items: baseline;
    text-align: right;
    gap: 0.75rem;
    min-width: 200px;
}

header nav a {
    font-size: 0.9375rem;
}

/* ========================================
   NAVIGATION
   ======================================== */

nav {
    margin-top: 0.5rem;
    font-size: 0.9375rem;
    color: #737373;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
}

nav a {
    color: #262626;
    margin: 0;
    padding: 0 0.25rem;
    font-weight: 500;
}

nav span {
    color: #b3b3b3;
    user-select: none;
}

/* Social links in header */
.social-links {
    text-align: right;
    margin: 0;
    font-size: 0.9375rem;
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 0.75rem;
    min-width: 200px;
}

.social-links a {
    font-weight: 400;
    color: #525252;
    background-image: linear-gradient(90deg, #0a0a0a 0%, #0a0a0a 100%);
    background-size: 0% 1px;
    background-repeat: no-repeat;
    background-position: left bottom;
}

.social-links a:hover {
    background-size: 100% 1px;
    color: #0a0a0a;
}

.social-links span {
    color: #999999;
    opacity: 0.8;
}

/* ========================================
   LINKS
   ======================================== */

a {
    color: #171717;
    text-decoration: none;
    position: relative;
    font-weight: 500;
    background-image: linear-gradient(90deg, #0a0a0a 0%, #0a0a0a 100%);
    background-size: 0% 1px;
    background-repeat: no-repeat;
    background-position: left bottom;
}

a:hover {
    color: #0a0a0a;
    background-size: 100% 1px;
}

a::after {
    display: none;
}

/* Writings post links - refined accent color */
main a,
article a,
.post-content a,
.writing-post a {
    color: #2563eb;
    background-image: linear-gradient(90deg, #2563eb 0%, #2563eb 100%);
}

main a:hover,
article a:hover,
.post-content a:hover,
.writing-post a:hover {
    color: #1d4ed8;
}

/* Focus states for accessibility */
a:focus-visible,
button:focus-visible {
    outline: 2px solid #171717;
    outline-offset: 3px;
    border-radius: 2px;
}

/* ========================================
   MAIN CONTENT & SECTIONS
   ======================================== */

main {
    width: 100%;
    margin: 0;
    padding: 0;
}

section {
    margin-bottom: 3rem;
    margin-left: 0;
    margin-right: 0;
    padding: 0;
}

/* Main content wrapper for landing page */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0;
    margin: 0;
    width: 100%;
}

/* ========================================
   LISTS - Standardized Styles
   ======================================== */

/* Standard list style for about pages */
.standard-list {
    line-height: 2;
    list-style-position: outside;
    padding-left: 1.5rem;
}

/* Arrow list (custom bullets) */
.arrow-list {
    list-style: none;
    padding-left: 0;
}

.arrow-list li {
    margin-bottom: 1rem;
    padding-left: 1.75rem;
    position: relative;
    font-size: 1.0625rem;
    line-height: 1.7;
    color: #262626;
}

.arrow-list li::before {
    content: "–";
    position: absolute;
    left: 0;
    color: #a3a3a3;
    font-weight: 400;
}

/* ========================================
   LANDING PAGE - About Intro Section
   ======================================== */

.about-intro {
    text-align: left;
    margin: 0 0 4rem 0;
    padding: 0;
    width: 100%;
}

.about-intro p {
    font-size: 1.0625rem;
    line-height: 1.75;
    color: #262626;
    margin-bottom: 1.5rem;
}

.about-intro p:last-child {
    margin-bottom: 0;
}

/* ========================================
   ABOUT PAGE STYLES
   ======================================== */

/* About text section */
.about-text {
    margin-bottom: 4rem;
    margin-left: 0;
    margin-right: 0;
    padding: 0;
    width: 100%;
}

.about-text h2 {
    margin-top: 0;
    margin-bottom: 2rem;
    font-size: 1.5rem;
}

/* Me section */
.me-section {
    margin-top: 0;
    margin-bottom: 2rem;
}

.me-text {
    max-width: 100%;
}

.me-text h2 {
    margin-top: 0;
}

.me-text .arrow-list {
    margin-top: 0.5rem;
}

/* Interactive cards grid */
.explore-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
    margin: 0 0 4rem 0;
    padding: 0;
    width: 100%;
}

.explore-card {
    border: 1.5px solid #171717;
    padding: 2.5rem 2rem;
    transition: all 0.3s cubic-bezier(0.33, 1, 0.68, 1);
    text-decoration: none;
    color: #171717;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    text-align: left;
    background: transparent;
    height: 250px;
}

.card-icon {
    display: none;
}

.card-title {
    font-size: 1.1875rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 1rem;
    color: #0a0a0a;
    letter-spacing: -0.015em;
    line-height: 1.4;
    text-align: left;
    transition: color 0.3s cubic-bezier(0.33, 1, 0.68, 1);
}

.card-description {
    font-size: 0.875rem;
    color: #737373;
    font-weight: 500;
    letter-spacing: 0.01em;
    margin: 0;
    text-align: left;
    transition: color 0.3s cubic-bezier(0.33, 1, 0.68, 1);
}

.explore-card:hover {
    background-color: #0a0a0a;
    color: #ffffff;
}

.explore-card:hover .card-title,
.explore-card:hover .card-description {
    color: #ffffff;
}

/* ========================================
   WRITINGS PAGE STYLES
   ======================================== */

/* Make writings page h2 match card-title format */
.writings-page h2:first-of-type {
    font-size: 1.1875rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 1rem;
    color: #0a0a0a;
    letter-spacing: -0.015em;
    line-height: 1.4;
}

.writings-subtitle {
    margin-top: 0;
    margin-bottom: 3rem;
    color: #737373;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    line-height: 1.75;
    text-align: left;
}

/* Category buttons */
.category-buttons {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 4rem;
    position: relative;
}

.category-button {
    padding: 1rem 2.5rem;
    background: transparent;
    border: none;
    color: #171717;
    font-size: 1.125rem;
    font-weight: 400;
    text-decoration: none;
    border-radius: 0;
    cursor: pointer;
    position: relative;
    z-index: 2;
}

.category-button:hover {
    color: #0a0a0a;
}

.category-button.active {
    color: #0a0a0a;
}

.category-indicator {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    border: 1.5px solid #171717;
    background: transparent;
    z-index: 1;
    pointer-events: none;
}

.category-section {
    display: none;
}

.category-section.active {
    display: block;
}

/* Posts grid */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
    margin-top: 3rem;
}

.post-card {
    border: 1.5px solid #171717;
    padding: 2.5rem 2rem;
    text-decoration: none;
    color: #171717;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    text-align: left;
    border-radius: 0;
    background: transparent;
    height: 250px;
}

.post-card::after {
    display: none;
}

.post-card:hover {
    background-color: #0a0a0a;
    color: #ffffff;
}

.post-card:hover .post-title,
.post-card:hover .post-date {
    color: #ffffff;
}

.post-title {
    font-size: 1.1875rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 1rem;
    color: #0a0a0a;
    letter-spacing: -0.015em;
    line-height: 1.4;
    text-align: left;
}

.post-date {
    text-align: left;
    color: #737373;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    margin-top: 0;
    margin-bottom: 0;
}

/* Post date on writing article pages */
body > .post-date {
    margin-bottom: 2.5rem;
}

/* ========================================
   FOOTER
   ======================================== */

footer {
    margin-top: 4rem;
    padding-top: 2rem;
    text-align: center;
    color: #737373;
    font-size: 0.875rem;
    font-weight: 400;
}

/* ========================================
   BUTTONS & INTERACTIVE ELEMENTS
   ======================================== */

.share-button {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1.5px solid #171717;
    color: #171717;
    text-decoration: none;
    border-radius: 0;
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: 1rem;
    background-size: 0;
}

.share-button:hover {
    background: #171717;
    color: #ffffff;
}

.share-button svg {
    width: 14px;
    height: 14px;
    vertical-align: middle;
    margin-right: 0.4rem;
}

/* ========================================
   CURSOR EFFECTS
   ======================================== */

@media (pointer: fine) {
    *,
    *::before,
    *::after {
        cursor: none !important;
    }

    section,
    section *,
    div,
    div * {
        cursor: none !important;
    }

    .cursor {
        position: fixed;
        pointer-events: none;
        z-index: 10000;
        will-change: left, top;
        display: block;
        visibility: visible;
    }

    .cursor::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 4px;
        height: 4px;
        background: #0a0a0a;
        border-radius: 50%;
        transform: translate(-50%, -50%);
    }

    .cursor::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 24px;
        height: 24px;
        border: 0.75px solid rgba(10, 10, 10, 0.35);
        border-radius: 50%;
        transform: translate(-50%, -50%);
    }

    a:hover ~ .cursor::before,
    button:hover ~ .cursor::before {
        width: 8px;
        height: 8px;
    }

    a:hover ~ .cursor::after,
    button:hover ~ .cursor::after {
        width: 32px;
        height: 32px;
        opacity: 0.5;
        border-width: 1px;
    }
}

/* ========================================
   SELECTION
   ======================================== */

::selection {
    background: #0a0a0a;
    color: #ffffff;
}

::-moz-selection {
    background: #0a0a0a;
    color: #ffffff;
}

/* ========================================
   PAGE TRANSITIONS
   ======================================== */

/* Enable smooth cross-document view transitions (Chrome/Edge 126+) */
@view-transition {
    navigation: auto;
}

/* Entire page fades out/in during navigation */
::view-transition-old(root) {
    animation: pg-fade-out 0.18s ease;
}

::view-transition-new(root) {
    animation: pg-fade-in 0.22s ease;
}

/* The site title ("peter graham") stays perfectly still — no animation at all */
::view-transition-old(site-title),
::view-transition-new(site-title) {
    animation: none;
    mix-blend-mode: normal;
}

@keyframes pg-fade-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@keyframes pg-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    body {
        padding: 3rem 2rem;
        font-size: 16px;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.1875rem;
        margin-top: 2.5rem;
        margin-bottom: 1.5rem;
    }

    header nav,
    .social-links {
        min-width: 0;
    }

    nav {
        flex-wrap: wrap;
        gap: 0.625rem;
    }

    .about-content {
        padding: 0 0.5rem;
    }

    .about-intro {
        margin-bottom: 3rem;
    }

    .about-intro p {
        font-size: 1rem;
    }

    .social-links {
        font-size: 0.875rem;
        gap: 1rem;
    }

    .about-text {
        margin-bottom: 3rem;
    }

    .explore-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        margin-bottom: 3rem;
    }

    .explore-card {
        height: auto;
    }

    .category-buttons {
        flex-direction: column;
        gap: 1rem;
    }

    .category-button {
        width: 100%;
    }

    .posts-grid {
        grid-template-columns: 1fr;
    }

    .post-card {
        height: auto;
    }
}

@media (max-width: 600px) {
    body {
        padding: 2.5rem 1.5rem;
    }

    nav {
        font-size: 0.875rem;
    }

    .about-intro {
        margin-bottom: 2.5rem;
    }

    .about-intro p {
        font-size: 1rem;
        line-height: 1.7;
    }

    .social-links {
        gap: 0.875rem;
    }

    .about-text {
        margin-bottom: 2.5rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .explore-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
