/* thepeninsularcompany.com: one stylesheet for the home page, the project pages,
   the legal pages, and the 404 page. Fonts and colors come from brand.css. */

:root {
    --gutter: 40px;
    --measure: 1200px;

    /* The lake's light. Day by default; on the home page a script in the head sets
       these to Detroit's sky at this moment, before anything is drawn. */
    --g: #F1EEE6;
    --l: #1B2926;
    --glass: var(--g);
    --moon: transparent;
    --starA: 0;
    --navA: 0;
    --lampA: 0.35;
    --refA: 0;
    --glintA: 0;
    /* The year and the weather: leaves, bare trees, fog on the far and near shore, cloud, rain, snow. */
    --leaf: 1;
    --bareA: 0;
    --farA: 1;
    --nearA: 1;
    --cloudA: 0;
    --rainA: 0;
    --snowA: 0;
}

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

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

body {
    margin: 0;
    background: var(--ground);
    color: var(--ink);
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

::selection { background: var(--pine); color: #fff; }

h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; }
h1, h2, h3 { font-weight: 600; }
img { display: block; max-width: 100%; height: auto; }

a { color: inherit; transition: color 0.12s, border-color 0.12s; -webkit-tap-highlight-color: rgba(35, 75, 64, 0.14); }
a:focus-visible { outline: 2px solid var(--pine); outline-offset: 3px; }

/* The gutters give way to a phone's notch when it is held sideways. */
.wrap {
    max-width: calc(var(--measure) + 2 * var(--gutter));
    margin: 0 auto;
    padding: 0 max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
}

.grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: 24px;
}

.small { font-size: 13.5px; line-height: 1.45; font-weight: 500; }
.muted { color: var(--ink-2); }

/* A text link: the words, on a pine rule. */
.link { font-weight: 500; text-decoration: none; border-bottom: 1px solid var(--pine); padding-bottom: 1px; }
.link:hover { color: var(--pine); }

.skip {
    position: absolute;
    left: var(--gutter); top: -60px;
    z-index: 10;
    padding: 10px 14px;
    background: var(--ink);
    color: var(--ground);
    text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------- Header ---------- */
/* The compact signature. The identity standard sets its minimum width at 180px. */
.site-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px 32px;
    padding: 28px 0;
}
.home { display: block; line-height: 0; }
.mark-line { display: block; width: 222px; height: auto; }
.site-nav { display: flex; gap: 28px; }
.site-nav a { padding: 4px 0; text-decoration: none; }
.site-nav a:hover { color: var(--pine); }

/* ---------- Hero ---------- */
.hero { align-items: end; row-gap: 32px; padding-top: 72px; padding-bottom: 84px; }
.hero h1 {
    grid-column: 1 / span 8;
    font-size: clamp(42px, 5.9vw, 84px);
    font-weight: 620;
    line-height: 0.99;
    letter-spacing: -0.045em;
}
.hero h1 span { display: block; }
.hero-side { grid-column: 9 / -1; padding-bottom: 7px; }
.statement { font-size: 19px; line-height: 1.42; letter-spacing: -0.01em; text-wrap: pretty; }
.hero-side .action { margin-top: 20px; }

