/* Prevent horizontal scroll globally */
* {
    max-width: 100%;
    box-sizing: border-box;
}

/* Iowan Old Style Font Declarations */
@font-face {
    font-family: 'Iowan Old Style';
    src: url('./fonts/iowan-old-style_regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Iowan Old Style';
    src: url('./fonts/iowan-old-style_italic.woff2') format('woff2');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Iowan Old Style';
    src: url('./fonts/iowan-old-style_bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Iowan Old Style';
    src: url('./fonts/iowan-old-style_bold-italic.woff2') format('woff2');
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Iowan Old Style';
    src: url('./fonts/iowan-old-style_black.woff2') format('woff2');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Iowan Old Style';
    src: url('./fonts/iowan-old-style_black-italic.woff2') format('woff2');
    font-weight: 900;
    font-style: italic;
    font-display: swap;
}

:root {
    --margin-page: 2em;
    --ui-primary: #000;
    --ui-secondary: #817d79;
    --text-select--bg: #7d7373;
    /* Header sizing variables */
    --h1-size: 1.8em;
    --h2-size: 1.4em;
    --h3-size: 1.2em;
    --h1-margin: 0 0 1em;
    --h2-margin: 1.6em 0 0.8em;
    --h3-margin: 1.4em 0 0.7em 0;
}

/* Text selection styling */
::selection {
    background-color: #f0f0f0;
    color: #000;
}

::-moz-selection {
    background-color: #f0f0f0;
    color: #000;
}

html {
    -webkit-font-smoothing: antialiased;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

:focus-visible {
    outline: 1px dotted;
    outline-offset: 0.1875em;
    border-radius: 1px;
    text-decoration: none;
}

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

@keyframes float {
    0% {
        transform: translateY(5px);
    }

    50% {
        transform: translateY(-5px);
    }

    100% {
        transform: translateY(5px);
    }
}

@keyframes gradRotate {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.float-animation {
    backface-visibility: hidden;
    animation: float 7s ease-in-out infinite;
}

@media(prefers-reduced-animation: reduce) {
    .float-animation {
        animation: none;
    }
}

body {
    font-family: 'Iowan Old Style', 'Iowan Old Style Black', Georgia, serif;
    font-size: 18px;
    line-height: 1.333;
    margin: 0;
    padding: 0 var(--margin-page, 20px);
    color: var(--ui-primary, #000);
    text-wrap: stable;
    animation: fadeIn 0.7s ease-out;
    max-width: 100vw;
    overflow-x: hidden;
}

main {
    max-width: 36em;
    overflow-wrap: normal;
    word-wrap: normal;
    hyphens: none;
}

/* Ensure main content inherits body font size on mobile */
@media (max-width: 768px) {
    main {
        font-size: inherit;
        max-width: 100%;
        padding: 0 0.5em;
        box-sizing: border-box;
    }
}

p {
    margin: 0 0 1.333em;
    text-wrap: stable;
    line-height: 1.6;
}

/* Privacy and Terms pages - inherit body font size */
.privacy-page p,
.privacy-page li,
[data-page="terms"] p,
[data-page="terms"] li {
    /* Inherit body font-size: 18px on desktop, 17px on mobile */
}

/* Ensure mobile font size is properly applied to all pages */
@media (max-width: 768px) {
    .privacy-page p,
    .privacy-page li,
    [data-page="terms"] p,
    [data-page="terms"] li {
        font-size: inherit;
    }
}

a {
    text-decoration: underline;
    text-underline-offset: 0.25em;
    text-decoration-thickness: 1px;
    color: var(--ui-secondary);
    text-decoration-color: rgba(129, 125, 121, 0.26);
}

a:hover {
    text-decoration-style: dotted;
    color: #5a5754;
}

.anchor__target {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.anchor__target:hover {
    color: var(--ui-secondary);
    text-decoration: underline;
    text-underline-offset: 0.25em;
    text-decoration-thickness: 1px;
    text-decoration-color: rgba(129, 125, 121, 0.26);
}

dl p {
    margin: 0 0 0.8em;
}

.job-listing {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.location {
    color: var(--ui-secondary);
}

h0 {
    font-size: clamp(3.4em, 3.6vw, 6em);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-wrap: stable;
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 500;
}

/* Mobile font sizing and layout adjustments */
@media (max-width: 768px) {   
    :root {
        --h1-size: 1.8em;
        --h2-size: 1.3em;
        --h3-size: 1.1em;
        --h1-margin: 0 0 0.8em;
        --h2-margin: 1.6em 0 0.8em;
        --h3-margin: 1.5em 0 0.8em;
    }
    
    body {
        padding: 0 1.6em;
        font-size: 17px;
        overflow-x: hidden;
        width: 100%;
        box-sizing: border-box;
    }
    
    h0 {
        font-size: 3.2em;
    }
    
    /* Ensure headers work consistently across all pages */
    h1,
    .privacy-page h1,
    [data-page="privacy"] h1,
    [data-page="terms"] h1 {
        text-align: center;
    }
    
    /* H2 and H3 elements should be left-aligned on mobile for privacy/terms pages */
    h2, h3,
    .privacy-page h2, .privacy-page h3,
    [data-page="privacy"] h2, [data-page="privacy"] h3,
    [data-page="terms"] h2, [data-page="terms"] h3 {
        text-align: left;
    }
    
    /* Index page h2 should remain centered on mobile */
    body[data-page="index"] h2 {
        text-align: center;
    }
    
    /* Ensure all text elements inherit the mobile font size */
    p, li, .footnote p {
        font-size: inherit;
    }
}

/* Job listing layout changes for mobile */
@media (max-width: 604px) {
    .job-listing {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.1em;
    }
}

/* Extra small screen handling to prevent horizontal scroll */
@media (max-width: 480px) {
    body {
        padding: 0 1.2em;
    }
    
    main {
        padding: 0 0.25em;
    }
    
    h0 {
        font-size: 2.8em;
    }
}

h1 {
    font-size: var(--h1-size);
    font-weight: 700;
    margin: var(--h1-margin);
    text-align: center;
    text-wrap: stable;
    font-family: 'Iowan Old Style', serif;
}

h2 {
    font-size: var(--h2-size);
    font-weight: 700;
    margin: var(--h2-margin);
    text-align: center;
    text-wrap: stable;
}

/* Privacy and Terms pages - h2 should be left-aligned */
.privacy-page h2,
[data-page="privacy"] h2,
[data-page="terms"] h2 {
    text-align: left;
}

/* Index page h2 should remain centered */
body[data-page="index"] h2 {
    text-align: center;
}

h3 {
    font-weight: normal;
    margin: var(--h3-margin);
    font-style: italic;
    font-size: var(--h3-size);
}



hr {
    padding-bottom: 30px;
    width: 30%;
    margin: auto;
}

ul li {
    list-style-type: square;
    margin-left: 15px;
    text-wrap: stable;
    line-height: 1.6;
    margin-bottom: 0.7em;
}

.gradient-text {
    position: relative;
    overflow: hidden;
    background: white;
    color: black;
    border: solid 1px white;
    /* Fix for subpixel rendering */
}

.gradient-text:AFTER {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150%;
    aspect-ratio: 1;
    background: linear-gradient(90deg, #565151, #d2caca);
    mix-blend-mode: screen;
    animation: gradRotate 8s linear infinite;
    pointer-events: none;
    /* Prevent horizontal overflow on very small screens */
    max-width: 100vw;
    overflow: hidden;
    /* Ensure the element doesn't extend beyond viewport */
    transform-origin: center;
    transform: translate(-50%, -50%);
}

.footnote {
    text-align: center;
    margin: 7em 0 0;
    color: var(--ui-secondary);
}

.footnote p {
    font-size: 16px;
}

.footnote p .dot-separator {
    padding: 0 0.4em;
}

/* Footer mobile layout - left-aligned and stacked */
@media (max-width: 480px) {
    .footnote {
        text-align: left;
    }
    
    .footnote p {
        display: flex;
        flex-direction: column;
        gap: 0.5em;
        align-items: flex-start;
    }
    
    .footnote p .dot-separator {
        display: none;
    }
}

.footnote a {
    text-decoration: none;
}

.footnote a:hover {
    text-decoration: underline;
    text-underline-offset: 0.25em;
    text-decoration-thickness: 1px;
    text-decoration-color: rgba(129, 125, 121, 0.26);
}

.header {
    max-width: var(--container-4xl);
    margin-inline: auto;
    padding-block: 100px 60px;
}

@media(max-width:750px) {
    :root {
        --margin-page: 2.5em;
    }
}

/* Large screen adjustments - body font-size already set to 18px */
@media(min-width:1500px) {
    body {
        line-height: 1.333;
    }
}

.team-members span {
    cursor: pointer;
    white-space: nowrap;
}

.team-members span:hover {
    background-color: #f4f1f1;
}

/* New style: When a team member is "selected", keep it highlighted */
.team-members span.selected {
    background-color: #f4f1f1;
}

#hover-title {
    min-height: 100px;
    font-size: 0.9em;
}

/* Index page specific overrides - restore original h2 spacing */
body[data-page="index"] h2,
body:has(h1:contains("Thinking Machines")) h2,
/* Fallback for browsers that don't support :has() */
.index-page h2 {
    margin-top: 3.6em;
}
