/* ============================================================
   Patrick Wrazidlo — Portfolio
   Industrielle Optik: technische Zeichnung / P&ID
   ============================================================ */

:root {
  --paper: #f6f4ee;
  --paper-2: #efece3;
  --ink: #1d2733;
  --ink-soft: #46566a;
  --line: #9aa5b1;
  --line-soft: #d4d9de;
  --accent: #e05a10;          /* Sicherheitsorange */
  --accent-dark: #b94708;
  --mono: "Consolas", "Cascadia Mono", ui-monospace, monospace;
  --sans: "Segoe UI", system-ui, Arial, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background-color: var(--paper);
  /* Echtes R&I-Fließbild (Ausschnitt) als feststehender Hintergrund über feinem Raster */
  background-image:
    url("bg-flowsheet.png"),
    linear-gradient(rgba(154,165,177,.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(154,165,177,.14) 1px, transparent 1px);
  background-size: cover, 20px 20px, 20px 20px;
  background-position: center top, 0 0, 0 0;
  background-repeat: no-repeat, repeat, repeat;
  background-attachment: fixed, scroll, scroll;
  line-height: 1.65;
}

/* Zeichnungsrahmen */
.drawing-frame {
  max-width: 1100px;
  margin: 24px auto;
  border: 2px solid var(--ink);
  outline: 1px solid var(--ink);
  outline-offset: 5px;
  background: rgba(246, 244, 238, .88);
  backdrop-filter: blur(1px);
}

/* Sprachumschaltung */
html[data-lang="de"] .lang-en { display: none; }
html[data-lang="en"] .lang-de { display: none; }

/* ======================= Header ======================= */
.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 28px;
  border-bottom: 2px solid var(--ink);
  position: sticky;
  top: 0;
  background: var(--paper);
  z-index: 10;
}

.header-tag { display: flex; align-items: baseline; gap: 14px; }

.tag-no {
  font-family: var(--mono);
  font-size: .8rem;
  font-weight: 700;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  padding: 2px 8px;
}

.tag-title {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .14em;
  color: var(--ink-soft);
}

.site-nav { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }

.site-nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  padding-bottom: 2px;
}
.site-nav a:hover { border-bottom-color: var(--accent); color: var(--accent-dark); }

.lang-toggle {
  font-family: var(--mono);
  font-size: .85rem;
  background: none;
  border: 1.5px solid var(--ink);
  padding: 4px 10px;
  cursor: pointer;
  color: var(--ink);
}
.lang-toggle:hover { border-color: var(--accent); }
.lang-opt { opacity: .4; font-weight: 700; }
.lang-sep { margin: 0 4px; opacity: .4; }
html[data-lang="de"] .lang-opt[data-lang-opt="de"],
html[data-lang="en"] .lang-opt[data-lang-opt="en"] { opacity: 1; color: var(--accent); }

/* ======================= Hero ======================= */
.hero {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 32px;
  padding: 64px 48px 48px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

.eyebrow {
  font-family: var(--mono);
  font-size: .8rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.1;
  letter-spacing: -.01em;
  margin-bottom: 18px;
}

.hero-sub {
  font-size: 1.08rem;
  color: var(--ink-soft);
  max-width: 34em;
  margin-bottom: 26px;
}

.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 30px; }

.btn {
  display: inline-block;
  padding: 11px 22px;
  font-weight: 700;
  font-size: .95rem;
  text-decoration: none;
  border: 2px solid var(--ink);
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 3px 3px 0 var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent-dark); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-lg { font-size: 1.1rem; padding: 14px 30px; font-family: var(--mono); }

/* Portrait — groß, rechte Hero-Spalte */
.hero-photo {
  position: relative;
  justify-self: center;
  align-self: start;
  width: 100%;
  max-width: 360px;
}
.hero-photo img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 2px solid var(--ink);
  box-shadow: 8px 8px 0 rgba(29, 39, 51, .15);
  display: block;
}
.hero-photo img.missing { display: none; }
.photo-tag {
  position: absolute;
  top: -13px;
  right: 14px;
  z-index: 1;
  font-family: var(--mono);
  font-size: .75rem;
  font-weight: 700;
  background: var(--ink);
  color: var(--paper);
  padding: 3px 10px;
}
.portrait-placeholder {
  display: none;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 2px dashed var(--line);
  background: var(--paper-2);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px;
}
.portrait-placeholder.show { display: flex; }
.initials {
  font-family: var(--mono);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--line);
}
.placeholder-hint { font-size: .62rem; color: var(--ink-soft); line-height: 1.4; }

/* P&ID-Grafik (Soft-Sensor-Sektion) */
.pid-art svg { width: 100%; height: auto; max-height: 440px; }
.pid-art .ln   { fill: none; stroke: var(--ink); stroke-width: 2; }
.pid-art .sig  { fill: none; stroke: var(--ink-soft); stroke-width: 1.5; stroke-dasharray: 6 5; }
.pid-art .fill { fill: var(--ink); }
.pid-art .box  { fill: var(--paper); }
.pid-art .inst { fill: var(--paper); }
.pid-art .accent-ln { stroke: var(--accent); }
.pid-art .lbl  {
  font-family: var(--mono);
  font-size: 13px;
  fill: var(--ink-soft);
  letter-spacing: .08em;
}
.pid-art .lbl.mid { text-anchor: middle; }
.pid-art .lbl.strong { fill: var(--ink); font-weight: 700; }
.pid-art .lbl.accent { fill: var(--accent); font-weight: 700; }

