/* ==========================================================================
   OpenRill — corporate site
   Swiss information design + Safety Orange + software motion.
   ========================================================================== */

@font-face {
  font-family: "Inter";
  src: url("assets/fonts/inter-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("assets/fonts/inter-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("assets/fonts/inter-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter Tight Variable";
  src: url("assets/fonts/inter-tight-variable.woff2") format("woff2-variations");
  font-weight: 380 560;
  font-style: normal;
  font-display: swap;
}

:root {
  /* color */
  --bg: #F7F7F4;
  --ink: #111111;
  --secondary: #888884;
  --rule: rgba(17, 17, 17, 0.10);
  --rule-strong: rgba(17, 17, 17, 0.16);
  --accent: #FF6B35;
  --accent-ink: #171106;
  --panel-bg: #F7F7F4;

  /* type */
  --font-ui: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Inter Tight Variable", "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;

  /* layout */
  --margin: clamp(24px, 3.4vw, 56px);
  --topbar-h: 84px;
  --gap: 28px;
  --radius: 0px;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; }

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

.page {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
}

/* ---------------------------------------------------------------------- */
/* Topbar                                                                  */
/* ---------------------------------------------------------------------- */

.topbar {
  height: var(--topbar-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--margin);
  border-bottom: 1px solid var(--rule);
}

.brand-mark {
  height: 22px;
  width: auto;
  display: block;
}

.brand {
  display: inline-flex;
  align-items: center;
}

.cta {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.006em;
  position: relative;
  padding-bottom: 2px;
}

.cta-label {
  position: relative;
}
.cta-label::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -3px;
  height: 1px;
  background: var(--accent);
  transition: right 240ms cubic-bezier(.4,0,.2,1);
}
.cta:hover .cta-label::after,
.cta:focus-visible .cta-label::after {
  right: 0;
}
.cta:hover,
.cta:focus-visible {
  color: var(--accent);
}
.cta-arrow {
  display: inline-block;
  transition: transform 240ms cubic-bezier(.4,0,.2,1);
}
.cta:hover .cta-arrow,
.cta:focus-visible .cta-arrow {
  transform: translateX(4px);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------------------------------------------------------------------- */
/* Stage — the primary composition                                        */
/* ---------------------------------------------------------------------- */

.stage {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(340px, 760px) 1fr;
  grid-template-rows: auto 1fr auto;
  column-gap: 40px;
  padding-left: var(--margin);
  min-height: 0;
}

.intro {
  grid-column: 1;
  grid-row: 1;
  padding-top: 48px;
}

.headline {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 480;
  font-size: clamp(38px, 4.3vw, 64px);
  line-height: 1.04;
  letter-spacing: -0.026em;
  max-width: 23ch;
}

.hero-piece {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.hero-graphic {
  width: min(60%, 420px);
  height: auto;
  display: block;
}

.hero-graphic .v-1,
.hero-graphic .v-2 {
  opacity: 0;
  transform: translateY(14px);
  animation: ventures-rise 620ms cubic-bezier(.16,.84,.44,1) forwards;
  transform-box: fill-box;
  transform-origin: bottom;
}
.hero-graphic .v-1 { animation-delay: 0ms; }
.hero-graphic .v-2 { animation-delay: 260ms; }

@keyframes ventures-rise {
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-graphic .v-1,
  .hero-graphic .v-2 {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

.foot-contact {
  grid-column: 1;
  grid-row: 3;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 4px;
  padding-bottom: 32px;
  border-top: 1px solid var(--rule);
}

.foot-email {
  font-size: 14px;
  font-weight: 500;
  padding-top: 14px;
  width: fit-content;
  position: relative;
}
.foot-email::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -3px;
  height: 1px;
  background: currentColor;
  opacity: 0.28;
  transition: opacity 200ms ease, background 200ms ease;
}
.foot-email:hover::after,
.foot-email:focus-visible::after {
  background: var(--accent);
  opacity: 1;
}

.foot-company {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--secondary);
}

.foot-legal {
  margin: 10px 0 0;
  font-size: 11px;
  color: var(--secondary);
  opacity: 0.8;
}

/* ---------------------------------------------------------------------- */
/* Software panel                                                          */
/* ---------------------------------------------------------------------- */

.panel-col {
  grid-column: 2;
  grid-row: 1 / 4;
  position: relative;
  height: 100%;
  min-height: 0;
}

.software-panel {
  position: absolute;
  inset: 0;
  border-left: 1px solid var(--rule);
  background: var(--panel-bg);
  overflow: hidden;
  display: flex;
  align-items: center;
}

.frame-mark {
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
  opacity: 0.55;
}
.frame-mark--tl {
  top: 28px; left: 28px;
  border-top: 1px solid var(--ink);
  border-left: 1px solid var(--ink);
}
.frame-mark--br {
  bottom: 28px; right: 28px;
  border-bottom: 1px solid var(--ink);
  border-right: 1px solid var(--ink);
}

.panel-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 30px;
  width: 100%;
  max-width: 460px;
  margin-left: 56px;
  padding-right: 40px;
}

.output-collapse {
  display: grid;
  grid-template-rows: 0fr;
}

.output-collapse-inner {
  overflow: hidden;
  min-height: 0;
}

.panel-caption {
  font-size: 11px;
  color: var(--secondary);
  letter-spacing: 0.01em;
}

.panel-row--status {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--secondary);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--secondary);
  flex: 0 0 auto;
}

.status-word {
  min-width: 68px;
}

.input-field {
  border: 1px solid var(--rule-strong);
  padding: 14px 16px;
  font-size: 15px;
  display: flex;
  align-items: center;
  min-height: 20px;
}

