/*
Theme Name: Mitterberger
Theme URI: https://www.hannesmitterberger.com/
Author: Nicolás Concha
Description: Demo block theme for Hannes Mitterberger, design direction "Colophon": the site works like one of his books. Work index as table of contents, projects as chapters, awards as footnotes, specs as a colophon. Each project page takes its colours from the printed piece. Fonts are open-source stand-ins for Suisse Works, Suisse Intl and Suisse Intl Mono (Newsreader, Inter, IBM Plex Mono). Copy comes from his current site, lorem ipsum where it has none.
Version: 0.2.0
Requires at least: 6.6
Requires PHP: 8.1
License: Proprietary, demo
Text Domain: mitterberger
*/

/* Tokens come from theme.json. A project page overrides the colour presets on html:root (inc/helpers.php). */
:root {
	--pad: var(--wp--custom--pad);
	--gap: var(--wp--custom--gap);
	--paper: var(--wp--preset--color--paper);
	--ink: var(--wp--preset--color--ink);
	--mute: var(--wp--preset--color--mute);
	--line: var(--wp--preset--color--line);
	--acc: var(--wp--preset--color--accent);
	--tile: var(--wp--preset--color--tile);
	--serif: var(--wp--preset--font-family--serif);
	--sans: var(--wp--preset--font-family--sans);
	--mono: var(--wp--preset--font-family--mono);
}
html { -webkit-text-size-adjust: 100%; }
body { transition: background-color .4s ease, color .4s ease; }
::selection { background: var(--acc); color: var(--paper); }
img { display: block; max-width: 100%; height: auto; }
.wp-site-blocks > * + * { margin-block-start: 0; }
.wp-site-blocks main > .wp-block-post-content > * + * { margin-block-start: 0; }
a { text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); }

/* layout */
.wrap { padding-inline: var(--pad); }
.sec { padding-top: var(--wp--preset--spacing--60); }
.sec-s { padding-top: var(--wp--preset--spacing--50); }
.head { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--ink); padding-top: .75rem; margin-bottom: 2.5rem; }
.stack > * + * { margin-top: 1.25rem; }
.stack-s > * + * { margin-top: .75rem; }

/* type */
.label { font: 400 var(--wp--preset--font-size--xs)/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }
.t-display { font: 300 var(--wp--preset--font-size--huge)/.98 var(--serif); letter-spacing: -.02em; margin: 0; }
.t-title { font: 300 var(--wp--preset--font-size--xxl)/1.02 var(--serif); letter-spacing: -.015em; margin: 0; }
.t-h2 { font: 400 var(--wp--preset--font-size--xl)/1.12 var(--serif); margin: 0; }
.t-card { font: 400 1.375rem/1.2 var(--serif); margin: 0; }
.t-lead { font: 400 var(--wp--preset--font-size--lg)/1.4 var(--sans); letter-spacing: -.005em; margin: 0; }
.t-small { font: 400 var(--wp--preset--font-size--sm)/1.5 var(--sans); }
.mute { color: var(--mute); }
.acc { color: var(--acc); }
.u { text-decoration: underline; }
sup.fn { font: 400 .6875rem/1 var(--mono); color: var(--acc); vertical-align: super; margin-left: 3px; letter-spacing: .02em; }
sup.fn a { text-decoration: none; }
.todo { display: inline-block; font: 400 .625rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; border: 1px dashed var(--mute); color: var(--mute); padding: 4px 6px; border-radius: 3px; vertical-align: 2px; white-space: nowrap; }

/* header */
.hm-top { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 1.5rem var(--pad); position: relative; z-index: 20; }
.hm-brand { font: 500 .9375rem/1.2 var(--sans); text-decoration: none; }
.hm-brand span { color: var(--mute); font-weight: 400; }
.hm-nav { display: flex; gap: 1.75rem; font: 400 .9375rem/1.2 var(--sans); }
.hm-nav a { text-decoration: none; }
.hm-nav a[aria-current] { color: var(--acc); }
.hm-nav .lang { color: var(--mute); }
.hm-menu { display: none; background: none; border: 0; padding: 0; font: 400 .9375rem/1.2 var(--sans); color: inherit; cursor: pointer; }
.hm-overlay { position: fixed; inset: 0; background: var(--paper); z-index: 50; display: none; flex-direction: column; padding: 1.25rem var(--pad) 2rem; }
.hm-overlay.open { display: flex; }
.hm-overlay .bar { display: flex; justify-content: space-between; align-items: baseline; }
.hm-overlay nav { margin-top: auto; display: grid; gap: .25rem; }
.hm-overlay nav a { font: 300 2.75rem/1.1 var(--serif); text-decoration: none; }
.hm-overlay .foot { margin-top: 2.5rem; }