/* ======================= Sektionen ======================= */
.section { padding: 56px 48px; border-bottom: 1px solid var(--line); }

.section h2 {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 1.7rem;
  margin-bottom: 26px;
  letter-spacing: -.01em;
}

.sec-no {
  font-family: var(--mono);
  font-size: .95rem;
  font-weight: 700;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  padding: 3px 10px;
  flex-shrink: 0;
}

.section-intro { color: var(--ink-soft); margin: -10px 0 30px; max-width: 44em; }

.prose p { max-width: 44em; margin-bottom: 16px; }
.prose strong { color: var(--accent-dark); }

.two-col { column-gap: 48px; }
@media (min-width: 880px) {
  .two-col { columns: 2; }
  .two-col p { break-inside: avoid; }
}

/* Fakten-Leiste */
.fact-strip {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0;
  margin-top: 34px;
  border: 2px solid var(--ink);
}
.fact-strip li {
  padding: 14px 18px;
  border-right: 1px solid var(--line);
  font-size: .85rem;
  color: var(--ink-soft);
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--paper);
}
.fact-strip li:last-child { border-right: none; }
.fact-strip strong {
  font-family: var(--mono);
  font-size: .95rem;
  color: var(--ink);
}

/* ======================= Timeline ======================= */
.timeline {
  list-style: none;
  position: relative;
  margin-left: 34px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 2px;
  background: var(--ink);
}
.timeline li {
  position: relative;
  padding: 0 0 34px 76px;
}
.timeline li:last-child { padding-bottom: 0; }

/* Instrumenten-Kreis als Knoten */
.node {
  position: absolute;
  left: -31px;
  top: 0;
  width: 62px; height: 62px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}
.timeline li:hover .node { border-color: var(--accent); color: var(--accent); }

.t-body h3 { font-size: 1.12rem; margin-bottom: 6px; }
.t-body p { color: var(--ink-soft); max-width: 42em; font-size: .95rem; }

/* ======================= Projekt-Karten ======================= */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.card {
  position: relative;
  border: 2px solid var(--ink);
  background: var(--paper);
  padding: 26px 24px 20px;
  display: flex;
  flex-direction: column;
}
.card.featured { box-shadow: 5px 5px 0 rgba(29, 39, 51, .15); }
.card.featured::after {
  content: "★";
  position: absolute;
  top: -1px;
  left: -1px;
  background: var(--accent);
  color: #fff;
  font-size: .7rem;
  padding: 2px 7px;
}

.card-tag {
  position: absolute;
  top: -13px;
  right: 14px;
  font-family: var(--mono);
  font-size: .75rem;
  font-weight: 700;
  background: var(--ink);
  color: var(--paper);
  padding: 3px 10px;
}

.card h3 { font-size: 1.12rem; margin-bottom: 12px; padding-right: 10px; }
.card p { font-size: .93rem; color: var(--ink-soft); margin-bottom: 12px; }

.takeaway {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  font-style: italic;
  color: var(--ink) !important;
}

.chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
}
.chips li {
  font-family: var(--mono);
  font-size: .72rem;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  padding: 3px 9px;
}

/* ======================= Pitch / Steps ======================= */
.pitch { background: var(--paper-2); }

.pitch-grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 40px;
  align-items: center;
}

.steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 34px;
  counter-reset: step;
}
.steps li {
  border: 2px solid var(--ink);
  background: var(--paper);
  padding: 22px 20px;
  position: relative;
}
.step-no {
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  display: block;
  margin-bottom: 8px;
}
.steps h3 { font-size: 1.05rem; margin-bottom: 8px; }
.steps p { font-size: .9rem; color: var(--ink-soft); }

/* ======================= Kontakt ======================= */
.contact { text-align: center; padding-bottom: 72px; }
.contact h2 { justify-content: center; }
.contact-lead {
  max-width: 36em;
  margin: 0 auto 30px;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

/* ======================= Zeichnungskopf (Footer) ======================= */
.titleblock {
  display: grid;
  grid-template-columns: 2fr 1.2fr .7fr .5fr .7fr;
  border-top: 2px solid var(--ink);
  font-family: var(--mono);
  font-size: .8rem;
}
.tb-cell {
  padding: 10px 14px;
  border-right: 1px solid var(--ink);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tb-cell:last-child { border-right: none; }
.tb-label {
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-soft);
}

/* ======================= Wide cards ======================= */
.card.wide { grid-column: 1 / -1; }

.wide-card-inner {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 28px;
  align-items: start;
}

.wide-card-text {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.wide-card-text h3 { padding-right: 0; }
.wide-card-visual { min-width: 0; }

.diagram-caption {
  font-family: var(--mono);
  font-size: .72rem;
  line-height: 1.5;
  letter-spacing: .02em;
  color: var(--ink-soft);
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
  font-style: italic;
}

/* PDF-Link-Button */
.pdf-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 10px 16px;
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  text-decoration: none;
  color: var(--ink);
  font-size: .88rem;
  font-weight: 700;
  align-self: flex-start;
  transition: transform .12s ease, box-shadow .12s ease;
}
.pdf-link:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--accent);
}
.pdf-link:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}
.pdf-ico {
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  background: var(--accent);
  color: #fff;
  padding: 3px 7px;
}