/* ---------- The lake ---------- */
.band { margin: 0; }
.lake {
    display: block;
    width: 100%;
    /* The drawing is pinned to its left edge and cropped on the right.
       Never taller than half the width, so a phone still shows the
       lighthouse and the whole freighter (the first 720 of 1200 units). */
    height: min(max(240px, 30vw), 50vw);
}
.lake .ground { fill: var(--g); }
.lake .draw { fill: none; stroke: var(--l); stroke-width: 0.8; }
.lake .o { fill: var(--g); }
.lake .s { fill: var(--l); }
.lake .glass { fill: var(--glass); }
.lake .orb { fill: var(--g); stroke: var(--l); stroke-width: 0.8; }
.lake .moonlit { fill: var(--moon); }
.lake .stars { fill: #E6E2D6; opacity: var(--starA); }
.lake .nav { fill: #FFF6DE; opacity: var(--navA); }
.lake .glint { stroke: var(--l); stroke-width: 0.8; opacity: var(--glintA); }
.lake .lamp { opacity: var(--lampA); }
.lake .lamp .core { fill: #FFF4D6; }
.lake .lampref { stroke: #F0B54A; stroke-width: 0.8; opacity: var(--refA); }
.lake .isle, .lake .ship { opacity: var(--farA); }
.lake .tower { opacity: var(--nearA); }
.lake .leafy { opacity: var(--leaf); }
.lake .bare { fill: none; stroke: var(--l); stroke-width: 0.4; opacity: var(--bareA); }
.lake .clouds { fill: none; stroke: var(--l); stroke-width: 0.8; opacity: var(--cloudA); }
/* No freighter while the Soo Locks are closed. */
[data-ship="out"] .lake .ship, [data-ship="out"] .lake .nav { display: none; }
/* Rain and snow are drawn only while they fall. Each moves by a whole number of its pattern's tiles, so the loop has no seam. */
.lake .rain, .lake .snow { display: none; }
.lake .drop { fill: none; stroke: var(--l); stroke-width: 0.5; }
.lake .flake { fill: var(--l); }
[data-falling="rain"] .lake .rain { display: inline; opacity: var(--rainA); animation: rain 1.6s linear infinite; }
[data-falling="snow"] .lake .snow { display: inline; opacity: var(--snowA); animation: snow 16s linear infinite; }
@keyframes rain { to { transform: translate(-90px, 360px); } }
@keyframes snow { to { transform: translate(-80px, 240px); } }
/* William Livingstone Memorial Light: occulting white, 4 s period (USCG Light List No. 8240) */
.lake .lamp circle, .lake .lampref path { animation: occult 4s steps(1, end) infinite; }
@keyframes occult { 0% { opacity: 1; } 75% { opacity: 0; } 100% { opacity: 1; } }

/* ---------- Sections ---------- */
/* Each section hangs from one ink rule: its name on the left, what it says on the right. */
main > section { padding-top: 112px; scroll-margin-top: -80px; }
.sec { row-gap: 20px; padding-top: 22px; border-top: 1px solid var(--ink); }
.section-label { grid-column: span 3; padding-top: 5px; font-size: 13.5px; font-weight: 500; line-height: 1.45; }
.section-body { grid-column: 4 / -1; }
.section-title {
    max-width: 720px;
    font-size: clamp(28px, 3.3vw, 44px);
    font-weight: 570;
    line-height: 1.08;
    letter-spacing: -0.03em;
    text-wrap: balance;
}
.section-intro { max-width: 540px; margin-top: 18px; color: var(--ink-2); text-wrap: pretty; }
.section-note { max-width: 540px; margin-top: 6px; color: var(--ink-2); font-size: 15.5px; text-wrap: pretty; }
.section-action { margin-top: 22px; }

/* ---------- Work ---------- */
/* Three projects, each a small screenshot and three lines. */
.projects {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 40px 24px;
    list-style: none;
    margin: 28px 0 0;
    padding: 0;
}
.card { position: relative; }
.shot { display: block; border: 1px solid var(--rule); background: var(--tone, var(--lake)); }
.shot img { width: 100%; aspect-ratio: 1280 / 860; object-fit: cover; object-position: top; }
.card h3 { margin-top: 18px; font-size: 21px; line-height: 1.2; letter-spacing: -0.02em; }
.card h3 a { text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; }      /* the whole card is the link */
.card:hover h3 a { color: var(--pine); }
.card:hover .shot, .card:focus-within .shot { border-color: var(--pine); }
.card .kind { margin-top: 5px; }
.card .note { max-width: 340px; margin-top: 10px; color: var(--ink-2); font-size: 15.5px; line-height: 1.45; text-wrap: balance; }

/* ---------- Services and auction houses ---------- */
.items {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 24px;
    list-style: none;
    margin: 36px 0 0;
    padding: 0;
}
.item { padding: 16px 0 28px; border-top: 1px solid var(--rule); }
.item h3 { font-size: 19px; line-height: 1.25; letter-spacing: -0.015em; }
.item p { margin-top: 8px; padding-right: 8px; color: var(--ink-2); font-size: 15.5px; line-height: 1.5; text-wrap: balance; }

/* ---------- Ventures ---------- */
.works { list-style: none; margin: 36px 0 0; padding: 0; border-top: 1px solid var(--rule); }
.work {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) 124px;
    column-gap: 24px;
    align-items: baseline;
    padding: 20px 0 22px;
    border-bottom: 1px solid var(--rule);
}
.no { font-variant-numeric: tabular-nums; white-space: nowrap; }
.no::before {
    content: "";
    display: inline-block;
    width: 9px; height: 9px;
    margin-right: 9px;
    background: var(--c);
}
.no.outlined::before { box-shadow: inset 0 0 0 1px var(--ink-2); }
.work h3 { font-size: 21px; line-height: 1.2; letter-spacing: -0.02em; }
.work h3 a { text-decoration: none; }
.work h3 a:hover { color: var(--pine); }
.what p { max-width: 460px; margin-top: 6px; color: var(--ink-2); font-size: 15.5px; text-wrap: balance; }
.links { grid-column: 2; grid-row: 2; display: flex; flex-wrap: wrap; gap: 2px 18px; margin-top: 10px; }
.links a { color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.links a:hover { color: var(--pine); text-decoration: underline; text-underline-offset: 3px; }
.meta { grid-column: 3; grid-row: 1 / span 2; text-align: right; }
.meta span { display: block; }

/* ---------- Contact ---------- */
.email {
    margin-top: 28px;
    font-size: min(clamp(22px, 2.6vw, 32px), calc((100vw - 2 * var(--gutter)) / 14.7));
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.02em;
    white-space: nowrap;
}
.email a { text-decoration: none; border-bottom: 2px solid var(--pine); }
.email a:hover { color: var(--pine); }
.principal { margin-top: 24px; }
.principal a { text-underline-offset: 3px; }

/* ---------- Footer ---------- */
/* The page's one pine field, holding the name. */
footer { margin-top: 128px; background: var(--pine); color: var(--ground); }
.foot { row-gap: 28px; align-items: end; padding-top: 56px; padding-bottom: calc(48px + env(safe-area-inset-bottom)); }
.foot > div { grid-column: span 4; }
.foot > div:last-child { text-align: right; }
.foot .mark-line { width: 210px; }
.foot .legal { margin-top: 28px; }
.foot .motto { font-size: 15px; font-weight: 500; line-height: 1.4; text-wrap: balance; }
footer .quiet { color: var(--lake); }
footer a { color: var(--ground); text-decoration: none; border-bottom: 1px solid rgba(241, 238, 230, 0.42); }
footer a:hover { border-bottom-color: var(--ground); }
footer a:focus-visible { outline-color: var(--ground); }
footer .sep { display: inline-block; width: 18px; }

/* ---------- Project pages ---------- */
.project { padding-top: 36px; }
.back a { color: var(--ink-2); text-decoration: none; }
.back a:hover { color: var(--pine); }
.project-head { align-items: end; row-gap: 28px; margin-top: 28px; padding-bottom: 36px; }
.project-title { grid-column: 1 / span 7; }
.project-title h1 { font-size: clamp(34px, 4.4vw, 60px); line-height: 1.02; letter-spacing: -0.04em; text-wrap: balance; }
.deck { max-width: 520px; margin-top: 18px; font-size: 19px; line-height: 1.42; letter-spacing: -0.01em; text-wrap: pretty; }
.facts { grid-column: 9 / -1; }
.facts div { display: grid; grid-template-columns: 76px minmax(0, 1fr); column-gap: 16px; padding: 9px 0; border-top: 1px solid var(--rule); }
.facts dt { color: var(--ink-2); }
/* The site as it looks on a desk and in a hand, at a size that leaves room for the page. */
.views { align-items: end; padding-top: 36px; border-top: 1px solid var(--ink); }
.views figure { margin: 0; }
.views img { width: 100%; border: 1px solid var(--rule); background: var(--tone, var(--lake)); }
.view-desk { grid-column: 1 / span 8; }
.view-hand { grid-column: 11 / -1; }
.story { row-gap: 28px; padding-top: 48px; }
.story .summary { grid-column: 1 / span 6; max-width: 540px; text-wrap: pretty; }
.points { grid-column: 8 / -1; list-style: none; padding: 0; }
.points li { padding: 12px 0; border-top: 1px solid var(--rule); color: var(--ink-2); font-size: 15.5px; text-wrap: pretty; }
.points li:last-child { border-bottom: 1px solid var(--rule); }
.more { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px; margin-top: 72px; }

/* ---------- Legal pages ---------- */
.doc { padding-top: 64px; }
.doc-head { grid-column: 4 / -1; }
.doc-head h1 { font-size: clamp(38px, 4.6vw, 60px); line-height: 1; letter-spacing: -0.04em; margin-left: -0.03em; }
.doc-head .updated { margin-top: 16px; }
.doc-aside { grid-column: span 3; padding-top: 6px; }
.doc-aside ol { list-style: none; padding: 0; margin: 0; position: sticky; top: 32px; }
.doc-aside li { margin: 0 0 6px; }
.doc-aside a { color: var(--ink-2); text-decoration: none; }
.doc-aside a:hover { color: var(--pine); }
.doc-body { grid-column: 4 / -1; max-width: 700px; }
.doc-body .intro { font-size: 20px; line-height: 1.45; letter-spacing: -0.01em; margin: 0 0 8px; }
.doc-body section { padding-top: 40px; scroll-margin-top: 24px; }
.doc-body h2 { font-size: 20px; line-height: 1.3; letter-spacing: -0.015em; margin: 0 0 12px; }
.doc-body p { margin: 0 0 14px; }
.doc-body ul { margin: 0 0 14px; padding-left: 1.2em; }
.doc-body li { margin: 0 0 6px; }
.doc-body a { text-underline-offset: 3px; text-decoration-color: var(--rule); }
.doc-body a:hover { color: var(--pine); text-decoration-color: currentColor; }
.doc-row { row-gap: 40px; margin-top: 56px; }

/* ---------- Page not found ---------- */
.lost { display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh; }
.lost main { flex: 1; display: flex; align-items: center; padding: 64px 0 120px; }
.lost h1 { margin: 12px 0 0 -0.03em; font-size: clamp(44px, 8vw, 96px); line-height: 0.95; letter-spacing: -0.045em; }
.lost .link { display: inline-block; margin-top: 32px; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .lake .lamp circle, .lake .lampref path, .lake .rain, .lake .snow { animation: none !important; }
}

/* ---------- Narrower ---------- */
@media (max-width: 1100px) {
    .section-label { grid-column: 1 / -1; padding-top: 0; }
    .section-body { grid-column: 1 / -1; }
    .doc-head, .doc-body { grid-column: 1 / -1; }
    .doc-aside { display: none; }
}

@media (max-width: 900px) {
    :root { --gutter: 24px; }
    .hero { padding-top: 48px; padding-bottom: 60px; }
    .hero h1 { grid-column: 1 / -1; font-size: clamp(30px, 10.8vw, 64px); }
    .hero-side { grid-column: 1 / -1; max-width: 460px; padding-bottom: 0; }
    main > section { padding-top: 88px; scroll-margin-top: -60px; }
    /* Services and auction items become rows: the name, then what it covers. */
    .items { grid-template-columns: minmax(0, 1fr); }
    .item { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); column-gap: 24px; padding: 16px 0 18px; }
    .item p { margin-top: 0; padding-right: 0; }
    .foot > div { grid-column: span 6; }
    .foot > div:last-child { grid-column: 1 / -1; text-align: left; }
    .project-title { grid-column: 1 / -1; }
    .facts { grid-column: 1 / -1; max-width: 520px; }
    .view-desk { grid-column: 1 / span 9; }
    .view-hand { grid-column: 10 / -1; }
    .story .summary, .points { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
    /* Each project becomes a row: the screenshot beside its three lines. */
    .projects { grid-template-columns: minmax(0, 1fr); row-gap: 0; margin-top: 24px; border-top: 1px solid var(--rule); }
    .card { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr); grid-template-rows: auto auto 1fr; column-gap: 20px; align-items: start; padding: 20px 0; border-bottom: 1px solid var(--rule); }
    .card .shot { grid-row: 1 / span 3; }
    .card h3 { margin-top: -2px; }
}

@media (max-width: 700px) {
    /* The nav takes its own row under the signature. */
    .site-nav { width: 100%; justify-content: space-between; gap: 0; padding-top: 12px; border-top: 1px solid var(--rule); }
}

@media (max-width: 640px) {
    :root { --gutter: 16px; }
    .grid { column-gap: 16px; }
    .site-header { padding: 20px 0 14px; }
    .mark-line { width: 196px; }
    .hero { padding-top: 36px; padding-bottom: 48px; }
    main > section { padding-top: 72px; scroll-margin-top: -48px; }
    .sec { padding-top: 18px; }
    .item { display: block; padding: 14px 0 18px; }
    .item p { margin-top: 6px; }
    .work { grid-template-columns: minmax(0, 1fr) auto; padding: 18px 0 12px; }
    .work .no { grid-column: 1; grid-row: 1; margin-bottom: 8px; }
    .work .meta { grid-column: 2; grid-row: 1; display: flex; gap: 10px; }
    .work .what { grid-column: 1 / -1; grid-row: 2; padding-bottom: 6px; }
    .work .links { grid-column: 1 / -1; grid-row: 3; gap: 0 22px; margin-top: 0; }
    .work .links a { padding: 8px 0; }
    footer { margin-top: 96px; }
    .foot { padding-top: 44px; }
    .foot > div { grid-column: 1 / -1; }
    .project { padding-top: 16px; }
    .project-head { margin-top: 20px; }
    .view-desk { grid-column: 1 / span 9; }
    .view-hand { grid-column: 10 / -1; }
    .more { margin-top: 48px; }
}

@media (max-width: 520px) {
    /* On a phone the screenshot sits above its lines, cropped to the top of the page. */
    .card { display: block; padding: 20px 0 22px; }
    .card .shot img { aspect-ratio: 16 / 9; }
    .card h3 { margin-top: 16px; }
}

@media (max-width: 360px) {
    .site-nav { font-size: 12.5px; }
}

/* ---------- Touch ---------- */
/* A full-size target behind each small link. Nothing moves. */
@media (pointer: coarse) {
    .site-nav a, .links a, .principal a, .back a, .more a, .section-action a, .hero-side .action a, footer a { position: relative; }
    .site-nav a::after, .links a::after, .principal a::after, .back a::after, .more a::after, .section-action a::after, .hero-side .action a::after, footer a::after {
        content: "";
        position: absolute;
        top: 50%; left: -6px; right: -6px;
        height: 44px;
        transform: translateY(-50%);
    }
}

/* ---------- High contrast ---------- */
/* Forced-color themes repaint the page but leave drawings alone, which would put
   a dark logo on a dark ground. Hand the drawings the theme's own colors. */
@media (forced-colors: active) {
    .mark-line * { fill: CanvasText; }
    .foot .mark-line { display: none; }
    .lake { --g: Canvas; --l: CanvasText; --glass: Canvas; --moon: transparent; --starA: 0; --navA: 0; --lampA: 0; --refA: 0; }
    .lake .flake { fill: CanvasText; }
    .no::before { forced-color-adjust: none; }
    footer { border-top: 1px solid CanvasText; }
}

/* ---------- Paper ---------- */
/* For anyone filing the page: white ground, the lake as the day drawing,
   and a footer that reads without its pine field. */
@media print {
    @page { margin: 0.6in; }
    :root { --gutter: 0px; }
    body { background: #fff; }
    .skip, .site-nav, .hero-side .action, .section-action, .back, .more { display: none; }
    .site-header { padding-top: 0; }
    .hero { padding-top: 16px; padding-bottom: 32px; }
    .hero h1 { font-size: 44px; }
    .lake { --g: #fff; --l: #1B2926; --glass: #fff; --moon: transparent; --starA: 0; --navA: 0; --lampA: 0.35; --refA: 0; --cloudA: 0; --farA: 1; --nearA: 1; }
    .lake .rain, .lake .snow { display: none !important; }
    main > section { padding-top: 30px; }
    /* Page one is the name and the lake. Page two is the work and the services.
       Page three starts with auction houses; the ventures and contact follow. */
    #portfolio, #advisory { break-before: page; padding-top: 0; }
    #consulting, #contact { break-inside: avoid; }
    .sec { padding-top: 14px; row-gap: 12px; }
    .projects { margin-top: 12px; }
    .items { margin-top: 18px; }
    .works { margin-top: 20px; }
    .section-title { font-size: 26px; }
    .projects { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 0; border: 0; }
    .card { display: block; padding: 0; border: 0; }
    .items { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .item { display: block; padding: 12px 0 16px; }
    .item p { margin-top: 6px; }
    p { orphans: 3; widows: 3; }
    h2, h3 { break-after: avoid; }
    li, .contact, footer, .views { break-inside: avoid; }
    .work { padding: 14px 0 16px; }
    .work h3 a::after { content: attr(href); margin-left: 12px; font-family: var(--font); font-size: 13.5px; font-weight: 500; letter-spacing: 0; color: var(--ink-2); }
    footer { margin-top: 56px; border-top: 1px solid var(--ink); background: none; color: var(--ink); }
    .foot { padding-top: 24px; padding-bottom: 0; }
    .foot .mark-line { display: none; }             /* the white signature has nothing to sit on */
    footer a { color: var(--ink); border-bottom-color: var(--rule); }
    footer .quiet { color: var(--ink-2); }
}
