/* tituto.com is set like a company's annual report: a narrow column of section names, the content beside it, and
   the company's registration on the first screen. Logotype files are 720 units tall for a 700-unit cap, so an
   image's height sets the cap height. */

/* #region Base */

/* Faces are served from this site, so no visitor's address reaches a font host. */
@font-face {
    font-family: 'Plus Jakarta Sans';
    src: url('fonts/PlusJakartaSans-VariableFont_wght.ttf') format('truetype');
    font-weight: 200 800;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Playfair Display';
    src: url('fonts/PlayfairDisplay-VariableFont_wght.ttf') format('truetype');
    font-weight: 400 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Playfair Display';
    src: url('fonts/PlayfairDisplay-Italic-VariableFont_wght.ttf') format('truetype');
    font-weight: 400 900;
    font-style: italic;
    font-display: swap;
}

:root {
    --white: #F5F5F5;
    --white-rgb: 245, 245, 245;
    --black: #050505;
    --black-rgb: 5, 5, 5;
    --gold: #B6A574;
    --gold-rgb: 182, 165, 116;
    --font-sans: 'Plus Jakarta Sans', Arial, sans-serif;
    --font-display: 'Playfair Display', Georgia, serif;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --muted: rgba(var(--black-rgb), 0.62);
    --rule: rgba(var(--black-rgb), 0.14);
    --edge: clamp(1rem, 5vw, 5rem);
    --label: clamp(10rem, 22vw, 18rem);
    --width: 1440px;
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--white);
    color: var(--black);
    font-family: var(--font-sans);
    font-weight: 300;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: clip;
}

img,
svg {
    display: block;
    max-width: 100%;
    height: auto;
}

a {
    color: inherit;
    text-decoration: none;
}

ol,
ul {
    list-style: none;
}

address {
    font-style: normal;
}

h1, h2, h3 {
    font-weight: 400;
}

::selection {
    background: var(--gold);
    color: var(--black);
}

:focus-visible {
    outline: 1px solid var(--gold);
    outline-offset: 4px;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
}

.skip-link:focus {
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 0.9rem;
    background: var(--black);
    color: var(--white);
    font-size: 0.68rem;
    letter-spacing: 0.2em;
    text-align: center;
    text-transform: uppercase;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* #endregion */

/* Lines are balanced by the browser at whatever width the page is read, so a heading never ends on a lone word
   and a paragraph avoids a single word on its last line. */
.hero-title,
.story-first,
.principle-title,
.book-title,
.partners-text {
    text-wrap: balance;
}

/* The few lines of blocks set side by side are balanced too, so no width leaves a short last line under full ones;
   site.js binds every paragraph's last two words wherever balance and pretty are not supported. */
.house-text,
.principles p {
    text-wrap: balance;
}

p,
.book-text {
    text-wrap: pretty;
}

.top-nav,
.row-label,
.facts dt,
.more,
.book-meta,
.register dt,
.footer {
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.28em;
    text-transform: uppercase;
}

/* Links draw their own underline in when pointed at. */
.more {
    position: relative;
    display: inline-flex;
    gap: 0.6rem;
    padding-bottom: 0.4rem;
}

.more::before,
.more::after {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    content: '';
}

.more::before {
    background: var(--rule);
}

.more::after {
    background: currentColor;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.8s var(--ease);
}

a:hover .more::after,
a.more:hover::after,
a:focus-visible .more::after {
    transform: scaleX(1);
}

.inline {
    position: relative;
    color: var(--black);
    border-bottom: 1px solid var(--rule);
}

.inline::after {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: currentColor;
    content: '';
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.8s var(--ease);
}

.inline:hover::after,
.inline:focus-visible::after {
    transform: scaleX(1);
}

/* #region Progress and top */

.progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 30;
    height: 1px;
    background: var(--black);
    transform: scaleX(0);
    transform-origin: left;
}

@supports (animation-timeline: scroll()) {
    @media (prefers-reduced-motion: no-preference) {
        .progress {
            animation: grow linear both;
            animation-timeline: scroll(root);
        }
    }
}

@keyframes grow {
    to { transform: scaleX(1); }
}

.top {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--white);
    border-bottom: 1px solid var(--black);
}