/* images */
.img { overflow: hidden; background: var(--tile); }
.img img { width: 100%; height: 100%; object-fit: cover; }
.r219 { aspect-ratio: 21 / 9; } .r169 { aspect-ratio: 16 / 9; } .r32 { aspect-ratio: 3 / 2; } .r43 { aspect-ratio: 4 / 3; }
.r45 { aspect-ratio: 4 / 5; } .r23 { aspect-ratio: 2 / 3; } .r11 { aspect-ratio: 1; } .rnat img { height: auto; }
figure { margin: 0; }
figcaption { font: 400 var(--wp--preset--font-size--sm)/1.5 var(--sans); color: var(--mute); margin-top: .5rem; }
.cap { display: flex; justify-content: space-between; gap: 1rem; margin-top: .75rem; align-items: baseline; }
.cap > .label { flex: none; white-space: nowrap; }
.card { display: block; text-decoration: none; }
.card .img img { transition: transform 1.2s cubic-bezier(.2, .7, .2, 1); }
.card:hover .img img { transform: scale(1.025); }
.card:hover .t-card { color: var(--acc); }

/* recognition list, the footnotes */
.rec { list-style: none; margin: 0; padding: 0; }
/* The number hangs in the gutter, so the award name starts on its column. */
.rec li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .75rem; padding: .8rem 0; border-top: 1px solid var(--line); font: 400 .9375rem/1.4 var(--sans); position: relative; }
.rec li:last-child { border-bottom: 1px solid var(--line); }
.rec .n { font: 400 .6875rem/1.9 var(--mono); color: var(--acc); position: absolute; left: -22px; top: .8rem; }
.rec .y { font: 400 .75rem/1.9 var(--mono); color: var(--mute); text-align: right; }
.rec a { text-decoration: none; }
.rec a:hover { color: var(--acc); }
.rec .src { color: var(--mute); }
.rec li:target { background: color-mix(in srgb, var(--acc) 8%, transparent); }

/* Marker themes: the footnote numbers sit on a chip of the object's second colour (ZK/U yellow, the QUOTE, UNQUOTE label blue). */
.hm-marker sup.fn a, .hm-marker .rec .n:not(:empty) { background: var(--hl); color: var(--hl-ink); padding: 2px 4px; border-radius: 2px; line-height: 1; }
.hm-marker .rec .n:not(:empty) { align-self: start; justify-self: start; margin-top: 3px; }

/* project facts + colophon */
.facts { margin: 0; }
.facts dt { font: 400 .6875rem/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--mute); margin-top: 1.125rem; }
.facts dt:first-child { margin-top: 0; }
.facts dd { font: 400 .9375rem/1.45 var(--sans); margin: .25rem 0 0; }
/* The label takes two of the seven columns, the value starts on the third. */
.specs { display: grid; grid-template-columns: calc(2 * (100% - 6 * var(--gap)) / 7 + var(--gap)) minmax(0, 1fr); border-top: 1px solid var(--ink); margin: 0; }
.specs > * { padding: .7rem 0; border-bottom: 1px solid var(--line); font: 400 .9375rem/1.45 var(--sans); margin: 0; }
.specs dt { font: 400 .75rem/1.9 var(--mono); text-transform: uppercase; letter-spacing: .04em; color: var(--mute); }
.specs dd { padding-left: var(--gap); }
.story p { margin: 0; }
.story .label { margin-top: 2.25rem; }
.story .label:first-child { margin-top: 0; }
.quote { font: 300 var(--wp--preset--font-size--xl)/1.2 var(--serif); margin: 0; }

/* controls */
.hm-btn { display: inline-flex; align-items: center; gap: .6rem; border: 1px solid currentColor; border-radius: 999px; padding: .7rem 1.2rem; font: 400 .9375rem/1 var(--sans); text-decoration: none; background: none; color: inherit; cursor: pointer; }
.hm-btn:hover { color: var(--acc); }
.hm-btn svg { width: 1.1em; height: .75em; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: .45rem .9rem; font: 400 .875rem/1 var(--sans); background: none; color: inherit; cursor: pointer; }
.chip[aria-pressed=true] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.arrow { width: 1em; height: 1em; vertical-align: -.1em; }