/* ======================= House widget ======================= */
.house-controls {
  margin: 14px 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.slider-row {
  display: grid;
  grid-template-columns: 76px 1fr 58px;
  align-items: center;
  gap: 10px;
}

.slider-label {
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--ink);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--line-soft);
  border-radius: 0;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px; height: 16px;
  background: var(--accent);
  border: 2px solid var(--accent-dark);
  border-radius: 0;
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  background: var(--accent);
  border: 2px solid var(--accent-dark);
  border-radius: 0;
  cursor: pointer;
}

.slider-row strong {
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--ink);
  text-align: right;
}

.heat-display {
  border: 1.5px solid var(--line);
  background: var(--paper-2);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.heat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.heat-label {
  font-family: var(--mono);
  font-size: .76rem;
  color: var(--ink-soft);
}

.heat-value {
  font-family: var(--mono);
  font-size: .88rem;
  font-weight: 700;
  color: var(--ink);
}

.heat-value.accent {
  font-size: 1.05rem;
  color: var(--accent);
}

.widget-note {
  font-size: .72rem;
  color: var(--line);
  font-style: italic;
  margin-top: 2px;
}

.house-visual {
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
}

/* ======================= Responsive ======================= */

/* Tablet & darunter: einspaltiges Layout */
@media (max-width: 860px) {
  .drawing-frame { margin: 10px; outline: none; }
  .hero { grid-template-columns: 1fr; padding: 40px 24px 32px; }
  .hero-photo { order: -1; max-width: 280px; margin: 0 auto; }
  .pitch-grid { grid-template-columns: 1fr; }
  .pid-art { max-width: 340px; margin: 0 auto; }
  .wide-card-inner { grid-template-columns: 1fr; }
  .house-visual { order: -1; }
  .section { padding: 40px 24px; }
  .site-header { padding: 12px 16px; }
  .tag-title { display: none; }
  .timeline { margin-left: 26px; }
  .timeline li { padding-left: 56px; }
  .node { width: 52px; height: 52px; left: -26px; }
  .titleblock { grid-template-columns: 1fr 1fr; }
  .tb-cell { border-bottom: 1px solid var(--line); }
}

/* Handy: Feinschliff für schmale Screens */
@media (max-width: 560px) {
  /* fester Hintergrund ruckelt auf iOS -> mitscrollen, dezenter kacheln */
  body {
    background-attachment: scroll, scroll, scroll;
    background-size: 150% auto, 20px 20px, 20px 20px;
    background-repeat: repeat-y, repeat, repeat;
  }
  .drawing-frame { margin: 6px; border-width: 1.5px; }

  /* Kopfzeile: Marke oben, Navigation darunter, umbruchsicher */
  .site-header { padding: 10px 14px; gap: 8px; }
  .site-nav { width: 100%; gap: 12px 14px; justify-content: flex-start; }
  .site-nav a { font-size: .82rem; }

  /* Abschnitte kompakter */
  .section { padding: 32px 18px; }
  .hero { padding: 28px 18px 26px; gap: 24px; }
  .section h2 { font-size: 1.4rem; gap: 12px; }
  .hero-sub { font-size: 1rem; }

  /* Buttons: volle Breite, gut antippbar */
  .hero-actions { gap: 10px; }
  .hero-actions .btn { flex: 1 1 100%; text-align: center; }
  .btn:hover { transform: none; box-shadow: none; }

  /* Faktenleiste: sauber gestapelt mit Unterlinien statt rechter Kante */
  .fact-strip { grid-template-columns: 1fr; }
  .fact-strip li { border-right: none; border-bottom: 1px solid var(--line); }
  .fact-strip li:last-child { border-bottom: none; }

  /* Zeitleiste etwas enger */
  .timeline { margin-left: 22px; }
  .timeline li { padding-left: 50px; }
  .node { width: 46px; height: 46px; left: -23px; font-size: .95rem; }
  .t-body h3 { font-size: 1.05rem; }

  /* Breites Blockfließbild horizontal scrollbar statt winzig */
  .wide-card-visual { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .flow-wide { min-width: 460px; }

  /* Kontakt-Button: bricht nie über den Rand */
  .btn-lg { font-size: .95rem; padding: 12px 18px; word-break: break-all; }
  .contact { padding-bottom: 48px; }

  /* Zeichnungskopf einspaltig */
  .titleblock { grid-template-columns: 1fr; }
}