.top-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 2rem;
    max-width: var(--width);
    margin: 0 auto;
    padding: 1.4rem var(--edge);
}

.top-logo img {
    height: 12.3px;
    width: auto;
}

.top-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem clamp(1rem, 2.2vw, 2.2rem);
}

.top-nav a {
    padding-block: 0.6rem;
    color: var(--muted);
    transition: color 0.4s ease;
}

.top-nav a:hover {
    color: var(--black);
}

/* #endregion */

/* #region Hero */

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem);
    align-items: end;
    gap: clamp(3rem, 7vw, 8rem);
    max-width: var(--width);
    margin: 0 auto;
    padding: clamp(4rem, 8vw, 7rem) var(--edge);
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 5vw, 5rem);
    font-weight: 400;
    line-height: 1.05;
    letter-spacing: -0.02em;
}

.line {
    display: block;
}

.line:nth-child(2) {
    font-style: italic;
}

/* The first screen does not perform: it simply comes up, slowly, the words before the facts. */
.hero-main {
    animation: fade 2.2s 0.1s var(--ease) both;
}

.hero-lead {
    max-width: 36rem;
    margin-top: 2rem;
    color: var(--muted);
    font-size: clamp(1rem, 1.25vw, 1.15rem);
}

@keyframes fade {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
}

.facts {
    border-top: 1px solid var(--black);
}

.facts > div {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--rule);
    animation: fade 1.6s var(--ease) both;
}

.facts > div:nth-child(1) { animation-delay: 0.5s; }
.facts > div:nth-child(2) { animation-delay: 0.62s; }
.facts > div:nth-child(3) { animation-delay: 0.74s; }
.facts > div:nth-child(4) { animation-delay: 0.86s; }
.facts > div:nth-child(5) { animation-delay: 0.98s; }

.facts dt {
    color: var(--muted);
}

.facts dd {
    font-size: 0.93rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

/* #endregion */

/* #region Rows */

.row {
    position: relative;
    display: grid;
    grid-template-columns: var(--label) minmax(0, 1fr);
    gap: 2rem;
    max-width: var(--width);
    margin: 0 auto;
    padding: clamp(3.5rem, 7vw, 6rem) var(--edge);
}

/* The rule above each section draws itself across as the section arrives. */
.row::before {
    position: absolute;
    top: 0;
    left: var(--edge);
    right: var(--edge);
    height: 1px;
    background: var(--rule);
    content: '';
    transform-origin: left;
}

.row-label {
    padding-top: 0.45rem;
    color: var(--muted);
}

/* Entrances, driven by site.js: the script adds .js only when it can also reveal, so without it nothing is
   ever hidden. A section's rule draws across, then its label, then its parts one after another. */
.js .row::before {
    transform: scaleX(0);
    transition: transform 1.4s var(--ease);
}

.js .row-label,
.js .row-body > * {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 1.4s var(--ease), transform 1.4s var(--ease);
}

.js .row.is-visible::before {
    transform: none;
}

.js .row.is-visible .row-label,
.js .row.is-visible .row-body > * {
    opacity: 1;
    transform: none;
}

.js .row.is-visible .row-label { transition-delay: 0.15s; }
.js .row.is-visible .row-body > :nth-child(1) { transition-delay: 0.25s; }
.js .row.is-visible .row-body > :nth-child(2) { transition-delay: 0.4s; }
.js .row.is-visible .row-body > :nth-child(3) { transition-delay: 0.55s; }
.js .row.is-visible .row-body > :nth-child(n + 4) { transition-delay: 0.7s; }

.story {
    display: grid;
    gap: 1.25rem;
    max-width: 46rem;
    color: var(--muted);
    font-size: 1.02rem;
}

.story-first {
    color: var(--black);
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 2.4vw, 2.2rem);
    line-height: 1.25;
}

/* #endregion */

/* #region Houses */

.houses {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(2rem, 4vw, 4rem);
}

.house {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
}

/* Each house on its own ground, the way it presents itself and as on marcin.com: Odoardo white on black, Gratienne
   black on white, held by a hairline since its white is the page's own. */