.input-text {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  width: 0;
}

.input-caret {
  display: inline-block;
  width: 2px;
  height: 16px;
  background: var(--ink);
  margin-left: 2px;
  flex: 0 0 auto;
}

.panel-row--progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-track {
  height: 2px;
  background: var(--rule);
  width: 100%;
  position: relative;
}

.progress-fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 0%;
  background: var(--accent);
}

.output-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.output-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  opacity: 0;
  transform: translateY(6px);
}

.output-marker {
  width: 7px;
  height: 7px;
  background: var(--ink);
  flex: 0 0 auto;
}

/* ---- Loop timing --------------------------------------------------- */
/* Total cycle: 12s. Phases:
   0.0–1.0s   idle
   1.0–3.0s   typing (input)
   3.0–3.6s   structuring
   3.6–6.0s   processing (progress bar)
   6.0–9.2s   output rows appear
   9.2–10.6s  hold at ready
   10.6–12s   reset to idle
*/

@media (prefers-reduced-motion: no-preference) {

  .status-dot {
    animation: statusDot 12s ease-in-out infinite;
  }
  .input-text {
    animation: typeIn 12s steps(19, end) infinite;
  }
  .input-caret {
    animation: caretBlink 0.9s steps(1, end) infinite, caretHide 12s steps(1,end) infinite;
  }
  .progress-fill {
    animation: progressFill 12s cubic-bezier(.4,0,.2,1) infinite;
  }
  .output-row {
    animation: outputRow 12s ease infinite;
  }
  .output-row:nth-child(1) { animation-delay: 0s; }
  .output-row:nth-child(2) { animation-delay: 0s; }
  .output-row:nth-child(3) { animation-delay: 0s; }
  .output-row:nth-child(4) { animation-delay: 0s; }

  /* stagger appearance within the shared 12s timeline via distinct keyframe sets */
  .output-row:nth-child(1) { animation-name: outputRow1; }
  .output-row:nth-child(2) { animation-name: outputRow2; }
  .output-row:nth-child(3) { animation-name: outputRow3; }
  .output-row:nth-child(4) { animation-name: outputRow4; }

  .output-collapse {
    animation: outputCollapse 12s ease infinite;
  }
}

@media (prefers-reduced-motion: reduce) {
  .input-text { width: auto; }
  .status-dot { background: var(--accent); }
  .progress-fill { width: 100%; }
  .output-row { opacity: 1; transform: none; }
  .output-collapse { grid-template-rows: 1fr; }
  .input-caret { display: none; }
}

@keyframes statusDot {
  0%, 8%        { background: var(--secondary); }
  10%, 29%      { background: var(--ink); }
  31%, 49%      { background: var(--accent); }
  51%, 88%      { background: var(--accent); }
  90%, 100%     { background: var(--secondary); }
}

@keyframes typeIn {
  0%        { width: 0; }
  8%        { width: 0; }
  24%       { width: 19ch; }
  86%       { width: 19ch; }
  92%       { width: 0; }
  100%      { width: 0; }
}

@keyframes caretHide {
  0%, 91%   { opacity: 1; }
  92%, 100% { opacity: 0; }
}

@keyframes caretBlink {
  0%, 49%   { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@keyframes progressFill {
  0%, 29%   { width: 0%; }
  50%       { width: 100%; }
  78%, 100% { width: 100%; }
}

@keyframes outputRow1 {
  0%, 50%   { opacity: 0; transform: translateY(6px); }
  54%, 88%  { opacity: 1; transform: translateY(0); }
  94%, 100% { opacity: 0; transform: translateY(6px); }
}
@keyframes outputRow2 {
  0%, 54%   { opacity: 0; transform: translateY(6px); }
  58%, 88%  { opacity: 1; transform: translateY(0); }
  94%, 100% { opacity: 0; transform: translateY(6px); }
}
@keyframes outputRow3 {
  0%, 58%   { opacity: 0; transform: translateY(6px); }
  62%, 88%  { opacity: 1; transform: translateY(0); }
  94%, 100% { opacity: 0; transform: translateY(6px); }
}
@keyframes outputRow4 {
  0%, 62%   { opacity: 0; transform: translateY(6px); }
  66%, 88%  { opacity: 1; transform: translateY(0); }
  94%, 100% { opacity: 0; transform: translateY(6px); }
}

@keyframes outputCollapse {
  0%, 49%   { grid-template-rows: 0fr; }
  53%, 89%  { grid-template-rows: 1fr; }
  95%, 100% { grid-template-rows: 0fr; }
}

/* ---------------------------------------------------------------------- */
/* Mobile                                                                  */
/* ---------------------------------------------------------------------- */

@media (max-width: 880px) {
  :root {
    --topbar-h: 68px;
  }

  .page {
    min-height: 100svh;
    height: auto;
  }

  .stage {
    display: flex;
    flex-direction: column;
    padding: 0 var(--margin);
  }

  .intro {
    order: 1;
    padding-top: 32px;
  }

  .panel-col {
    order: 2;
    height: 360px;
    margin: 32px calc(var(--margin) * -1) 0;
    width: auto;
  }

  .software-panel {
    border-left: none;
    border-top: 1px solid var(--rule);
  }

  .panel-inner {
    margin-left: var(--margin);
    padding-right: var(--margin);
    max-width: none;
  }

  .hero-piece {
    order: 3;
    margin: 40px 0;
  }

  .hero-graphic {
    width: min(80%, 320px);
  }

  .foot-contact {
    order: 4;
    margin-top: 28px;
    padding-bottom: 40px;
  }

  .frame-mark {
    display: none;
  }
}

@media (max-width: 420px) {
  .headline {
    font-size: 38px;
  }
}