/* work index and recognition table: every row is the 12-column grid, so each cell starts on a column (span-N on the cells) */
.idx, .idx thead, .idx tbody { display: block; width: 100%; }
.idx tr { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); align-items: baseline; border-bottom: 1px solid var(--line); }
.idx thead tr { border-bottom-color: var(--ink); }
.idx th { text-align: left; font: 400 .6875rem/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--mute); padding: 0 0 .75rem; font-weight: 400; }
.idx td { padding: 1rem 0; vertical-align: baseline; font: 400 .9375rem/1.4 var(--sans); min-width: 0; }
.idx td.no { font: 400 .75rem/1 var(--mono); color: var(--mute); }
.idx td.no.acc { color: var(--acc); }
.idx td.t { font: 400 1.375rem/1.2 var(--serif); }
.idx td.t a { text-decoration: none; }
.idx tr.stub td { color: var(--mute); }
.idx tr[hidden] { display: none; }
.idx tbody tr:not(.stub):hover td.t a { color: var(--acc); }
.idx .rec-s { color: var(--acc); font-size: .8125rem; }
.hm-peek { position: fixed; width: 18rem; aspect-ratio: 4 / 5; pointer-events: none; z-index: 30; opacity: 0; transition: opacity .2s; background: var(--tile) center / cover no-repeat; }
.hm-peek.on { opacity: 1; }
/* Specific enough to beat the .grid-12 utility, which loads after this file. */
[data-hm-index][data-view=list] .idx-images { display: none; }
[data-hm-index][data-view=images] .idx { display: none; }
.idx-images [hidden] { display: none; }

/* writing */
.texts article { border-top: 1px solid var(--line); padding-top: 1.5rem; }
.texts article + article { margin-top: 3.5rem; }

/* footer */
.hm-foot { margin-top: var(--wp--preset--spacing--60); padding: 1.75rem var(--pad) 2.75rem; border-top: 1px solid var(--ink); }
.hm-foot .big { font: 300 clamp(1.75rem, 3.2vw, 2.75rem)/1.1 var(--serif); text-decoration: none; display: block; margin-top: .9rem; overflow-wrap: anywhere; }
.hm-foot ul { list-style: none; margin: 0; padding: 0; }
.hm-foot li { font: 400 .875rem/1.75 var(--sans); }
.hm-foot li a { text-decoration: none; }
.hm-foot .colo { font: 400 .75rem/1.5 var(--mono); color: var(--mute); margin-top: 2.5rem; }

/* 404: the wireframe cross from the old site's title cards, kept as a nod */
.hm-cross { position: relative; aspect-ratio: 3 / 2; border: 1px solid var(--ink); display: grid; place-items: center; overflow: hidden; }
.hm-cross svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hm-cross p { position: relative; background: var(--paper); padding: .25rem 1rem; font: 300 var(--wp--preset--font-size--xxl)/1 var(--serif); color: var(--acc); margin: 0; }

/* bits used by blocks */
.hm-end { align-self: end; }
/* Availability: the dot hangs in the gutter so the sentence starts on its column; on phones it follows the text. */
.hm-avail { position: relative; }
.hm-dot { position: absolute; left: -18px; top: .5em; width: .5rem; height: .5rem; border-radius: 50%; background: var(--acc); }
/* A pair on one row: the "fill" card takes its image height from its neighbour, so both images end on one line. */
@media (min-width: 782px) {
	.card.fill { display: flex; flex-direction: column; }
	.card.fill .img { aspect-ratio: auto; flex: 1; min-height: 0; position: relative; }
	.card.fill .img img { position: absolute; inset: 0; }
}
.hm-peek { left: 0; top: 0; }

/* core blocks inside page content */
.hm-prose { max-width: 46rem; }
.hm-prose p { margin: 0 0 1.1rem; }
.wp-block-group.wrap > * { max-width: none; }

@media (max-width: 781px) {
	.hm-nav { display: none; }
	.hm-menu { display: block; }
	/* Phones: the number moves to the right edge and the year under the name. */
	.rec .n { position: static; grid-column: 2; grid-row: 1; }
	.rec .y { grid-column: 1; text-align: left; }
	.specs { grid-template-columns: calc((100% - 3 * var(--gap)) / 4) minmax(0, 1fr); }
	.idx tr { grid-template-columns: repeat(4, minmax(0, 1fr)); }
	.idx tr > * { grid-column: auto / span 1; }
	.idx tr > .idx-wide { grid-column: auto / span 2; }
	.hm-avail { display: flex; gap: .65rem; align-items: baseline; }
	.hm-dot { position: static; order: 2; flex: none; align-self: center; }
	.idx .hide-m { display: none; }
	.idx td.t { font-size: 1.1875rem; }
	.r219 { aspect-ratio: 4 / 5; }
	.hm-peek { display: none; }
	.m-mt { margin-top: 2.5rem; }
}
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; animation: none !important; }
}