.house-ground {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

.house-ground--odoardo {
    background: var(--black);
}

.house-ground--gratienne {
    background: var(--white);
    box-shadow: inset 0 0 0 1px var(--rule);
}

/* The ecosystem's one use of gold here: a hairline frame set into the ground only when it is pointed at, as on
   marcin.com. */
.house-ground::after {
    position: absolute;
    inset: 1.6rem;
    border: 1px solid rgba(var(--gold-rgb), 0);
    content: '';
    pointer-events: none;
    transition: inset 1s var(--ease), border-color 1s ease;
}

.house:hover .house-ground::after,
.house:focus-visible .house-ground::after {
    inset: 0.9rem;
    border-color: rgba(var(--gold-rgb), 0.9);
}

/* The logotype is cut in #050505; on the black ground it is turned to #F5F5F5. */
.house-logo {
    height: clamp(14px, 1.3vw, 19px);
    width: auto;
    max-width: none;
    transition: transform 1.6s var(--ease);
}

.house-ground--odoardo .house-logo {
    filter: invert(0.98);
}

.house:hover .house-logo,
.house:focus-visible .house-logo {
    transform: scale(1.03);
}

.house-text {
    max-width: 28rem;
    color: var(--muted);
    font-size: 0.95rem;
}

/* #endregion */

/* #region Principles */

.principles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(1.5rem, 3vw, 3rem);
}

.principles li {
    padding-top: 1.25rem;
    border-top: 1px solid var(--black);
}

.numeral {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-style: italic;
    color: var(--muted);
}

.principle-title {
    margin: 1.25rem 0 0.6rem;
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 2vw, 1.75rem);
    font-weight: 400;
    line-height: 1.15;
}

.principles p {
    color: var(--muted);
    font-size: 0.93rem;
}

/* #endregion */

/* #region Books */

.book {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 1rem 3rem;
    padding: 1.6rem 0;
    border-bottom: 1px solid var(--rule);
}

.book:first-child {
    padding-top: 0.3rem;
}

.book-main {
    display: grid;
    gap: 0.45rem;
}

.book-title {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 2.4vw, 2.1rem);
    line-height: 1.1;
}

/* A book that can be opened answers the hand with the same drawn underline as every other link. */
a.book .book-title {
    justify-self: start;
    border-bottom: 1px solid transparent;
    transition: border-color 0.8s ease;
}

a.book:hover .book-title {
    border-color: currentColor;
}

.book-text {
    color: var(--muted);
    font-size: 0.95rem;
}

.book-meta {
    display: grid;
    gap: 0.45rem;
    justify-items: end;
    color: var(--muted);
    font-size: 0.56rem;
    font-variant-numeric: tabular-nums;
    line-height: 1.6;
    text-align: right;
}

/* Each edition is named by its square flag rather than a language code, framed by a hairline as on Odoardo. */
/* The format and the number are kept whole each: a narrow line breaks between them, never inside an ISBN. */
.edition {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.2rem 0.7rem;
    white-space: nowrap;
}

/* The column is set flush right, so the flag closes the line and the flags of every edition stand one under another. */
.edition .flag { order: 1; }

.flag {
    width: 12px;
    height: 12px;
    border: 1px solid var(--rule);
}

/* #endregion */

/* #region Partners, family and company */

.row--partners {
    max-width: none;
    padding-inline: max(var(--edge), calc((100% - var(--width)) / 2 + var(--edge)));
    background: var(--black);
    color: var(--white);
}

.row--partners::before {
    display: none;
}

.row--partners .row-label {
    color: rgba(var(--white-rgb), 0.6);
}

.partners-text {
    max-width: 42rem;
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 2.4vw, 2.2rem);
    line-height: 1.3;
}

.family-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    padding: 1.4rem 0;
    border-bottom: 1px solid var(--rule);
}

.family-row:first-child {
    padding-top: 0.3rem;
}

.family-row img {
    height: 15.4px;
    width: auto;
}

.register > div {
    display: grid;
    grid-template-columns: 11rem minmax(0, 1fr);
    gap: 1.5rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--rule);
}

.register > div:first-child {
    padding-top: 0.3rem;
}

.register dt {
    color: var(--muted);
    line-height: 2.4;
}

