/*
Theme Name: HMH Datasheet
Theme URI: https://www.hmhgroup.fi/
Author: HMH Group Oy
Description: One-page theme for HMH Group Oy (Henri Hakunti). Engineer's datasheet look. All front page content is editable in the block editor; the sections come as ready-made patterns under "HMH Group".
Version: 1.5.0
Requires at least: 6.4
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: hmh-datasheet
*/
:root {
  --ink: #14202B;
  --paper: #F4F1EA;
  --paper-2: #EBE6DB;
  --rule: #D3CCBE;
  --rule-dark: #33414E;
  --muted: #4A5561;
  --muted-dark: #B4BCC4;
  --accent: #B83F12;
  --accent-bright: #F07A3E;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-text: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --wrap: 1160px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --section: clamp(4rem, 10vw, 7.5rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.wrap { width: 100%; max-width: var(--wrap); margin-left: auto !important; margin-right: auto !important; padding: 0 var(--gutter); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--ink); color: var(--paper); padding: .5rem 1rem; z-index: 10; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.08; margin: 0; letter-spacing: -.01em; }
h2 { font-size: clamp(2rem, 5vw, 3.25rem); }
h3 { font-size: 1.35rem; }
p { margin: 0 0 1.1em; }


.hmh-page > *, .hmh-page > .wp-block-group__inner-container > * { margin: 0 !important; }
.hmh-page .wp-block-group > *, .hmh-page .wp-block-group > .wp-block-group__inner-container > * { margin-block-start: 0; }
.hmh-page .wp-block-group { margin-top: 0; margin-bottom: 0; }

.mono, .label, .hmh-page .label {
  font-family: var(--font-mono);
  font-size: .75rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.hmh-page .label { color: var(--accent); display: block; margin: 0 0 1rem; }


.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.25rem; }
.brand { font-family: var(--font-mono); font-weight: 500; font-size: .9rem; letter-spacing: .06em; text-transform: uppercase; text-decoration: none; display: flex; align-items: center; gap: .6rem; }
.brand-mark { width: .8rem; height: .8rem; background: var(--accent); display: inline-block; }
.nav { display: flex; gap: 1.5rem; align-items: center; }
.nav a { font-family: var(--font-mono); font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; text-decoration: none; color: var(--muted); }
.nav a:hover { color: var(--ink); }
.nav .nav-hide { display: none; }
@media (min-width: 760px) { .nav .nav-hide { display: inline; } }


.btn, .hmh-page .wp-block-button__link {
  display: inline-flex; align-items: center; gap: .6rem;
  background: var(--ink); color: var(--paper);
  font-family: var(--font-mono); font-size: .82rem; letter-spacing: .06em; text-transform: uppercase;
  padding: .95rem 1.4rem; text-decoration: none; border: 1px solid var(--ink); border-radius: 0;
  cursor: pointer; line-height: 1.3;
}
.btn:hover, .hmh-page .wp-block-button__link:hover { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.hmh-page .is-style-hmh-ghost .wp-block-button__link { background: transparent; color: var(--ink); }
.hmh-page .is-style-hmh-ghost .wp-block-button__link:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.hmh-page .wp-block-buttons { gap: .75rem; }


.hero { padding: clamp(3rem, 8vw, 6rem) 0 clamp(3rem, 7vw, 5rem); }
.hero-grid { display: grid; gap: 3rem; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: 1.25fr .85fr; gap: 4.5rem; align-items: end; } }
.hero h1 { font-size: clamp(2.6rem, 7.5vw, 5.4rem); margin: 0 0 1.75rem; }
.hero h1 em { font-weight: 400; color: var(--accent); }
.hero .lede { font-size: clamp(1.1rem, 2vw, 1.3rem); color: var(--muted); max-width: 36rem; margin: 0 0 2.25rem; }
.hmh-page .roles { list-style: none; padding: 0; margin: 0 0 1.75rem; display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; color: var(--muted); font-family: var(--font-mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
.hmh-page .roles li::before { content: ""; display: inline-block; width: .4rem; height: .4rem; background: var(--accent); margin-right: .5rem; vertical-align: middle; }

.hmh-page .figure { border: 1px solid var(--ink); background: var(--paper-2); }
.hmh-page .figure .wp-block-image { margin: 0; }
.hmh-page .figure img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.hmh-page .title-block { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--ink); }
.hmh-page .title-block > div, .hmh-page .title-block > .wp-block-group__inner-container > div { padding: .6rem .8rem; border-right: 1px solid var(--ink); }
.hmh-page .title-block > div:nth-child(2n), .hmh-page .title-block > .wp-block-group__inner-container > div:nth-child(2n) { border-right: 0; }
.hmh-page .title-block > div:nth-child(n+3), .hmh-page .title-block > .wp-block-group__inner-container > div:nth-child(n+3) { border-top: 1px solid var(--ink); }
.hmh-page .title-block p { margin: 0; }
.hmh-page .title-block .k { font-family: var(--font-mono); font-size: .65rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.hmh-page .title-block .v { font-size: .9rem; font-weight: 500; }


.spec { background: var(--ink); color: var(--paper); padding: var(--section) 0; }
.spec-head { display: grid; gap: 1.25rem; margin-bottom: 3rem !important; }
@media (min-width: 900px) { .spec-head { grid-template-columns: 1fr 1fr; align-items: end; } }
.hmh-page .spec .label { color: var(--accent-bright); }
.spec-head > p, .spec-head > .wp-block-group__inner-container > p { color: var(--muted-dark); margin: 0; max-width: 32rem; }
.spec-grid { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--rule-dark); border-left: 1px solid var(--rule-dark); }
@media (min-width: 900px) { .spec-grid { grid-template-columns: repeat(5, 1fr); } }
.hmh-page .spec-cell { border-right: 1px solid var(--rule-dark); border-bottom: 1px solid var(--rule-dark); padding: 1.25rem 1.1rem 1.5rem; display: flex; flex-direction: column; gap: .6rem; min-height: 11rem; }
.hmh-page .spec-cell p { margin: 0; }
.hmh-page .spec-cell .ref { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .08em; color: var(--muted-dark); }
.hmh-page .spec-cell .num { font-family: var(--font-display); font-weight: 600; font-size: clamp(2.1rem, 5vw, 3rem); line-height: 1; color: var(--paper); margin-top: auto; }
.hmh-page .spec-cell .num em { font-style: normal; font-size: .5em; color: var(--accent-bright); margin-left: .1em; }
.hmh-page .spec-cell .cap { font-size: .9rem; color: var(--muted-dark); line-height: 1.4; }
.hmh-page .spec-cell.wide { grid-column: span 2; }
@media (min-width: 900px) { .hmh-page .spec-cell.wide { grid-column: auto; } }


.journey { padding: var(--section) 0; }
.journey h2 { margin: 0 0 3rem; max-width: 42rem; }
.timeline { display: grid; border-left: 1px solid var(--ink); }
@media (min-width: 900px) { .timeline { grid-template-columns: repeat(4, 1fr); border-left: 0; border-top: 1px solid var(--ink); } }
.hmh-page .timeline-item { position: relative; padding: 0 0 2.25rem 1.75rem; }
@media (min-width: 900px) { .hmh-page .timeline-item { padding: 2rem 1.75rem 0 0; } }
.hmh-page .timeline-item::before { content: ""; position: absolute; left: -.4rem; top: .35rem; width: .8rem; height: .8rem; background: var(--paper); border: 1px solid var(--ink); }
@media (min-width: 900px) { .hmh-page .timeline-item::before { left: 0; top: -.4rem; } }
.hmh-page .timeline-item.now::before { background: var(--accent); border-color: var(--accent); }
.hmh-page .timeline-item .year { font-family: var(--font-mono); font-size: .8rem; letter-spacing: .06em; color: var(--accent); margin: 0 0 .4rem; }
.hmh-page .timeline-item h3 { margin: 0 0 .5rem; }
.hmh-page .timeline-item p:last-child { color: var(--muted); font-size: .98rem; margin: 0; }


.story { padding: 0 0 var(--section); }
.story-grid { display: grid; gap: 2.5rem; border-top: 1px solid var(--rule); padding-top: clamp(3rem, 6vw, 4.5rem); }
@media (min-width: 900px) { .story-grid { grid-template-columns: .8fr 1.2fr; gap: 4.5rem; } }
.story-body { max-width: 40rem; }
.hmh-page .story-body > p:first-child, .hmh-page .story-body > .wp-block-group__inner-container > p:first-child { font-family: var(--font-display); font-size: clamp(1.35rem, 2.6vw, 1.7rem); line-height: 1.35; }


.quote { background: var(--paper-2); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: clamp(3.5rem, 8vw, 6rem) 0; }
.hmh-page .quote .wp-block-quote { margin: 0; padding: 0; border: 0; max-width: 50rem; }
.hmh-page .quote .wp-block-quote p { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: clamp(1.6rem, 4vw, 2.6rem); line-height: 1.25; margin: 0 0 1.25rem; }
.hmh-page .quote cite { display: block; font-style: normal; font-family: var(--font-mono); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }


.help { padding: var(--section) 0; }
.help-intro { display: grid; gap: 1.5rem; margin-bottom: 3.5rem !important; }
@media (min-width: 900px) { .help-intro { grid-template-columns: 1fr 1fr; gap: 4.5rem; align-items: end; } }
.help-intro > p, .help-intro > .wp-block-group__inner-container > p { color: var(--muted); margin: 0; font-size: 1.1rem; }
.lists { display: grid; gap: 3rem; }
@media (min-width: 900px) { .lists { grid-template-columns: 1fr 1fr; gap: 4.5rem; } }
.lists h3 { padding-bottom: 1rem; border-bottom: 1px solid var(--ink); margin: 0; }
.hmh-page .numbered { list-style: none; margin: 0; padding: 0; counter-reset: item; }
.hmh-page .numbered li { counter-increment: item; display: grid; grid-template-columns: 2.75rem 1fr; gap: .5rem; padding: .95rem 0; border-bottom: 1px solid var(--rule); margin: 0; }
.hmh-page .numbered li::before { content: counter(item, decimal-leading-zero); font-family: var(--font-mono); font-size: .78rem; color: var(--accent); padding-top: .2rem; }

.hmh-page .aside { margin-top: 3.5rem !important; border: 1px dashed var(--ink); padding: 1.5rem; display: grid; gap: .75rem; }
@media (min-width: 760px) { .hmh-page .aside { grid-template-columns: auto 1fr; gap: 2rem; align-items: center; } }
.hmh-page .aside p { margin: 0; font-size: 1.1rem; }
.hmh-page .aside .aside-label { font-family: var(--font-mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }


.contact { background: var(--ink); color: var(--paper); padding: var(--section) 0; }
.hmh-page .contact .label { color: var(--accent-bright); }
.contact-grid { display: grid; gap: 3rem; }
@media (min-width: 900px) { .contact-grid { grid-template-columns: 1fr 1fr; gap: 4.5rem; } }
.contact h2 { margin: 0 0 1.5rem; }
.hmh-page .contact .muted { color: var(--muted-dark); max-width: 30rem; }
.hmh-page .email-big a { font-family: var(--font-display); font-size: clamp(1.5rem, 4.2vw, 2.4rem); color: var(--paper); text-decoration: none; border-bottom: 2px solid var(--accent-bright); overflow-wrap: anywhere; }
.hmh-page .email-big a:hover { color: var(--accent-bright); }


.form { display: grid; gap: 1.1rem; }
.form label { display: grid; gap: .4rem; font-family: var(--font-mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-dark); }
.form input, .form textarea {
  font: inherit; font-family: var(--font-text); font-size: 1rem; text-transform: none; letter-spacing: 0;
  color: var(--paper); background: transparent; border: 1px solid var(--rule-dark); padding: .85rem 1rem; border-radius: 0; width: 100%;
}
.form input:focus, .form textarea:focus { border-color: var(--accent-bright); outline: none; }
.form textarea { min-height: 9rem; resize: vertical; }
.form .btn { background: var(--accent-bright); border-color: var(--accent-bright); color: var(--ink); justify-self: start; }
.form .btn:hover { background: var(--paper); border-color: var(--paper); color: var(--ink); }
.form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.notice { padding: 1rem 1.25rem; border: 1px solid var(--accent-bright); color: var(--paper); margin: 0 0 1.25rem; }
.notice.error { border-color: #E06A6A; }


.site-footer { background: var(--ink); color: var(--muted-dark); border-top: 1px solid var(--rule-dark); padding: 1.75rem 0; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem; }
.site-footer a { color: var(--muted-dark); }


.content-area { padding: var(--section) 0; }
.entry { max-width: 44rem; margin-bottom: 4rem; }
.entry h1, .entry h2.entry-title { font-size: clamp(2.2rem, 5vw, 3.4rem); margin-bottom: 1rem; }
.entry h2.entry-title a { text-decoration: none; }
.entry-meta { font-family: var(--font-mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 2rem; }
.entry-content h2 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); margin: 2.5rem 0 1rem; }
.entry-content h3 { margin: 2rem 0 .75rem; }
.entry-content a { color: var(--accent); }
.entry-content img { margin: 1.5rem 0; }
.pagination { font-family: var(--font-mono); font-size: .8rem; display: flex; gap: 1rem; }
.screen-reader-text { position: absolute; left: -9999px; }


.hmh-page .wp-block-group > *:not(.wrap), .hmh-page .wp-block-group > .wp-block-group__inner-container > *:not(.wrap) { max-width: none; margin-left: 0 !important; margin-right: 0 !important; }
.hmh-page .wrap { max-width: var(--wrap) !important; }

.hmh-page .hero-grid, .hmh-page .spec-head, .hmh-page .spec-grid, .hmh-page .timeline, .hmh-page .story-grid, .hmh-page .help-intro, .hmh-page .lists, .hmh-page .contact-grid, .hmh-page .title-block, .hmh-page .aside { display: grid !important; flex-wrap: nowrap !important; align-items: stretch; justify-content: stretch; }


.hmh-page .hero-grid > *, .hmh-page .hero-grid > .wp-block-group__inner-container > *, .hmh-page .spec-head > *, .hmh-page .spec-head > .wp-block-group__inner-container > *, .hmh-page .spec-grid > *, .hmh-page .spec-grid > .wp-block-group__inner-container > *, .hmh-page .timeline > *, .hmh-page .timeline > .wp-block-group__inner-container > *, .hmh-page .story-grid > *, .hmh-page .story-grid > .wp-block-group__inner-container > *, .hmh-page .help-intro > *, .hmh-page .help-intro > .wp-block-group__inner-container > *, .hmh-page .lists > *, .hmh-page .lists > .wp-block-group__inner-container > *, .hmh-page .contact-grid > *, .hmh-page .contact-grid > .wp-block-group__inner-container > *, .hmh-page .title-block > *, .hmh-page .title-block > .wp-block-group__inner-container > *, .hmh-page .aside > *, .hmh-page .aside > .wp-block-group__inner-container > * { min-width: 0; width: auto !important; flex: none !important; }


.hmh-page .hero-grid, .hmh-page .spec-head, .hmh-page .story-grid, .hmh-page .help-intro, .hmh-page .lists, .hmh-page .contact-grid, .hmh-page .aside, .hmh-page .timeline { grid-template-columns: minmax(0, 1fr) !important; }
.hmh-page .spec-grid, .hmh-page .title-block { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.hmh-page .hero-grid, .hmh-page .lists, .hmh-page .contact-grid { gap: 3rem !important; }
.hmh-page .story-grid { gap: 2.5rem !important; }
.hmh-page .spec-head, .hmh-page .help-intro { gap: 1.25rem !important; }
.hmh-page .spec-grid, .hmh-page .timeline, .hmh-page .title-block { gap: 0 !important; }
.hmh-page .aside { gap: .75rem !important; }

@media (min-width: 760px) {
  .hmh-page .aside { grid-template-columns: auto minmax(0, 1fr) !important; gap: 2rem !important; align-items: center; }
}
@media (min-width: 900px) {
  .hmh-page .hero-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, .85fr) !important; gap: 4.5rem !important; align-items: end; }
  .hmh-page .spec-head, .hmh-page .help-intro { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; align-items: end; }
  .hmh-page .help-intro, .hmh-page .lists, .hmh-page .contact-grid { gap: 4.5rem !important; }
  .hmh-page .lists, .hmh-page .contact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .hmh-page .story-grid { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr) !important; gap: 4.5rem !important; }
  .hmh-page .spec-grid { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
  .hmh-page .timeline { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
}


.hmh-page .spec-cell { display: flex !important; flex-direction: column !important; flex-wrap: nowrap !important; align-items: flex-start !important; gap: .6rem !important; }
.hmh-page .spec-cell > *, .hmh-page .spec-cell > .wp-block-group__inner-container > * { margin: 0 !important; }
.hmh-page .spec-cell .num { margin-top: auto !important; white-space: nowrap; }
.hmh-page .spec-cell .cap { overflow-wrap: break-word; }
.hmh-page .numbered, .hmh-page .roles { padding-left: 0 !important; }
.hmh-page .numbered li { display: grid !important; grid-template-columns: 2.75rem minmax(0, 1fr) !important; overflow-wrap: break-word; }
.hmh-page .numbered li > *, .hmh-page .numbered li > .wp-block-group__inner-container > * { grid-column: 2; }
.hmh-page .roles { display: flex !important; flex-wrap: wrap !important; }


/* v1.3: WordPress's legacy Group wrapper must not break the grids */
.wp-block-group__inner-container { display: contents; }

/* v1.3: buttons side by side, numbers aligned across spec cells */
.hmh-page .wp-block-buttons, .hmh-page .wp-block-buttons > .wp-block-group__inner-container { display: flex !important; flex-wrap: wrap; gap: .75rem; align-items: center; }
.hmh-page .wp-block-buttons > * { margin: 0 !important; }
.hmh-page .spec-cell .num, .hmh-page .spec-cell > .wp-block-group__inner-container > .num { margin-top: 1.75rem !important; }

/* ==========================================================
   v1.4: phone and tablet polish
   ========================================================== */

/* Bigger tap targets (about 44px tall) */
.nav a { display: inline-block; padding: .8rem .2rem; }
.brand { padding: .6rem 0; }
.hmh-page .email-big a { display: inline-block; padding: .3rem 0; }
.site-footer a { display: inline-block; padding: .6rem 0; }

/* Small labels stay readable */
.hmh-page .title-block .k, .hmh-page .spec-cell .ref { font-size: .72rem; }

/* Form: no zoom-on-focus on iPhone */
.form input, .form textarea { font-size: max(16px, 1rem); }

/* Phones and tablets: portrait never fills the whole screen */
@media (max-width: 899px) {
  .hmh-page .figure { max-width: 440px; width: 100%; }
}

/* Tablets: hero in two columns, numbers as 3 + 2 */
@media (min-width: 700px) and (max-width: 899px) {
  .hmh-page .hero-grid { grid-template-columns: minmax(0, 1.3fr) minmax(0, .9fr) !important; gap: 2.5rem !important; align-items: end; }
  .hmh-page .hero h1 { font-size: clamp(2.6rem, 6.2vw, 3.4rem); }
  .hmh-page .spec-grid { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; }
  .hmh-page .spec-cell { grid-column: span 2 !important; }
  .hmh-page .spec-cell:nth-child(n+4) { grid-column: span 3 !important; }
}

/* Small phones */
@media (max-width: 479px) {
  .hmh-page .wp-block-buttons { flex-direction: column; align-items: stretch !important; }
  .hmh-page .wp-block-buttons .wp-block-button { width: 100%; }
  .hmh-page .wp-block-button__link { width: 100%; justify-content: center; text-align: center; padding-top: 1.05rem; padding-bottom: 1.05rem; }
  .form .btn { justify-self: stretch; justify-content: center; padding-top: 1.05rem; padding-bottom: 1.05rem; }
  .hmh-page .spec-cell { min-height: 9rem; padding: 1rem .9rem 1.2rem; }
  .hmh-page .spec-cell .num { margin-top: 1.25rem !important; }
}

/* v1.5: logo from Customizer > Site Identity */
.brand .custom-logo { height: var(--logo-h, 36px); width: auto; max-width: min(60vw, 320px); object-fit: contain; display: block; }
.brand.has-logo { gap: .8rem; }
@media (max-width: 479px) { .brand .custom-logo { height: min(var(--logo-h, 36px), 40px); max-width: 55vw; } }