.register dd {
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.register small {
    display: block;
    margin-top: 0.2rem;
    color: var(--muted);
    font-size: 0.82rem;
}

.register-links {
    margin-top: 2.25rem;
}

/* #endregion */

/* #region Privacy notice */

/* The notice is a bilingual contract: a clause number, the Polish text and its English twin side by side. The
   header bar, the opening and every clause share one grid, so the two languages hold their columns top to bottom. */
.notice-columns,
.notice-hero,
.clause {
    grid-template-columns: 3.5rem repeat(2, minmax(0, 1fr));
    column-gap: clamp(2rem, 4.5vw, 5rem);
}

.notice-columns {
    display: grid;
    max-width: var(--width);
    margin: 0 auto;
    padding: 0.85rem var(--edge);
    border-top: 1px solid var(--rule);
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.28em;
    text-transform: uppercase;
}

.notice-language {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
}

.notice-hero {
    display: grid;
    max-width: var(--width);
    margin: 0 auto;
    padding: clamp(3.5rem, 7vw, 6rem) var(--edge) clamp(3rem, 6vw, 5rem);
    animation: fade 2.2s 0.1s var(--ease) both;
}

.notice-title {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 4.2vw, 4.2rem);
    font-weight: 400;
    line-height: 1.05;
    letter-spacing: -0.02em;
}

.notice-title--en {
    font-style: italic;
}

.notice-lead {
    max-width: 30rem;
    margin-top: 1.5rem;
    color: var(--muted);
    font-size: clamp(0.98rem, 1.15vw, 1.08rem);
}

.notice-facts {
    margin-top: 2.25rem;
    border-top: 1px solid var(--black);
}

.notice-facts > div {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--rule);
}

.notice-facts dt {
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.28em;
    text-transform: uppercase;
}

.notice-facts dd {
    font-size: 0.93rem;
    font-variant-numeric: tabular-nums;
}

.clause {
    padding-block: clamp(2.25rem, 4vw, 3.5rem);
}

.clause-number {
    font-variant-numeric: tabular-nums;
    line-height: 2.6;
}

.clause-part {
    display: grid;
    align-content: start;
    gap: 0.9rem;
    color: rgba(var(--black-rgb), 0.78);
    font-size: 0.95rem;
}

.clause-title {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.3rem;
    color: var(--black);
    font-family: var(--font-display);
    font-size: clamp(1.25rem, 1.7vw, 1.55rem);
    font-weight: 400;
    line-height: 1.25;
    text-wrap: balance;
}

/* On a wide screen the column heads name the language, so the flag beside each title only appears once the
   columns stack. */
.clause-title .flag {
    display: none;
}

.clause-part .nobr {
    white-space: nowrap;
}

.clause-part ul {
    display: grid;
    gap: 0.6rem;
}

.clause-part li {
    position: relative;
    padding-left: 1.4rem;
}

.clause-part li::before {
    position: absolute;
    left: 0;
    top: 0.85em;
    width: 0.6rem;
    height: 1px;
    background: var(--black);
    content: '';
}

/* #endregion */

/* #region Footer */

.footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 2rem;
    max-width: var(--width);
    margin: 0 auto;
    padding: 2.5rem var(--edge);
    border-top: 1px solid var(--black);
    color: var(--muted);
}

.footer img {
    height: 10.3px;
    width: auto;
}

/* #endregion */

@media (max-width: 900px) {
    .hero,
    .row,
    .houses,
    .principles {
        grid-template-columns: minmax(0, 1fr);
    }

    .row {
        gap: 1.5rem;
    }

    .top-nav,
    .notice-columns {
        display: none;
    }

    .notice-hero,
    .clause {
        grid-template-columns: minmax(0, 1fr);
        row-gap: 2.5rem;
    }

    .notice-hero > span:first-child {
        display: none;
    }

    .clause {
        row-gap: 1.75rem;
    }

    .clause-number {
        line-height: 1;
    }

    .clause-title .flag {
        display: block;
    }
}

@media (max-width: 560px) {
    .book {
        grid-template-columns: minmax(0, 1fr);
    }

    .book-meta {
        justify-items: start;
        text-align: left;
    }

    .register > div {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.2rem;
    }

    .family-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.9rem;
    }
}
